-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAeonWin.cpp
80 lines (64 loc) · 2 KB
/
AeonWin.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// Copyright (c) 2015-2018 Jeffrey "botman" Broome
//
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// Global Variables:
HMODULE hModule;
typedef bool (*AeonWinCallbackFunc)(int* ExitApplication);
AeonWinCallbackFunc CallbackFunc;
int ExitApplication = -1;
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// Initialize global strings
MyRegisterClass(hInstance);
// Load the AeonProfiler DLL and get the "ExitApplication" callback function
hModule = LoadLibrary(TEXT("AeonProfiler.dll"));
if( hModule != nullptr )
{
CallbackFunc = (AeonWinCallbackFunc)GetProcAddress(hModule, "AeonWinCallback");
if( CallbackFunc != nullptr )
{
CallbackFunc(&ExitApplication);
}
}
// Wait until the AeonProfiler DLL has exited
while (ExitApplication == 0)
{
Sleep(100);
}
FreeLibrary(hModule);
return 0;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = NULL;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = TEXT("AeonWinClass");
wcex.hIconSm = NULL;
return RegisterClassExW(&wcex);
}