Mercurial > mm7
annotate OSAPI.cpp @ 2445:b10125a9c772
fix crash in keyboard option
author | Ritor1 |
---|---|
date | Thu, 24 Jul 2014 12:44:14 +0600 |
parents | f4af3b203f65 |
children | ff7f4995aa25 |
rev | line source |
---|---|
2415 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2152
diff
changeset
|
5 #define _CRT_SECURE_NO_WARNINGS |
0 | 6 #include "OSAPI.h" |
7 #include "OSInfo.h" | |
8 #include "Log.h" | |
9 | |
10 | |
2152 | 11 bool OSInfo::initialized = false; |
12 OSVERSIONINFOA OSInfo::info; | |
0 | 13 |
14 | |
1926 | 15 |
1038 | 16 |
0 | 17 //----- (00462C94) -------------------------------------------------------- |
18 int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE, wchar_t *lpCmdLine, int nShowCmd) | |
19 { | |
20 Log::Initialize(); | |
21 | |
22 //if (HWND hMM7Window = FindWindowW(L"MM7", 0)) | |
2412 | 23 if (HWND hMM7Window = FindWindowW(L"M&MTrilogy", 0))//check whether the window is open(проверка открыто ли окно такое же) |
0 | 24 { |
25 if (IsIconic(hMM7Window)) | |
26 ShowWindow(hMM7Window, SW_RESTORE); | |
27 SetForegroundWindow(GetLastActivePopup(hMM7Window)); | |
28 return 0; | |
29 } | |
2412 | 30 //GetActiveWindow() возвращает дескриптор активного окна текущего приложения(котоpое имеет текущий фокус ввода). |
31 //В случае ошибки,или в случае,если в программе нет активных окон,функция возвращает 0. | |
0 | 32 HWND hPrevWindow = GetActiveWindow(); |
2412 | 33 if (!hPrevWindow) |
0 | 34 { |
35 Log::Warning(L"OS init: ok"); | |
36 extern bool MM_Main(const wchar_t *pCmdLine); | |
37 MM_Main(lpCmdLine); | |
38 } | |
39 if (hPrevWindow) | |
40 SetActiveWindow(hPrevWindow); | |
41 | |
2152 | 42 return GetLastError(); |
0 | 43 } |
1545 | 44 |
45 | |
46 | |
47 | |
48 void MsgBox(const wchar_t *msg, const wchar_t *title) | |
49 { | |
50 MessageBoxW(nullptr, msg, title, 0); | |
51 } |