hello,
I am trying to open a blank window in C
I have coded word for word from this youtube video:
Windows GUI Programming with C/C++ ( Win32 API ) | Part -1 | Creating a window - YouTube
it runs, but nothing happens
Code:
#include <windows.h>
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInst , HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
//MessageBox(NULL, "HELLO","My first GUI",MB_OK);
WNDCLASSEXW wc = {0};
wc.hbrBackground = (HBRUSH) COLOR_WINDOW ;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hInstance = hInst;
wc.lpszClassName = L"myWindowClass";
wc.lpfnWndProc = WindowProcedure;
if(!RegisterClassW(&wc));
return -1;
CreateWindowW(L"myWindowClass",L"My Window",WS_EX_OVERLAPPEDWINDOW | WS_VISIBLE,100,100,500,500,
NULL,NULL,NULL,NULL);
MSG msg = {0};
while( GetMessage(&msg,NULL,NULL,NULL) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowProcedure(HWND HWND,UINT msg,WPARAM wp,LPARAM lp)
{
switch ( msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProcW(HWND,msg,wp,lp);
}
}