equal
deleted
inserted
replaced
31 #define WINDOWSPLATFORM_H |
31 #define WINDOWSPLATFORM_H |
32 |
32 |
33 #include "GenericPlatform.h" |
33 #include "GenericPlatform.h" |
34 |
34 |
35 #include <Windows.h> |
35 #include <Windows.h> |
36 |
|
37 |
|
38 // the class is used to create and detect single instance of user application |
|
39 class SingleInstance { |
|
40 private: |
|
41 const int BUF_SIZE; |
|
42 |
|
43 DWORD _lastError; |
|
44 HANDLE _mutex; |
|
45 TString _name; |
|
46 TString _sharedMemoryName; |
|
47 HANDLE _hMapFile; |
|
48 LPCTSTR _pBuf; |
|
49 |
|
50 SingleInstance(): BUF_SIZE(0) {} |
|
51 |
|
52 SingleInstance(TString& name_); |
|
53 |
|
54 public: |
|
55 static SingleInstance* getInstance(TString& name) { |
|
56 static SingleInstance* result = NULL; |
|
57 |
|
58 if (result == NULL) { |
|
59 result = new SingleInstance(name); |
|
60 } |
|
61 |
|
62 return result; |
|
63 } |
|
64 |
|
65 ~SingleInstance(); |
|
66 |
|
67 bool IsAnotherInstanceRunning() { |
|
68 return (ERROR_ALREADY_EXISTS == _lastError); |
|
69 } |
|
70 |
|
71 bool writePid(DWORD pid); |
|
72 DWORD readPid(); |
|
73 }; |
|
74 |
36 |
75 #pragma warning( push ) |
37 #pragma warning( push ) |
76 // C4250 - 'class1' : inherits 'class2::member' |
38 // C4250 - 'class1' : inherits 'class2::member' |
77 #pragma warning( disable : 4250 ) |
39 #pragma warning( disable : 4250 ) |
78 class WindowsPlatform : virtual public Platform, GenericPlatform { |
40 class WindowsPlatform : virtual public Platform, GenericPlatform { |
109 virtual std::vector<TString> FilterOutRuntimeDependenciesForPlatform( |
71 virtual std::vector<TString> FilterOutRuntimeDependenciesForPlatform( |
110 std::vector<TString> Imports); |
72 std::vector<TString> Imports); |
111 |
73 |
112 virtual Process* CreateProcess(); |
74 virtual Process* CreateProcess(); |
113 |
75 |
114 virtual void reactivateAnotherInstance(); |
|
115 virtual bool IsMainThread(); |
76 virtual bool IsMainThread(); |
116 virtual bool CheckForSingleInstance(TString Name); |
|
117 virtual TPlatformNumber GetMemorySize(); |
77 virtual TPlatformNumber GetMemorySize(); |
118 |
78 |
119 virtual TString GetTempDirectory(); |
79 virtual TString GetTempDirectory(); |
120 |
80 |
121 #ifdef DEBUG |
81 #ifdef DEBUG |