BEGIN_MESSAGE_MAP(Window, CWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
int Window::OnCreate (LPCREATESTRUCT lpcs)
{
// Create toolbar at the top of the generic window
ToolBar.Create(this)
ToolBar.LoadToolBar(IDR_MAINFRAME))
}
Thanks for any help
David Mc Kenna
>BEGIN_MESSAGE_MAP(Window, CWnd)
> ON_WM_CREATE()
>END_MESSAGE_MAP()
>Thanks for any help
>David Mc Kenna
This solution is in the 'Visual C++ 4 How-To by
Scott Stanfield and Ralph Arvesen published
by the Waite Group. It's been very useful to me.
Karen Fura
: BEGIN_MESSAGE_MAP(Window, CWnd)
: ON_WM_CREATE()
: END_MESSAGE_MAP()
: int Window::OnCreate (LPCREATESTRUCT lpcs)
: {
: // Create toolbar at the top of the generic window
: ToolBar.Create(this)
: ToolBar.LoadToolBar(IDR_MAINFRAME))
: }
: Thanks for any help
: David Mc Kenna
I'm assuming here that the CWnd is your top-level window. Derive a
class from CToolbar, add a handler for WM_IDLEUPDATECMDUI as below. If
your CWnd is not the main window of your application, you will also need
to modify its parent frame window to pass the WM_IDLEUPDATECMDUI message
on to the CWnd's toolbar using SendMessageToDecendants().
LRESULT CYourToolBar::OnIdleUpdateCmdUI(WPARAM wParam,
LPARAM lParam)
{
if (IsWindowVisible())
{
CFrameWnd* pParent = (CFrameWnd*)GetParent();
if (pParent)
OnUpdateCmdUI(pParent, (BOOL)wParam);
}
return 0L;
}
That's about it...
--
/ ___| / ___| __ _ _ __ ___ ___| | I do not speak for
\___ \ | | _ / _` | '_ \ / _ \/ __| '_ \ Tata Unisys or
___) | | |_| | (_| | | | | __/\__ \ | | |Nationwide Ins.
|____(_) \____|\__,_|_| |_|\___||___/_| |_|------------------