Here's your code, works fine for me.
Code:
#include <windows.h>
LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
char szClassName[ ] = "App";
char WinName[ ] = "Windows API Test....";
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG Msg;
HWND hWnd;
WNDCLASSEX cls;
HBRUSH BackgroundBrush = CreateSolidBrush(RGB(255,0,0));
cls.cbSize = sizeof(WNDCLASSEX);
cls.style = CS_HREDRAW | CS_VREDRAW;
cls.lpfnWndProc = WindowProcedure;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hIcon = LoadIcon(NULL, IDI_ERROR);
cls.hCursor = LoadCursor(NULL, IDC_NO);
cls.hbrBackground = BackgroundBrush;
cls.lpszMenuName = NULL;
cls.lpszClassName = szClassName;
cls.hInstance = hInstance;
cls.hIconSm = LoadIcon(NULL, IDI_ERROR);
RegisterClassEx(&cls);
hWnd = CreateWindow (szClassName, WinName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if( !hWnd )
{
return 0;
}
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
DeleteObject(BackgroundBrush);
return Msg.wParam;
}
LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}