WindowFunctions.cpp added for annoyingly long win32 stuff.

This commit is contained in:
MusicalProgrammer
2018-06-02 19:22:01 -04:00
parent 0cf7813bea
commit fb3513c6f6
3 changed files with 28 additions and 20 deletions

23
WindowFunctions.cpp Normal file
View File

@@ -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;
}

4
WindowFunctions.h Normal file
View File

@@ -0,0 +1,4 @@
#pragma once
#include <windows.h>
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance);

View File

@@ -26,6 +26,7 @@
#include "Globals.h"
#include "Demo.h"
#include "win32Defines.h"
#include "WindowFunctions.h"
#include <limits.h>
@@ -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);