C++ 窗口软件基础框架代码

来源:互联网 发布:试穿衣服的软件 编辑:程序博客网 时间:2024/06/04 20:12
#include<windows.h>LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);int __stdcall WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,char *cmdline,int nshowcmd){WNDCLASS wc;wc.cbClsExtra=0;wc.cbWndExtra=0;wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);wc.hCursor=LoadCursor(0,IDC_ARROW);wc.hIcon=NULL;wc.hInstance=hinstance;wc.lpfnWndProc=WndProc;wc.lpszClassName="WND";wc.lpszMenuName=NULL;wc.style=CS_HREDRAW | CS_VREDRAW;RegisterClass(&wc);HWND hwnd= CreateWindow("WND","紫轩、为王",WS_OVERLAPPEDWINDOW,0,0,500,500,0,0,hinstance,0);ShowWindow(hwnd,SW_SHOW);UpdateWindow(hwnd);MSG msg;while(GetMessage(&msg,hwnd,0,0)>0){TranslateMessage(&msg);DispatchMessage(&msg);}return msg.wParam;}LRESULT __stdcall WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){return DefWindowProc(hwnd,msg,wparam,lparam);}


0 0