惧留孙网
juliusun.com
网站首页
在线教程
下载专区
用户文章
反馈建议
在线聊天
我的帐户
返回到教程
CPP文件下载:
14ansi.zip
//http://www.juliusun.com/class/ #include
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { CHAR strTitle[] = "惧留孙课堂"; CHAR strWndClass[] = "testclass"; WNDCLASSEX w; w.cbClsExtra = 0; w.cbWndExtra = 0; w.cbSize = sizeof WNDCLASSEX; w.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); w.hCursor = LoadCursor(NULL, IDC_ARROW); w.hIcon = LoadIcon(NULL, IDI_APPLICATION); w.hIconSm = w.hIcon; w.hInstance = hInstance; w.lpfnWndProc = WndProc; w.lpszClassName = strWndClass; w.lpszMenuName = NULL; w.style = CS_DBLCLKS; if (0 == RegisterClassEx(&w)) { return 1; } HWND hWnd = CreateWindowEx(0, strWndClass, strTitle, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 200, 100, 900, 500, NULL, NULL, hInstance, NULL); if (NULL == hWnd) { return 1; } ShowWindow(hWnd, SW_NORMAL); UpdateWindow(hWnd); MSG Msg; while (GetMessage(&Msg, NULL, 0, 0)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return 0; } LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: #define IDS_CONTENT 103 CreateWindowEx(0, "static", "这是我要展示的信息", WS_CHILD | WS_VISIBLE, 10, 10, 200, 30, hWnd, (HMENU)IDS_CONTENT, ((LPCREATESTRUCT)lParam)->hInstance, NULL); break; case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return 0; }
返回到教程
©2015-2024 惧留孙网 juliusun.com
京ICP备15039193号-1
首页
教程
下载
文章
聊天
我的