Results 1 to 13 of 13

Thread: [Resolved] Is that exe already runing?

  1. #1

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972

    Resolved [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.
    ::Winamp 5.xx id3v2 & modern skin support::
    ::NetCF DataGrid Programatically Scroll Example::
    Don't forget to rate posts from those who helped you solving your problem, clicking on and rating it.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    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.

  3. #3
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711
    try looking into the FindWindow API it returns 0 if the program isn't running! and the hWnd if the app is running
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  4. #4

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972
    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
    ::Winamp 5.xx id3v2 & modern skin support::
    ::NetCF DataGrid Programatically Scroll Example::
    Don't forget to rate posts from those who helped you solving your problem, clicking on and rating it.

  5. #5

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972
    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?
    ::Winamp 5.xx id3v2 & modern skin support::
    ::NetCF DataGrid Programatically Scroll Example::
    Don't forget to rate posts from those who helped you solving your problem, clicking on and rating it.

  6. #6
    Fanatic Member
    Join Date
    Dec 2002
    Location
    North Carolina
    Posts
    734
    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

  7. #7

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972
    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?
    ::Winamp 5.xx id3v2 & modern skin support::
    ::NetCF DataGrid Programatically Scroll Example::
    Don't forget to rate posts from those who helped you solving your problem, clicking on and rating it.

  8. #8
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457
    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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    You would still need some program to be running. What are you trying to do exactly? Are you making the autorun program, or what?

  10. #10
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711
    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!!!
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  11. #11
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457
    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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  12. #12

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972

    Lightbulb 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
    ::Winamp 5.xx id3v2 & modern skin support::
    ::NetCF DataGrid Programatically Scroll Example::
    Don't forget to rate posts from those who helped you solving your problem, clicking on and rating it.

  13. #13

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972

    Re: Is that exe already runing?

    ::Winamp 5.xx id3v2 & modern skin support::
    ::NetCF DataGrid Programatically Scroll Example::
    Don't forget to rate posts from those who helped you solving your problem, clicking on and rating it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width