|
Well because you're only checking for the window handle on application startup: a timer or something would work. However the better and more elegant solution would be to register a system hook on the WM_SHOW window message using SetWindowsHookEx and WH_SYSMSGFILTER with a pointer to a SysMsgProc function, which would then let you intercept global window messages at the instant the form is created, and expose a lot more information, just as you would in any other low level language to implement a Win32 Window. Remember lParam not wParam is the one that dereferences to a message structure in this instance.
This would be possible in VB6, however I'd recommend using VB.NET as it has much better support for marshalling structures, and the IDE doesn't use thunks and thus doesn't crash every time you make one silly little API error.
|