diff --git a/WindowFunctions.cpp b/WindowFunctions.cpp new file mode 100644 index 0000000..0202a27 --- /dev/null +++ b/WindowFunctions.cpp @@ -0,0 +1,23 @@ + +#include "WindowFunctions.h" + +bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance) +{ + WNDCLASSEX wc; + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = 0; + wc.lpfnWndProc = proc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); + wc.lpszMenuName = NULL; + wc.lpszClassName = name; + wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + if (!RegisterClassEx (&wc)) + return false; + return true; +} + diff --git a/WindowFunctions.h b/WindowFunctions.h new file mode 100644 index 0000000..9b3aeb7 --- /dev/null +++ b/WindowFunctions.h @@ -0,0 +1,4 @@ +#pragma once +#include + +bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance); \ No newline at end of file diff --git a/main.cpp b/main.cpp index 8ef7617..9a93c69 100644 --- a/main.cpp +++ b/main.cpp @@ -26,6 +26,7 @@ #include "Globals.h" #include "Demo.h" #include "win32Defines.h" +#include "WindowFunctions.h" #include @@ -1314,26 +1315,6 @@ LRESULT CALLBACK ToolProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 0; } -bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance) -{ - WNDCLASSEX wc; - wc.cbSize = sizeof(WNDCLASSEX); - wc.style = 0; - wc.lpfnWndProc = proc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); - wc.lpszMenuName = NULL; - wc.lpszClassName = name; - wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); - if (!RegisterClassEx (&wc)) - return false; - return true; -} - void Demo::main() { usableApp = this; setDebugMode(false);