Archived
40 lines
1.8 KiB
C++
40 lines
1.8 KiB
C++
#include "EzWinAPIBuilders.h"
|
|
|
|
WNDCLASSEX EzCreateClass(LPCWSTR name, WNDPROC messageLoop, HINSTANCE instance, LPCWSTR classIcon, LPCWSTR cursor) {
|
|
WNDCLASSEX wc;
|
|
wc.style = 0;
|
|
wc.cbSize = sizeof(WNDCLASSEX);
|
|
wc.lpfnWndProc = messageLoop;
|
|
wc.cbClsExtra = 0;
|
|
wc.cbWndExtra = 0;
|
|
wc.hInstance = instance;
|
|
wc.hIcon = LoadIcon(NULL, classIcon);
|
|
wc.hCursor = LoadCursor(NULL, cursor);
|
|
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
|
wc.lpszMenuName = NULL;
|
|
wc.lpszClassName = name;
|
|
wc.cbWndExtra = 0;
|
|
wc.hIconSm = LoadIcon(NULL, IDI_ERROR);
|
|
return wc;
|
|
}
|
|
HWND EzCreateWindow(WNDCLASSEX windowClass, HINSTANCE instance, LPCWSTR windowTitle, DWORD windowStyles, int windowWidth, int windowHeight, HWND parent, HMENU menu) {
|
|
return CreateWindowEx(WS_EX_CLIENTEDGE, windowClass.lpszClassName, windowTitle, windowStyles, CW_USEDEFAULT, CW_USEDEFAULT, windowWidth, windowHeight, parent, menu, instance, NULL);
|
|
}
|
|
HWND EzCreateButton(LPCWSTR label, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles) {
|
|
if (styles == NULL) {
|
|
styles = WS_CHILD | WS_VISIBLE;
|
|
}
|
|
return CreateWindowEx(0, L"BUTTON", label, WS_CHILD | WS_VISIBLE, posX, posY, sizeW, sizeH, mainWindow, NULL, NULL, NULL);
|
|
}
|
|
HWND EzCreateLabel(LPCWSTR startingContent, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles) {
|
|
if (styles == NULL) {
|
|
styles = WS_CHILD | WS_VISIBLE;
|
|
}
|
|
return CreateWindowEx(0, L"STATIC", startingContent, styles, posX, posY, sizeW, sizeH, mainWindow, NULL, NULL, NULL);
|
|
}
|
|
HWND EzCreateControl(LPCWSTR type, LPCWSTR startingContent, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles) {
|
|
if (styles == NULL) {
|
|
styles = WS_CHILD | WS_VISIBLE;
|
|
}
|
|
return CreateWindowEx(0, type, startingContent, WS_CHILD | WS_VISIBLE, posX, posY, sizeW, sizeH, mainWindow, NULL, NULL, NULL);
|
|
} |