Here's my WinMain method :
Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
myInstance = hInstance;
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = myInstance;
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = MAKEINTRESOURCE(NULL);
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL , "Failed to register window class", "Error" , MB_ICONEXCLAMATION | MB_OK );
return 0;
}
HWND hwnd;
int cx, cy;
cx = GetSystemMetrics(SM_CXMAXIMIZED);
cy = GetSystemMetrics(SM_CYMAXIMIZED);
//char data[10];
//sprintf(data, "%d, %d", cx, cy);
//MessageBox(NULL, data, "Message", MB_OK);
if(cx >= 1024)
cx = 1024;
if(cy >= 746)
cy = 746;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, g_szClassName, "ASP Menu Configuration", WS_OVERLAPPEDWINDOW,
0, 0, cx, cy, NULL, NULL, myInstance, NULL);
if(hwnd == NULL)
{
MessageBox(NULL, "Failed to create window", "Error", MB_ICONEXCLAMATION | MB_OK );
return 0;
}
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
MSG Msg;
while(GetMessage(&Msg,NULL,0,0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}