2020-01-16 15:06:22 +08:00
|
|
|
#include "window_helpers.h"
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p)
|
|
|
|
{
|
|
|
|
WNDCLASS wc = { 0 };
|
2020-03-05 18:07:06 +08:00
|
|
|
|
2020-01-16 15:06:22 +08:00
|
|
|
PCWSTR wndClassName = L"MsgWindow";
|
|
|
|
|
|
|
|
wc.lpfnWndProc = DefWindowProc;
|
|
|
|
wc.cbWndExtra = sizeof(void*);
|
|
|
|
wc.hInstance = hInst;
|
|
|
|
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
|
|
|
wc.lpszClassName = wndClassName;
|
|
|
|
|
|
|
|
RegisterClass(&wc);
|
|
|
|
|
|
|
|
HWND hwnd = CreateWindowEx(
|
|
|
|
0, wndClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInst, nullptr);
|
|
|
|
if (hwnd)
|
|
|
|
{
|
|
|
|
SetWindowLongPtr(hwnd, 0, (LONG_PTR)p);
|
|
|
|
if (pfnWndProc)
|
|
|
|
{
|
|
|
|
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)pfnWndProc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hwnd;
|
|
|
|
}
|