Ignore:
Timestamp:
Jan 15, 2007, 6:12:51 PM (16 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/OniUnPacker.dpr

    r74 r88  
    22
    33uses
    4   Forms,
     4  Forms, Windows,
    55  Main in 'Main.pas' {Form_Main},
    66  Data in 'Data.pas',
     
    2424{$R *.res}
    2525{$R ExtraIcos.res}
     26const
     27  MutexName = 'Oni Un/Packer';
     28var
     29  hMutex: THandle;
    2630
    2731begin
    28   Application.Initialize;
    29   Application.Title := 'Oni Un/Packer';
    30   Application.CreateForm(TForm_Main, Form_Main);
    31   Application.CreateForm(TForm_LevelDB, Form_LevelDB);
    32   Application.CreateForm(TForm_ValueEdit, Form_ValueEdit);
    33   Application.CreateForm(TForm_Settings, Form_Settings);
    34   Application.Run;
     32  hMutex := CreateMutex(nil, True, MutexName);
     33  if (hMutex = 0) or (GetLastError = ERROR_ALREADY_EXISTS) then
     34  begin
     35    PostMessage(HWND_BROADCAST, 0, 0, 0);
     36  end
     37  else
     38  begin
     39    Application.Initialize;
     40    Application.Title := 'Oni Un/Packer';
     41    Application.CreateForm(TForm_Main, Form_Main);
     42    Application.CreateForm(TForm_LevelDB, Form_LevelDB);
     43    Application.CreateForm(TForm_ValueEdit, Form_ValueEdit);
     44    Application.CreateForm(TForm_Settings, Form_Settings);
     45    Application.Run;
     46  end;
     47  CloseHandle(hMutex);
    3548end.
Note: See TracChangeset for help on using the changeset viewer.