|
-
Nov 30th, 2001, 10:15 PM
#1
Thread Starter
Fanatic Member
Finding out if a program is running
How do you find out if a program is running? In this case, it is another app I made.
-
Nov 30th, 2001, 10:45 PM
#2
Addicted Member
Re: Finding out if a program is running
Originally posted by Gaming_World
How do you find out if a program is running? In this case, it is another app I made.
using API
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..
-
Nov 30th, 2001, 10:46 PM
#3
Addicted Member
err wrong again
X = Findwindow("class", vbNullString)
if X <> 0 Then Call Sendmessage(X, WM_Close, 0, 0)
-
Nov 30th, 2001, 11:32 PM
#4
Thread Starter
Fanatic Member
How do you find out the class of the object?
-
Dec 2nd, 2001, 10:16 AM
#5
Hyperactive Member
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
W#Ć€V€® W¦|| ߀ W¦|| ߀, ÄÑÐ †#€®€ ¦§ ÑÖ†#¦Ñ6 ¥Öµ ©ÄÑ ÐÖ ÄßÖµ† ¦†, §Ö §¦† ßÄ©K, ®€|ÄX ÄÑÐ |€† ¦† #ÄÞÞ€Ñ.
(Whatever will be will be, and there is nothing you can do about it, so sit back, relax and let it happen.)
-
Dec 3rd, 2001, 09:05 AM
#6
Lively Member
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
visit me on www.big-nell.com to find out the truth 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|