How do you find out if a program is running? In this case, it is another app I made.
Printable View
How do you find out if a program is running? In this case, it is another app I made.
using APIQuote:
Originally posted by Gaming_World
How do you find out if a program is running? In this case, it is another app I made.
X <> Findwindow("class", vbNullString)
if X = 0 Then Call Sendmessage(X, WM_Close, 0, 0)
there was this same question b4, but i dont know how to
hyperlink threads so i just wrote it over..:p
err wrong again
X = Findwindow("class", vbNullString)
if X <> 0 Then Call Sendmessage(X, WM_Close, 0, 0)
How do you find out the class of the object?
Err, Gaming_World didn't say anything about closing the app!
X = Findwindow("class", "title")
If X <> 0 then MsgBox "The app is running!"
Class is the class, if you wrote it in vb it is something like ThunderMain.
Title is the title of the app, such as Project1 or SpaceInvaders2
and if you want to activate that program, use this code (found on vb-world):
lngTemp = ShowWindowAsync(hWnds(1), SW_RESTORE)
SetWindowPos hWnds(1), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
sWindowText = Space(255)
lngTemp = GetWindowText(hWnds(1), sWindowText, 255)
sWindowText = Left(sWindowText, lngTemp)
AppActivate sWindowText
SetWindowPos hWnds(1), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End
hWnds(1) is the address given back by findWindow API