|
-
Nov 21st, 2004, 04:39 PM
#1
Thread Starter
Fanatic Member
[Resolved] Is that exe already runing?
How may i know if a program is already runing?
To check if a certain program in runing doesn't help much, i may have more then one program with the same name runing at same time..
What i would like was to know if a program from a sertain path is runing or not and the possibility to get it's PID
This is to make one menu for a cd and i don't want to the user be able to run the programs inside it more then once.
I will have a program that will be used as autorun with a menu to the user choose what program he want's to run.
Last edited by TDQWERTY; Dec 12th, 2004 at 05:11 AM.
-
Nov 21st, 2004, 04:43 PM
#2
search the forums for APP.INSTANCE. I think it will help prevent running the same program twice at the same time, but won't prevent running it again the next day.
-
Nov 21st, 2004, 04:44 PM
#3
Fanatic Member
try looking into the FindWindow API it returns 0 if the program isn't running! and the hWnd if the app is running
-
Nov 21st, 2004, 04:48 PM
#4
Thread Starter
Fanatic Member
Originally posted by dglienna
search the forums for APP.INSTANCE. I think it will help prevent running the same program twice at the same time, but won't prevent running it again the next day.
note that the program wasn't made by me
-
Nov 21st, 2004, 04:48 PM
#5
Thread Starter
Fanatic Member
Originally posted by ALL
try looking into the FindWindow API it returns 0 if the program isn't running! and the hWnd if the app is running
Using that api will i get the file path too or just the file name?
-
Nov 21st, 2004, 04:53 PM
#6
Fanatic Member
You will get neither of those, it returns a handle to the window it found, if it found one. Basically the only thing FindWindow can help you do is to determine if the window is open or not.
"X-mas is 24.Desember you English morons.." - NoteMe
-
Nov 21st, 2004, 05:01 PM
#7
Thread Starter
Fanatic Member
yes, for exemple, if the autorun were called autorun.exe and i had an other program called autorun inside a subfolder, the 2 diferent autorun.exe wouldn't work.
Any solution to get the path?
-
Nov 21st, 2004, 06:10 PM
#8
Frenzied Member
How about doing handshaking in the registry area. If one APP is running it writes to the registry. If a second app instance tries to run and there is already an value in the registry then it shuts down.
-
Nov 21st, 2004, 06:30 PM
#9
You would still need some program to be running. What are you trying to do exactly? Are you making the autorun program, or what?
-
Nov 21st, 2004, 06:34 PM
#10
Fanatic Member
Originally posted by David.Poundall
How about doing handshaking in the registry area. If one APP is running it writes to the registry. If a second app instance tries to run and there is already an value in the registry then it shuts down.
If you do that you need to make sure the app doesn't get unexpectidly shut down, because then the app may never get started back up unless the user does it!!!
-
Nov 21st, 2004, 07:13 PM
#11
Frenzied Member
That is one of the drawbacks. But the way of getting round that is to handshake using a counter. If the counter is incrementing say once every 5 secs, then you know that the app is alive.
If the app is Winsock based the you may need to extend that unless you have api timers of course.
-
Dec 11th, 2004, 05:12 PM
#12
Thread Starter
Fanatic Member
Re: Is that exe already runing?
I had a source code of a project that was enumerating what programs were runing and that same program allowed me to shutdown any runing application. I remember that that program was giving the full path of the runing application but i have no clue were i put that thing
-
Dec 12th, 2004, 05:10 AM
#13
Thread Starter
Fanatic Member
Re: Is that exe already runing?
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
|