阅读:1686回复:1
请教:我在主窗口上调用两次子窗口,为什么子窗口按扭只有一个?
主窗体中调用
UpdateMyButtons2(p,0,20,30,30,30); UpdateMyButtons2(p,0,20,70,30,30); 下面为子窗口的定义和过程函数.麻烦帮看看... CALLBACK MyButtonsProc2(HWND WndMyButtons2, UINT Msg, WPARAM wParam, LPARAM lParam) { intface* p = (intface*) WinGetObject(WndMyButtons2); if (p) { PAINTSTRUCT Paint; HDC hdc ; switch (Msg) { case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: SetForegroundWindow(p->Win.Wnd); SendMessage(p->Win.Wnd,WM_COMMAND,IF_FILE_OPENFILE,0); return 0; case WM_PAINT: SetForegroundWindow(p->Win.Wnd); hdc = BeginPaint (p->WndMyButtons2, &Paint) ; SetBkMode (hdc, TRANSPARENT) ; EndPaint (p->WndMyButtons2, &Paint) ; return 0 ; } } return DefWindowProc(p->WndMyButtons2,Msg,wParam,lParam); } static int UpdateMyButtons2(intface* p,bool_t DoResize,int i,int j,int iWidth,int iHight) { if ( !p->WndMyButtons2 && p->Win.Wnd) { WNDCLASS WinClass; memset(&WinClass,0,sizeof(WinClass)); WinClass.style = CS_HREDRAW | CS_VREDRAW; WinClass.lpfnWndProc = (WNDPROC) MyButtonsProc2; WinClass.cbClsExtra = 0; WinClass.cbWndExtra = 0; WinClass.hInstance = p->Win.Module; WinClass.hCursor = WinCursorArrow(); WinClass.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); WinClass.lpszMenuName = 0; WinClass.lpszClassName = T("MyButtonBar"); RegisterClass(&WinClass); p->WndMyButtons2 = CreateWindowEx( 0, WinClass.lpszClassName, T("MyButton"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, i,j,iWidth,iHight, p->Win.Wnd, NULL,//(HMENU) , p->Win.Module, NULL ); WinSetObject(p->WndMyButtons2,&p->Win); p->ClientRect.right = -1; if (DoResize) Resize(p); } if (!p->MyButtonBar2 && p->WndMyButtons2) { DestroyWindow(p->WndMyButtons2); p->WndMyButtons2 = NULL; p->ClientRect.right = -1; if (DoResize) Resize(p); } return ERR_NONE; } |
|
沙发#
发布于:2007-07-16 11:46
不是吧?难道是我没说清楚,这个问题 应该不是没有人不知道吧....
|
|