#include <windows.h>
LRESULT CALLBACK WndProc(HWND , UINT , WPARAM ,LPARAM);
int main()
{
WNDCLASS wndClass;
HWND hWnd;
MSG msg;
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = (HINSTANCE)GetModuleHandle(NULL);
wndClass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_PEN);
wndClass.lpszClassName = TEXT("基本窗口");
wndClass.lpszMenuName = NULL;
if(!RegisterClass(&wndClass))
return false;
hWnd = CreateWindow(TEXT("基本窗口"),TEXT("基本窗口"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,wndClass.hInstance,NULL);
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
return 0;
default :
return DefWindowProc(hWnd,message,wParam,lParam);
}
return 0;
}