Thread: Ask: Mutex

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Ask: Mutex


    Hi, i have a problem with my program. I want to make my program, so the user cannot run the exe more than once if the program already running.
    Someone told me to use mutex. But he doesnt explain how to use it. Can anyone here give me an example "hello word" program using mutex? so i can learn how mutex works and how to use it.

    thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    Originally Posted by frans3q
    Hi, i have a problem with my program. I want to make my program, so the user cannot run the exe more than once if the program already running.
    Someone told me to use mutex. But he doesnt explain how to use it. Can anyone here give me an example "hello word" program using mutex? so i can learn how mutex works and how to use it.

    thanks
    The entire process is pretty well explained here .
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by majlumbo
    The entire process is pretty well explained.
    ok. thanks
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    156
    Rep Power
    3
    I wrote a tutorial about this. Check it out here
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0
    Originally Posted by frans3q
    ok. thanks
    Var
    MyHandle: THandle;
    begin
    MyHandle:=FindWindow('TForm1', 'Form1');
    if MyHandle<>0 then
    // Exit / Terminate
    else // do normal Application.Run;

    end.


    This code will works, only one active window run in the same time. When in designing mode, comment this condition.

IMN logo majestic logo threadwatch logo seochat tools logo