#include<windows.h>
#define null NULL
LRESULT CALLBACK WinProc( HWND hwnd,UINT uMsg,
WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPSTR lpCmdLine,int nShowCmd)
{
WNDCLASS wndClass;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.hCursor = LoadCursor(null,IDC_CROSS);
wndClass.hIcon = LoadIcon(null,IDI_INFORMATION);
wndClass.hInstance = hInstance;
wndClass.lpfnWndProc = WinProc;
wndClass.lpszClassName = L"bmp";
wndClass.lpszMenuName = null;
wndClass.style = CS_HREDRAW|CS_VREDRAW;
RegisterClass(&wndClass);
HWND hwnd;
hwnd = CreateWindow(wndClass.lpszClassName , L"bmp" , WS_OVERLAPPEDWINDOW
,0,0,500,600,null,null,hInstance,null);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,null,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WinProc( HWND hwnd,UINT uMsg,
WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_LBUTTONDOWN:
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,0,0,L"维新培训",strlen("维新培训"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE: //关闭时响应
if(IDYES==MessageBox(hwnd,L"是否真的结束?",L"question",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}