|
|
@@ -6,11 +6,26 @@ |
|
|
|
|
|
|
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); |
|
|
|
|
|
|
|
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, |
|
|
|
PWSTR pCmdLine, int nCmdShow) { |
|
|
|
LPCWSTR windowName = L"Window"; |
|
|
|
MSG msg; |
|
|
|
void* CBR_CreateWindow(CBR_CreateWindowParams params) { |
|
|
|
HWND hwnd; |
|
|
|
WNDCLASSW wc = *(WNDCLASSW*)params.params; |
|
|
|
RegisterClassW(params.params); |
|
|
|
LPWSTR title; |
|
|
|
MultiByteToWideChar(CP_UTF8, 0, params.title, -1, title, 0); |
|
|
|
hwnd = CreateWindowW( |
|
|
|
wc.lpszClassName, |
|
|
|
title, // TODO fix |
|
|
|
WS_OVERLAPPEDWINDOW | WS_VISIBLE, |
|
|
|
params.rect.x, params.rect.y, params.rect.width, params.rect.height, |
|
|
|
NULL, NULL, |
|
|
|
wc.hInstance, |
|
|
|
NULL |
|
|
|
); |
|
|
|
|
|
|
|
return hwnd; |
|
|
|
} |
|
|
|
|
|
|
|
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { |
|
|
|
WNDCLASSW wc = { |
|
|
|
.style = CS_HREDRAW | CS_VREDRAW, |
|
|
|
.cbClsExtra = 0, |
|
|
@@ -24,14 +39,27 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, |
|
|
|
.hIcon = LoadIcon(NULL, IDI_APPLICATION), |
|
|
|
}; |
|
|
|
|
|
|
|
RegisterClassW(&wc); |
|
|
|
hwnd = CreateWindowW(wc.lpszClassName, windowName, |
|
|
|
WS_OVERLAPPEDWINDOW | WS_VISIBLE, |
|
|
|
WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL); |
|
|
|
HWND hwnd = CBR_CreateWindow((CBR_CreateWindowParams){ |
|
|
|
.rect = (CBR_Rect){ |
|
|
|
WINDOW_X, |
|
|
|
WINDOW_Y, |
|
|
|
WINDOW_WIDTH, |
|
|
|
WINDOW_HEIGHT |
|
|
|
}, |
|
|
|
.style_flags = |
|
|
|
CBR_WINDOW_STYLE_FLAG_TITLED |
|
|
|
| CBR_WINDOW_STYLE_FLAG_CLOSABLE |
|
|
|
| CBR_WINDOW_STYLE_FLAG_MINIATURIZABLE |
|
|
|
| CBR_WINDOW_STYLE_FLAG_RESIZABLE, |
|
|
|
.title = "Window Title", |
|
|
|
.params = &wc |
|
|
|
}); |
|
|
|
|
|
|
|
ShowWindow(hwnd, nCmdShow); |
|
|
|
UpdateWindow(hwnd); |
|
|
|
|
|
|
|
MSG msg; |
|
|
|
|
|
|
|
while (GetMessage(&msg, NULL, 0, 0)) { |
|
|
|
DispatchMessage(&msg); |
|
|
|
} |
|
|
|