Hello all,
I have typed this code from a YouTube video, which opens up a blank window, but I have no I idea what it means,
Can anyone let me know what these codes mean
Code:
#include <windows.h>
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
//hwnd is a handle to the window.
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);
}
}