#include "windows.h"LRESULT CALLBACK WindowProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);
MSG msg;
HWND hwnd;
HINSTANCE hInstance;
int WINAPI WinMain(
  HINSTANCE hInstance,      // handle to current instance
  HINSTANCE hPrevInstance,  // handle to previous instance
  LPSTR lpCmdLine,          // command line
  int nCmdShow              // show state
)
{
WNDCLASSEX wndclassex;
wndclassex.cbClsExtra=0;
wndclassex.cbSize=sizeof(wndclassex);
wndclassex.cbWndExtra=0;
wndclassex.hbrBackground=(HBRUSH)GetStockObject(0);
wndclassex.hCursor=NULL;
wndclassex.hIcon=NULL;
wndclassex.hIconSm=NULL;
wndclassex.hInstance=hInstance;
wndclassex.lpfnWndProc=WindowProc;
wndclassex.lpszClassName="window";
wndclassex.style= CS_VREDRAW|CS_SAVEBITS;
RegisterClassEx(&wndclassex);
    hwnd = CreateWindow( 
        "window",        // name of window class 
        "Sample",            // title-bar string 
        WS_OVERLAPPEDWINDOW, // top-level window 
        CW_USEDEFAULT,       // default horizontal position 
        CW_USEDEFAULT,       // default vertical position 
        CW_USEDEFAULT,       // default width 
        CW_USEDEFAULT,       // default height 
        hwnd,         // no owner window 
        (HMENU) NULL,        // use class menu 
        hInstance,           // handle to application instance 
        (LPVOID) NULL);      // no window-creation data
ShowWindow(hwnd,1);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, 0,0))
    { 
        TranslateMessage(&msg); 
        DispatchMessage(&msg); 
    } 
    return msg.wParam;  return 0;
}LRESULT CALLBACK WindowProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
  )
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam); 
}
return 0;
}