Only register window class once.
This commit is contained in:
parent
3e66afeb3a
commit
5411b67e05
|
@ -38,6 +38,8 @@ bool Win32Window::Initialize() { return OnCreate(); }
|
|||
bool Win32Window::OnCreate() {
|
||||
HINSTANCE hInstance = GetModuleHandle(nullptr);
|
||||
|
||||
static bool has_registered_class = false;
|
||||
if (!has_registered_class) {
|
||||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
|
@ -55,6 +57,8 @@ bool Win32Window::OnCreate() {
|
|||
XELOGE("RegisterClassEx failed");
|
||||
return false;
|
||||
}
|
||||
has_registered_class = true;
|
||||
}
|
||||
|
||||
// Setup initial size.
|
||||
DWORD window_style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
|
|
Loading…
Reference in New Issue