How To Find a Window Handle from an Instance Handle (242308)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q242308 SUMMARY
The Shell function in Microsoft Visual Basic is used to execute an application. Often, it is useful to get a Window handle (hWnd) to the application so you can manipulate it using the Windows APIs. However, the Shell function returns an Instance handle (hInstance), which is different from a Window handle. This article shows how to create and use a GetWinHandle() function to return a Window handle based on an Instance handle.
REFERENCES
Topic in MSDN : "More about handles and process IDs" For additional information on using the EnumWindows functions to find a specified window, click the article number below
to view the article in the Microsoft Knowledge Base:
183009 How To Enumerate Windows Using the WIN32 API
For additional information on performing this task in 16-bit versions of VB, click the article number below
to view the article in the Microsoft Knowledge Base:
127030 How to Find a Window Handle Based on an Instance Handle
Modification Type: | Minor | Last Reviewed: | 7/16/2004 |
---|
Keywords: | kbAPI kbhowto KB242308 |
---|
|