| 1 |
|
program OniUnPacker; |
| 2 |
|
|
| 3 |
|
uses |
| 4 |
< |
Forms, |
| 4 |
> |
Forms, Windows, |
| 5 |
|
Main in 'Main.pas' {Form_Main}, |
| 6 |
|
Data in 'Data.pas', |
| 7 |
|
Helper_LevelDB in 'Helper_LevelDB.pas' {Form_LevelDB}, |
| 23 |
|
|
| 24 |
|
{$R *.res} |
| 25 |
|
{$R ExtraIcos.res} |
| 26 |
+ |
const |
| 27 |
+ |
MutexName = 'Oni Un/Packer'; |
| 28 |
+ |
var |
| 29 |
+ |
hMutex: THandle; |
| 30 |
|
|
| 31 |
|
begin |
| 32 |
< |
Application.Initialize; |
| 33 |
< |
Application.Title := 'Oni Un/Packer'; |
| 34 |
< |
Application.CreateForm(TForm_Main, Form_Main); |
| 35 |
< |
Application.CreateForm(TForm_LevelDB, Form_LevelDB); |
| 36 |
< |
Application.CreateForm(TForm_ValueEdit, Form_ValueEdit); |
| 37 |
< |
Application.CreateForm(TForm_Settings, Form_Settings); |
| 38 |
< |
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); |
| 48 |
|
end. |