June 30th, 1999, 09:22 AM
Hi!
I Use this code to check if another instance of a program is running. It works in win 95, but not in Windows NT.
If the program crasch in NT it is impossible to start it again, because the application thinks another instance is still running.
Is there any other way to solve this problem in windows NT?
/Beginner
<----------- CODE BEGIN --------------->
// Checking if another instance of a program is running
HANDLE hMapping;
int iRes;
hMapping = CreateFileMapping( (HANDLE) 0xffffffff,
NULL, PAGE_READONLY,
0, 32, "MyTestMap" );
loggfil.logga("WinMain - CreateFileMapping");
if( hMapping )
{ if( GetLastError() == ERROR_ALREADY_EXISTS )
{
loggfil.logga("WinMain - Another instance of ivclip is already running. Exiting.");
ExitProcess(1);
}
}
else
{ ExitProcess(1); }
I Use this code to check if another instance of a program is running. It works in win 95, but not in Windows NT.
If the program crasch in NT it is impossible to start it again, because the application thinks another instance is still running.
Is there any other way to solve this problem in windows NT?
/Beginner
<----------- CODE BEGIN --------------->
// Checking if another instance of a program is running
HANDLE hMapping;
int iRes;
hMapping = CreateFileMapping( (HANDLE) 0xffffffff,
NULL, PAGE_READONLY,
0, 32, "MyTestMap" );
loggfil.logga("WinMain - CreateFileMapping");
if( hMapping )
{ if( GetLastError() == ERROR_ALREADY_EXISTS )
{
loggfil.logga("WinMain - Another instance of ivclip is already running. Exiting.");
ExitProcess(1);
}
}
else
{ ExitProcess(1); }