So there I was trying a new way to create a win32 window when to my tired di I receive during compilation but an error.
Oh what could that error be?
//Standard wondows include
#include
//Message Loop CallBack Function Prototype
LRESULT CALLBACK fnMessageProcessor (HWND, UINT, WPARAM, LPARAM);
//Function called automatically when the program starts
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
int iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASSEX wndclass;
//Set up window class
wndclass.cbSize =sizeof(WNDCLASSEX);
wndclass.style =CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc =fnMessageProcessor;
wndclass.cbClsExtra =0;
wndclass.cbWndExtra =0;
wndclass.hInstance =hInstance;
wndclass.hIcon =LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor =LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName="Window Class";
//Class Name
wndclass.hIconSm =LoadIcon(NULL, IDI_APPLICATION);
//Register the window class
if(RegisterClassEx(&wndclass)==0)
{
//the program failed, exit
exit(1);
}
//Create the window
hWnd=CreateWindowEx(
WS_EX_OVERLAPPEDWINDOW,
"Window Class", //Class Name
"Create Window Example", //Title bar text
WS_OVERLAPPEDWINDOW,
0,
0,
320,
200,
NULL,
NULL,
hInstance,
NULL);
//Display Window
ShowWindow(hWnd, iCmdShow);
//Process Messages until program is terminated
while(GetMessage (&msg,NULL, 0, 0));
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
//Message loop callBack function (Required for all windows programs)
LRESULT CALLBACK fnMessageProcessor(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch(iMsg)
{
//Called when window is first created
case WM_CREATE:
return(0);
//Called when window is refreshed
case WM_PAINT:
return(0);
//Called when the user closes the window
case WM_DESTROY:
PostQuitMessage(0);
return(0);
default:
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
}
Any takers?
Best,
Jerry