Article ID: 123158
Article Last Modified on 11/21/2006
119591 How to Obtain Microsoft Support Files from Online Services
141751 Adding Control Bars to Dialog Boxes in MFC
CRect rcClientStart;
CRect rcClientNow;
GetClientRect(rcClientStart);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,
AFX_IDW_CONTROLBAR_LAST,
0, reposQuery, rcClientNow);
CPoint ptOffset(rcClientStart.left - rcClientNow.left,
rcClientStart.top - rcClientNow.top);
ptOffset.y += ::GetSystemMetrics(SM_CYMENU);
CRect rcChild;
CWnd* pwndChild = GetWindow(GW_CHILD);
while (pwndChild)
{
pwndChild->GetWindowRect(rcChild);
rcChild.OffsetRect(ptOffset);
pwndChild->MoveWindow(rcChild, FALSE);
pwndChild = pwndChild->GetNextWindow();
}
CRect rcWindow; GetWindowRect(rcWindow); rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height(); MoveWindow(rcWindow, FALSE);
LRESULT CDlgToolBar::OnIdleUpdateCmdUI(WPARAM wParam,
LPARAM lParam)
{
if (IsWindowVisible())
{
CFrameWnd* pParent = (CFrameWnd*)GetParent();
if (pParent)
OnUpdateCmdUI(pParent, (BOOL)wParam);
}
return 0L;
}
To pass WM_IDLEUPDATECMDUI messages on to dialogs other than the main
window, save dialog pointers in your frame window class and create a
WM_IDLEUPDATECMDUI handler in that class. The handler should send the
WM_IDLEUPDATECMDUI message on to the dialog child windows by using
CWnd::SendMessageToDescendants(). Then perform default processing for the
message within the frame window. Additional query words: CDialog CStatusBar CToolBar kbMFCCtrlBars
Keywords: kbdownload kbfaq kbfile kbprogramming kbsample kbtoolbar kbuidesign KB123158