How to Get a Control Reference from the Control's hWndLast reviewed: May 28, 1996Article ID: Q137093 |
The information in this article applies to:
SUMMARYVisual Basic exports a new function in the Visual Basic run time that can be used to return a control reference when all you have is the hWnd to the control. This article shows you how.
MORE INFORMATIONMicrosoft Windows uses window handles to keep track of all windowed controls created. Visual Basic wraps this functionality with the hWnd property that all windowed controls have. Ordinarily it is quite difficult to trace backwards from the hWnd property to a reference to the control it represents. It would be necessary to walk through all the child windows of a task recursively and compare each window's hWnd to the one you are seeking. However, the VBGetHwndControl function allows you to do it in one simple call. This function is not available from within Visual Basic, but you can easily wrap it in a C-language DLL.
Step-by-Step Procedure
|
Additional reference words: 4.00 vb4win vb416
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |