LRESULT回調WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(h instance h instance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow)
{
靜態TCHAR szAppNume[]= TEXT(" hello win ");
HWND hWnd
味精味精;
WNDCLASS wndclass
wnd class . style = CS _ HREDRAW | CS _ VREDRAW;
wndclass.lpfnWndProc = WndProc
wnd class . cbclsextra = 0;
wnd class . cbwndextra = 0;
wnd class . h instance = h instance;
wndclass.hIcon = LoadIcon(NULL,IDI _應用);
wnd class . hcursor = load cursor(NULL,IDC _ ARROW);
wnd class . HBR background =(HBRUSH)GetStockObject(WHITE _ BRUSH);
wndclass.lpszMenuName = NULL
wnd class . lpsz class name = szAppNume;
如果(!register class(& amp;wndclass))
{
MessageBox(NULL,TEXT("該程序需要Windows NT!"),szAppNume,MB _ icon error);
返回0;
}
hWnd = CreateWindow(szAppNume,//窗口類名
TEXT(" Hello程序"),//窗口標題
WS_OVERLAPPEDWINDOW,//窗口樣式
CW_USEDEFAULT,//初始x位置
CW_USEDEFAULT,//初始y位置
CW_USEDEFAULT,//初始x大小
CW_USEDEFAULT,//初始y尺寸
NULL,//父窗口句柄
NULL,//窗口菜單句柄
hInstance,//程序實例句柄
NULL);//創建參數
ShowWindow(hWnd,icmd show);
更新窗口(hWnd);
while(GetMessage(& amp;msg,NULL,0,0))
{
翻譯消息(& amp味精);
dispatch message(amp;味精);
}
返回msg.wParam
}
LRESULT回調WndProc(HWND hWnd,UINT消息,WPARAM wParam,LPARAM lParam)
{
HDC hdc
PAINTSTRUCT ps
RECT矩形;
開關(消息)
{
案例WM_CREATE:
打破;
案例WM_PAINT:
hdc = begin paint(hWnd & amp;PS);
GetClientRect(hWnd & amp;rect);
DrawText(hdc,Text("妳好,Windows 2000!"),-1,& amprect,
DT _ single line | DT _ CENTER | DT _ VCENTER);
面漆(hWnd & amp;PS);
返回0;
案例WM_DESTROY:
PostQuitMessage(0);
返回0;
}
返回DefWindowProc(hWnd,message,wParam,lParam);
}