From 59e6235113a4d933811aa2cf6fdc8282ce394b9d Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 10 Nov 2020 18:46:11 +0800 Subject: *window --- Editor/GUI/WinUtils.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Editor/GUI/WinUtils.cpp (limited to 'Editor/GUI/WinUtils.cpp') diff --git a/Editor/GUI/WinUtils.cpp b/Editor/GUI/WinUtils.cpp new file mode 100644 index 0000000..e7b2d5b --- /dev/null +++ b/Editor/GUI/WinUtils.cpp @@ -0,0 +1,43 @@ +#include "winutils.h" + +namespace winutils +{ + + static HINSTANCE gInstanceHandle = NULL; + + HINSTANCE GetInstanceHandle() + { + 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) + { + + } + +} -- cgit v1.1-26-g67d0