annotate OSAPI.cpp @ 2458:d53da932f594

include legacy_dx libs
author Ritor1
date Sat, 26 Jul 2014 13:03:43 +0600
parents f4af3b203f65
children ff7f4995aa25
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2412
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2412
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2412
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2412
diff changeset
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
Ritor1
parents:
diff changeset
6 #include "OSAPI.h"
Ritor1
parents:
diff changeset
7 #include "OSInfo.h"
Ritor1
parents:
diff changeset
8 #include "Log.h"
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2059
diff changeset
11 bool OSInfo::initialized = false;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2059
diff changeset
12 OSVERSIONINFOA OSInfo::info;
0
Ritor1
parents:
diff changeset
13
Ritor1
parents:
diff changeset
14
1926
3eb0c4f3d899 Woops, debug stuff.
Nomad
parents: 1924
diff changeset
15
1038
39f42990698f Cleanings
Nomad
parents: 28
diff changeset
16
0
Ritor1
parents:
diff changeset
17 //----- (00462C94) --------------------------------------------------------
Ritor1
parents:
diff changeset
18 int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE, wchar_t *lpCmdLine, int nShowCmd)
Ritor1
parents:
diff changeset
19 {
Ritor1
parents:
diff changeset
20 Log::Initialize();
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22 //if (HWND hMM7Window = FindWindowW(L"MM7", 0))
2412
e7a551f458e1 LoadSound - cause of the crash exe file
Ritor1
parents: 2253
diff changeset
23 if (HWND hMM7Window = FindWindowW(L"M&MTrilogy", 0))//check whether the window is open(проверка открыто ли окно такое же)
0
Ritor1
parents:
diff changeset
24 {
Ritor1
parents:
diff changeset
25 if (IsIconic(hMM7Window))
Ritor1
parents:
diff changeset
26 ShowWindow(hMM7Window, SW_RESTORE);
Ritor1
parents:
diff changeset
27 SetForegroundWindow(GetLastActivePopup(hMM7Window));
Ritor1
parents:
diff changeset
28 return 0;
Ritor1
parents:
diff changeset
29 }
2412
e7a551f458e1 LoadSound - cause of the crash exe file
Ritor1
parents: 2253
diff changeset
30 //GetActiveWindow() возвращает дескриптор активного окна текущего приложения(котоpое имеет текущий фокус ввода).
e7a551f458e1 LoadSound - cause of the crash exe file
Ritor1
parents: 2253
diff changeset
31 //В случае ошибки,или в случае,если в программе нет активных окон,функция возвращает 0.
0
Ritor1
parents:
diff changeset
32 HWND hPrevWindow = GetActiveWindow();
2412
e7a551f458e1 LoadSound - cause of the crash exe file
Ritor1
parents: 2253
diff changeset
33 if (!hPrevWindow)
0
Ritor1
parents:
diff changeset
34 {
Ritor1
parents:
diff changeset
35 Log::Warning(L"OS init: ok");
Ritor1
parents:
diff changeset
36 extern bool MM_Main(const wchar_t *pCmdLine);
Ritor1
parents:
diff changeset
37 MM_Main(lpCmdLine);
Ritor1
parents:
diff changeset
38 }
Ritor1
parents:
diff changeset
39 if (hPrevWindow)
Ritor1
parents:
diff changeset
40 SetActiveWindow(hPrevWindow);
Ritor1
parents:
diff changeset
41
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2059
diff changeset
42 return GetLastError();
0
Ritor1
parents:
diff changeset
43 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
44
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
45
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
46
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
47
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
48 void MsgBox(const wchar_t *msg, const wchar_t *title)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
49 {
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
50 MessageBoxW(nullptr, msg, title, 0);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1038
diff changeset
51 }