1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include "BsolWindows.h"
#include <stdio.h>
#include <tchar.h>
namespace BsolControls {
BsolWindows::BsolWindows(LPCWSTR ClassName, LPCWSTR WndTitle) {
hInst = NULL;
BsolWndCls.cbClsExtra = 0;
BsolWndCls.cbSize = sizeof(WNDCLASSEX);
BsolWndCls.cbWndExtra = 0;
BsolWndCls.hbrBackground = (HBRUSH)(COLOR_WINDOW);
BsolWndCls.hCursor = LoadCursor(NULL, IDC_ARROW);
BsolWndCls.hIcon = LoadIcon(NULL, IDI_APPLICATION);
BsolWndCls.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
BsolWndCls.hInstance = this->hInst;
BsolWndCls.lpfnWndProc = NULL; //BsolWndProc;
BsolWndCls.lpszClassName = ClassName;
BsolWndCls.lpszMenuName = NULL;
BsolWndCls.style = NULL;
if(!RegisterClassEx(&BsolWndCls)) {
MessageBoxA(NULL, "Grrr!\nCould not register window class!", "ERROR", MB_OK | MB_ICONERROR);
}
MessageBoxA(NULL, "Before creating window!", "Note", MB_OK | MB_ICONERROR);
hWnd = CreateWindowEx(WS_EX_APPWINDOW, ClassName, WndTitle, WS_OVERLAPPEDWINDOW, 0, 0, 300, 400, NULL, NULL, hInst, NULL);
if(hWnd == NULL) {
MessageBoxA(NULL, "Could not create Window! :(", "ERROR", MB_OK | MB_ICONERROR);
}
}
void BsolWindows::BsolSetInstance(HINSTANCE Inst) {
this->hInst = Inst;
this->BsolWndCls.hInstance = this->hInst;
}
void BsolWindows::BsolSetClassName(LPCWSTR ClassName) {
this->BsolWndCls.lpszClassName = ClassName;
}
void BsolWindows::BsolSetWndProc(WNDPROC WndProcName) {
this->BsolWndCls.lpfnWndProc = WndProcName;
}
void BsolWindows::BsolWndShow() {
ShowWindow(hWnd, SW_SHOW);
}
}
|