Currently, we have a 3rd party app (written in VB6) that loses focus while it's running in the middle of the night. When it loses focus, processing stops.
I have a small VB6 app that runs throughout the night, checking for error dialogs using the FindWindow function. When my app finds an error dialog by its caption/title and classname (#32770), and gets the handle to the dialog box, I use SendMessage handle, WM_CLOSE, 1, 0 to close the error dialog. That process works great.
My problem is that now we have the 3rd party app losing focus on a small form - and again, processing stops. I have tried using FindWindow to get the handle of the small form - but with no success. While I am searching for the caption that is on the form at the EXACT time of the lost focus - it turns out that the form caption is actually Form1 when it's compiled. During processing, the caption for Form1 is changed on the fly.
I need a way to find the handle of the form in VB6, so I can send a command to it to bring focus back to it. I need to be able to add this to my small VB6 app that runs during the night - we can't make changes to the 3rd party app (of course).
Just as an FYI, if I remote into the server while this 3rd party app has lost focus on the small form - all I have to do is click the mouse on the lost focus form - and the application takes off running.
I'd really appreciate some expert help here. Thanks!