| View previous topic :: View next topic |
| Author |
Message |
DebugMe Newbie cheater
Reputation: 0
Joined: 29 May 2007 Posts: 20
|
Posted: Thu Jun 07, 2007 3:02 pm Post subject: how to limit |
|
|
how do i limit the number of the same program being run? Like ventrillo you can't run more then 1.
thnx
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Thu Jun 07, 2007 3:03 pm Post subject: |
|
|
| Code: | if(FindWindow("YourWindowClass", "WindowName"))
return 0; |
Lol, theres load of ways. this is the easiest
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Thu Jun 07, 2007 3:05 pm Post subject: |
|
|
Well there's many ways of doing it. I prefer using Mutex method.
Here's an exemple
| Code: | hMutex = CreateMutex(
NULL,
FALSE,
"{FA531CC1-0497-11d3-A180-00105A276C3E}");
if( GetLastError() == ERROR_ALREADY_EXISTS )
{
MessageBox (hWndDlg, "Another copy is already running!", "Error", MB_OK);
EndDialog(hWndDlg, 0);
return 0;
} |
And before closing the application close the handle CloseHandle(hMutex);
There's more way of doing it, --> http://www.codeproject.com/cpp/limitnumins.asp
_________________
|
|
| Back to top |
|
 |
|