I am wanting to be able to look for a program to open.....
Say i have a program thats running i want it to continue to search until like say word pad opens......
How can i do this?
Printable View
I am wanting to be able to look for a program to open.....
Say i have a program thats running i want it to continue to search until like say word pad opens......
How can i do this?
This will search for Notepad.
The 2nd last argument specifies the classname, and the last argument is the window title. If you "don't care" what the title or class name is, pass vbNullString. In this case I passed vbNullString because the title will vary, whereas the classname is constant.VB Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Sub Command1_Click() Dim hWin As Long hWin = FindWindowEx(0, 0, "Notepad", vbNullString) Do While hWin = 0 DoEvents hWin = FindWindowEx(0, 0, "Notepad", vbNullString) Loop MsgBox "Notepad is open" End Sub
Awsome Thanks