HOWTO: Pass a Point Structure to the Windows API by ValueLast reviewed: July 15, 1997Article ID: Q161301 |
The information in this article applies to:
SUMMARYThe WindowFromPoint and ChildWindowFromPoint API functions require that a Point structure be passed by value. Visual Basic is not capable of passing a structure by value, only by reference. However, it is possible to pass the elements of the user-defined type in the correct order so that these API functions can be used. This article explains and demonstrates how to pass the Point structure by value to the API.
MORE INFORMATIONTo preserve compatibility with previous Windows APIs, Microsoft decided that the Point structure should continue to be passed by value for the WindowFromPoint and ChildWindowFromPoint API functions in the 32-bit user dynamic link library (DLL). Visual Basic is not capable of passing structures by value, but the value of the elements of the structure can be placed on the stack in the correct order. Therefore, when passing the elements of the Point structure, two long values should be passed. Another important consideration is that Visual Basic uses the C convention (stdcall) of passing parameters. This convention specifies that arguments are placed on the stack from right to left. API functions are declared using the Pascal calling convention where the elements of the structure must be listed in reverse order (that is, element y followed by x) when calling the WindowFromPoint function using 32-Bit Visual Basic.
Step-by-Step Example
Keywords : APrgWindow vb5all vb5howto VBKBProgramming VBKBWinAPI kbusage kbhowto Version : 5.00 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |