Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
program OneInstance;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses SysUtils, Windows;
|
||||
|
||||
var
|
||||
FMutex: THandle;
|
||||
begin
|
||||
FMutex := CreateMutex(nil, True, 'OneInstanceMutex');
|
||||
if FMutex = 0 then
|
||||
RaiseLastOSError
|
||||
else
|
||||
begin
|
||||
try
|
||||
if GetLastError = ERROR_ALREADY_EXISTS then
|
||||
Writeln('Program already running. Closing...')
|
||||
else
|
||||
begin
|
||||
// do stuff ...
|
||||
Readln;
|
||||
end;
|
||||
finally
|
||||
CloseHandle(FMutex);
|
||||
end;
|
||||
end;
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue