-
Notifications
You must be signed in to change notification settings - Fork 4
/
pfreepanic.cpp
48 lines (45 loc) · 1.21 KB
/
pfreepanic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <tchar.h>
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", FormPfreepanic);
//---------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
for (int i = 1; i <= ParamCount(); i++) {
if (LowerCase(ParamStr(i)).Pos(L"close")) {
HWND hw = FindWindow(L"TFormPfreepanic", NULL);
if (hw)
::SendNotifyMessage(hw, WM_APP+1, 0, 0);
return -1;
}
}
CreateMutex(0, FALSE, L"Local\\$pfreepanic$");
if (GetLastError() == ERROR_ALREADY_EXISTS)
return -1;
try
{
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TFormPfreepanic), &FormPfreepanic);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------