#include<windows.h>
#include<stdlib.h>
#include<malloc.h>
#include<memory.h>
#include<tchar.h>LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);int APIENTRY WinMain(HINSTANCE hInstance,
 HINSTANCE hPrevInstance,
 LPSTR lpCmdLine,
 int nShowCmd)
{
WNDCLASSEX wcex;
wcex.style=CS_HREDRAW|CS_VREDRAW;
wcex.cbClsExtra=0;
wcex.cbWndExtra=0;
wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wcex.hIcon=NULL;
wcex.hCursor=NULL;
wcex.hIconSm=NULL;
wcex.lpfnWndProc=(WNDPROC)WndProc;
wcex.lpszClassName="window";
wcex.lpszMenuName=NULL;
wcex.hInstance=hInstance;
RegisterClassEx(&wcex);
HWND hWnd=CreateWindow("window", NULL, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 
CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if(!hWnd){MessageBox(NULL,"tuichu","message",MB_OK); return FALSE;}
ShowWindow(hWnd, 1);
UpdateWindow(hWnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
switch(message)
{
case WM_COMMAND:
wmId=LOWORD(wParam);
wmEvent=HIWORD(wParam);
DefWindowProc(hWnd, message, wParam, lParam);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}