speke
asked on
Using SetParent API
I've used the SetParent API to host various windows within in VB(6 sp5) MDI form, but I cannot seem to reference or set as active the created window(s). I've used ChildWindowFromPoint to return the hwnd of the child, but this is flaky at best.
Has anyone seen or have got a good example of how to do this?
Has anyone seen or have got a good example of how to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Okay,
This example works great with Calc and Notepad.
I am using 2 Visual Basic applications, one application is designed to be a master application, and the other an extension. When i try to use the above example to call my secondary application and contain it to the parent master application, it doesn't work. IE, the executed application still floats around and looses focus as usual. If i change the line back to calc or notepad, works great.
Is there a better way to getting a compiled VB app to Child to another VB app?
This example works great with Calc and Notepad.
I am using 2 Visual Basic applications, one application is designed to be a master application, and the other an extension. When i try to use the above example to call my secondary application and contain it to the parent master application, it doesn't work. IE, the executed application still floats around and looses focus as usual. If i change the line back to calc or notepad, works great.
Is there a better way to getting a compiled VB app to Child to another VB app?
Second, if you have the hwnd of those windows, use SetFocus Api to give focus to desired window.
Private Declare Function API_SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
'usage:
API_SetFocus hwnd