The simplest function is FindWindow: Public Declare Function FindWindow Lib 'user32' Alias 'FindWindowA' (ByVal lpClassName As String, ByVal lpWindowName As String) As Long. The difference is that while DialogBox () implements it's own message loop and does not return untill the dialog is closed, CreateDialog () acts more like a window created with CreateWindowEx () in that it returns immediately and depends. Fortunately the OS offers many forms of identifying the window handles by using Windows API functions.
When I run both apps Im able to Min/Max/Restore the other window from my application, but the code in FormResize is only triggered by SWRESTORE and SWMAXIMIZE. Now we take a look at CreateDialog (), DialogBox () 's sister function. Susan Harkins lists 10 handy APIs and explains how you can put them to work. Here's some sample code I drew up to test this. The ShowWindow API works great, except for one thing, code in the FormResize event doesnt fire when the application is minimized by a ShowWindow call. When a VBA solution falls short of your needs, there's probably a Windows API function that can handle the job. Any idea why this is happening? Am I missing something? When I run both apps I'm able to Min/Max/Restore the other window from my application, but the code in Form_Resize is only triggered by SW_RESTORE and SW_MAXIMIZE. The ShowWindow API works great, except for one thing, code in the Form_Resize event doesn't fire when the application is minimized by a ShowWindow call. Visual Basic for Applications (VBA) is part of Microsoft's legacy software, Visual Basic, built to help write programs for the Windows operating system.
I'm trying to control the window state of one application from another VB app.