| 查看: 7803 | 回复: 145 | |||
| 本帖产生 1 个 程序强帖 ,点击这里进行查看 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
[交流]
【交流】VC++, C#, VB答疑专贴 已有69人参与
|
|||
[ Last edited by 波不动 on 2010-1-8 at 19:44 ] |
» 本帖已获得的红花(最新10朵)
» 猜你喜欢
2025年遐想
已经有5人回复
论文终于录用啦!满足毕业条件了
已经有12人回复
投稿Elsevier的杂志(返修),总是在选择OA和subscription界面被踢皮球
已经有8人回复
求个博导看看
已经有18人回复
» 本主题相关价值贴推荐,对您同样有帮助:
想辞工作一心考研,有人了解MPACC这个专业硕士吗?
已经有9人回复
我是环境工程专业的,方向是地下水属水文地质的,大伙给推荐下学校与老师吧
已经有16人回复
【交流】中科院考博晒分兼交流专用贴
已经有18人回复
【信息】学环境专业可以考哪些方面研究生(最好不考数学)
已经有9人回复
【求助】请问考清华光学工程专业那个导师较好
已经有9人回复
【求助/交流】菌种的专利申请
已经有8人回复
【分享】sigmaplot, Endnote, Excel,R答疑专贴和顾问(新开2号贴)
已经有158人回复

biowhb
银虫 (正式写手)
- 应助: 5 (幼儿园)
- 金币: 620.7
- 散金: 24
- 帖子: 396
- 在线: 103.4小时
- 虫号: 2353280
- 注册: 2013-03-17
- 性别: GG
- 专业: 微生物遗传育种学
★
小木虫: 金币+0.5, 给个红包,谢谢回帖
小木虫: 金币+0.5, 给个红包,谢谢回帖
|
初学windows编程:想把一个主窗体的客户区分割成三个部分,下面是代码,运行起来却仍是空白的没什么变化,这是为何?求大神指点 #include <windows.h> #define ID_FIRSTCHILD 100 #define ID_SECONDCHILD 101 #define ID_THIRDCHILD 102 // Global variable HINSTANCE hinst; // Function prototypes. int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int); InitApplication(HINSTANCE); InitInstance(HINSTANCE, int); LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK EnumChildProc(HWND , LPARAM ) ; // Application entry point. int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; if (!InitApplication(hinstance)) return FALSE; if (!InitInstance(hinstance, nCmdShow)) return FALSE; while (GetMessage(&msg, (HWND) NULL, 0, 0) != 0 && GetMessage(&msg, (HWND) NULL, 0, 0) != -1) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; UNREFERENCED_PARAMETER(lpCmdLine); } BOOL InitApplication(HINSTANCE hinstance) { WNDCLASSEX wcx; // Fill in the window class structure with parameters // that describe the main window. wcx.cbSize = sizeof(wcx); // size of structure wcx.style = CS_HREDRAW | CS_VREDRAW; // redraw if size changes wcx.lpfnWndProc = MainWndProc; // points to window procedure wcx.cbClsExtra = 0; // no extra class memory wcx.cbWndExtra = 0; // no extra window memory wcx.hInstance = hinstance; // handle to instance wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION); // predefined app. icon wcx.hCursor = LoadCursor(NULL, IDC_ARROW); // predefined arrow wcx.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH); // white background brush wcx.lpszMenuName = "MainMenu"; // name of menu resource wcx.lpszClassName = "MainWClass"; // name of window class wcx.hIconSm = NULL; // Register the window class. return RegisterClassEx(&wcx); } BOOL InitInstance(HINSTANCE hinstance, int nCmdShow) { HWND hwnd; // Save the application-instance handle. hinst = hinstance; // Create the main window. hwnd = CreateWindow( "MainWClass", // name of window class "Sample", // title-bar string WS_OVERLAPPEDWINDOW, // top-level window CW_USEDEFAULT, // default horizontal position CW_USEDEFAULT, // default vertical position CW_USEDEFAULT, // default width CW_USEDEFAULT, // default height (HWND) NULL, // no owner window (HMENU) NULL, // use class menu hinstance, // handle to application instance (LPVOID) NULL); // no window-creation data if (!hwnd) return FALSE; // Show the window and send a WM_PAINT message to the window // procedure. ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); return TRUE; } LONG APIENTRY MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { RECT rcClient; int i; switch(uMsg) { case WM_CREATE: // creating main window // Create three invisible child windows. for (i = 0; i < 3; i++) { CreateWindowEx( 0, "ChildWClass", (LPCTSTR) NULL, WS_CHILD | WS_BORDER, 0,0,0,0, hwnd, (HMENU) (int) (ID_FIRSTCHILD + i), hinst, NULL); } return 0; case WM_SIZE: // main window changed size // Get the dimensions of the main window's client // area, and enumerate the child windows. Pass the // dimensions to the child windows during enumeration. GetClientRect(hwnd, &rcClient); EnumChildWindows(hwnd, EnumChildProc, (LPARAM) &rcClient); return 0; // Process other messages. } return DefWindowProc(hwnd, uMsg, wParam, lParam); } BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam) { LPRECT rcParent; int i, idChild; // Retrieve the child-window identifier. Use it to set the // position of the child window. idChild = GetWindowLong(hwndChild, GWL_ID); if (idChild == ID_FIRSTCHILD) i = 0; else if (idChild == ID_SECONDCHILD) i = 1; else i = 2; // Size and position the child window. rcParent = (LPRECT) lParam; MoveWindow(hwndChild, (rcParent->right / 3) * i, 0, rcParent->right / 3, rcParent->bottom, TRUE); // Make sure the child window is visible. ShowWindow(hwndChild, SW_SHOW); return TRUE; } |

133楼2014-02-13 15:26:09







回复此楼
飞虎