summaryrefslogtreecommitdiff
path: root/Editor/GUI/WinUtils.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-11-10 18:46:11 +0800
committerchai <chaifix@163.com>2020-11-10 18:46:11 +0800
commit59e6235113a4d933811aa2cf6fdc8282ce394b9d (patch)
tree12410a230c5339ca88be6842c0dc811d5c6ec0ba /Editor/GUI/WinUtils.cpp
parentf0807fc44dde14531759306317611bab87c8fccf (diff)
*window
Diffstat (limited to 'Editor/GUI/WinUtils.cpp')
-rw-r--r--Editor/GUI/WinUtils.cpp43
1 files changed, 43 insertions, 0 deletions
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)
+ {
+
+ }
+
+}