blob: 84d0e37874b159dc1ecb546f69b1960b6434ff51 (
plain)
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
|
#include "winutils.h"
namespace winutils
{
static HINSTANCE gInstanceHandle = NULL;
HINSTANCE GetInstanceHandle()
{
if (gInstanceHandle == NULL)
{
gInstanceHandle = GetModuleHandle(NULL);
}
return gInstanceHandle;
}
ATOM RegisterWindowClass(const wchar_t* className, WNDPROC windowProc, unsigned int style)
{
#if DEBUG_WIN_UTILS
printf_console("Debug winutils: register class %s\n", className);
#endif
WNDCLASSEXW wcex;
memset(&wcex, 0, sizeof(wcex));
wcex.cbSize = sizeof(wcex);
wcex.style = style;
wcex.lpfnWndProc = windowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = winutils::GetInstanceHandle();
//wcex.hIcon = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_APP_ICON);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = className;
ATOM classAtom = RegisterClassExW(&wcex);
//if (!classAtom)
// printf("Failed to register window class %s: %s\n", className, WIN_LAST_ERROR_TEXT);
return classAtom;
}
void UnregisterWindowClass(const wchar_t* className)
{
}
}
|