-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrader.cpp
65 lines (60 loc) · 1.93 KB
/
Trader.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <tchar.h>
//---------------------------------------------------------------------------
#include <Vcl.Styles.hpp>
#include <Vcl.Themes.hpp>
USEFORM("Unit6.cpp", Form6);
USEFORM("Unit5.cpp", Form5);
USEFORM("Unit4.cpp", Form4);
USEFORM("Unit9.cpp", Form9);
USEFORM("Unit8.cpp", Form8);
USEFORM("Unit7.cpp", Form7);
USEFORM("Unit3.cpp", Form3);
USEFORM("Unit1.cpp", Form1);
USEFORM("Unit12.cpp", Form12);
USEFORM("Unit11.cpp", Form11);
USEFORM("Unit10.cpp", Form10);
USEFORM("Unit13.cpp", Form13);
USEFORM("Unit14.cpp", Form14);
//---------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
try
{
// Ïûòàåìñÿ îòêðûòü ìüþòåêñ.
HANDLE hMutex = OpenMutex( MUTEX_ALL_ACCESS, 0, L"Trader");
if(!hMutex) // Ìüþòåêñà íå ñóùåñòâóåò. Òî åñòü, ýòî ïåðâûé ýêçåìïëÿð, ñîçäàåì ìüþòåêñ.
hMutex = CreateMutex(0, 0, L"Trader");
else // Ìüþòåêñ ñóùåñòâóåò , òî åñòü , çàïóùåí // âòîðîé ýêçåìïëÿð, âîçâðàùàåìñÿ èç ôóíêöèè.
{
MessageBox(0,L"Trader is already run !", L"Trader MUTEX is working", MB_OK + MB_ICONWARNING);
return 0;
}
Application->Initialize();
Application->MainFormOnTaskBar = true;
TStyleManager::TrySetStyle("Light");
Application->CreateForm(__classid(TForm1), &Form1);
Application->CreateForm(__classid(TForm8), &Form8);
Application->Run();
ReleaseMutex(hMutex); // Ïðèëîæåíèå çàêðûâàåòñÿ , // îñâîáîæäàåì ìüþòåêñ.
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------