how to prevent multiple instances of my program?

how to prevent multiple instances of my program
please
can someone give me a small example
if is posible in C not C++
thanks!


Answer this question

how to prevent multiple instances of my program?

  • Mikey Stevey

    Thank YOU Big Smile
  • Roger Haight MSFT

    Try this... ( to be placed at the beginning of the _tWinMain() function if using C++ Express )

    CreateMutex(NULL, TRUE, (LPCWSTR)
    "TESTAPP_MUTEX_NAME");
    if( GetLastError() == ERROR_ALREADY_EXISTS )
       return FALSE;



  • how to prevent multiple instances of my program?