阅读:896回复:1
非主函数下创建的按钮不能显示
在主函数LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 下添加代码:
static HWND hwndButton[NUM] ; static RECT rect ; static TCHAR szTop[] = TEXT ("message wParam lParam"), szUnd[] = TEXT ("_______ ______ ______"), szFormat[] = TEXT ("%-16s%04X-%04X %04X-%04X"), szBuffer[50] ; static int cxChar, cyChar ; // HDC hdc ; // PAINTSTRUCT ps ; int i ; switch (wMsg) { case WM_CREATE: temp_Item = B_Mode_Item_en; cxChar = LOWORD (GetDialogBaseUnits ()) ; cyChar = HIWORD (GetDialogBaseUnits ()) ; for (i = 0 ; i < NUM ; i++) hwndButton = CreateWindow ( CTRL_STATIC, temp_Item[0], WS_CHILD | WS_VISIBLE | button.iStyle, cxChar, cyChar * (1 + 2 * i), 20 * cxChar, 7 * cyChar / 4, hWnd, (HMENU) i, ((LPCREATESTRUCT) lParam)->hInstance, NULL) ; SetWindowLong (hWnd, DWL_USER, (LONG)hwndButton); break; } return TRUE; 能够在客户区显示创建孔件! 但是在其他函数如:BOOL CALLBACK BtnDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) 下创建如上控件却无法显示,是什么原因啊? |
|
沙发#
发布于:2007-08-30 22:26
是不是与对话框的属性有关?
|
|
|