summaryrefslogtreecommitdiff
path: root/Editor/GUI/WinUtils.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-11-13 22:07:18 +0800
committerchai <chaifix@163.com>2020-11-13 22:07:18 +0800
commit0edde8a08c6a9a55135dadcff6cd21988d523041 (patch)
tree696f72ba8e82e7aaa8b41bb277557eb34e4ebaaf /Editor/GUI/WinUtils.cpp
parent2fae5dab12e9b7e3d70e21707c8b358834808451 (diff)
parent6f326b50d86fab5955a37fe317f14888662b055a (diff)
Merge branch 'master' of warmcat.org:/home/git-repo/GameLab
# Conflicts: # Projects/VisualStudio/Editor/Editor.vcxproj # Projects/VisualStudio/Editor/Editor.vcxproj.filters
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)
+ {
+
+ }
+
+}