Advertisement
TLama

Untitled

Dec 4th, 2014
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.93 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Code]
  7. const
  8.   // our system-wide unique mutex name (at most MAX_PATH == 260 chars long,
  9.   // case sensitive for comparison)
  10.   MutexName = 'AAD45705-FD28-49E5-99A7-BB7638E16D3B';
  11.  
  12. function InitializeSetup: Boolean;
  13. begin
  14.   // do not continue if our mutex already exists (it means another instance
  15.   // of this setup is running)
  16.   Result := not CheckForMutexes(MutexName);
  17.  
  18.   // if our mutex was not found (no other instance is running), create one,
  19.   // otherwise show a message and let the setup exit
  20.   if Result then  
  21.     CreateMutex(MutexName)
  22.   else
  23.     MsgBox('Setup is already running.', mbInformation, MB_OK);
  24. end;
  25.  
  26. function InitializeUninstall: Boolean;
  27. begin
  28.   // here if you create our mutex, the installer won't start (it prevents to
  29.   // start the installer when an instance of the uninstaller is running)
  30.   CreateMutex(MutexName);
  31. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement