#include <windows.h>
#include <stdio.h>
// 消息处理过程函数
LRESULT CALLBACK messageProc(HWND hwnd,UINT uMsg,WPARAM wparam,LPARAM lParam){
return DefWindowProc(hwnd,uMsg,wparam,lParam);
}
// 入口函数
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
// 设计窗口
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=messageProc;
wndcls.lpszClassName="guosi";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&wndcls);
// 创建窗口
HWND hwnd;
hwnd=CreateWindow("guosi","desc",WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,NULL,hInstance,NULL);
// 显示窗口
ShowWindow(hwnd,SW_SHOWNORMAL);
// 更新窗口
UpdateWindow(hwnd);
// 消息循环
MSG msg;
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 1;
}
网友评论