We help IT Professionals succeed at work.

Custom toolbar.

police1
police1 asked
on
I have made a custom toolbar, and want to know how to dock it from within the code.  I don't know how. Please give me the line of code to do this.  I have a right click menu on the toolbar, and I want to click it.. to make it dock back with the window it came from.  I know how to do this from the window.. it is  "DockControlBar"  but how do I do this from within the Toolbar code? I hope I've made myself clear. :)

Thanks in advance.
Comment
Watch Question

Commented:
Hi!
you can use CFrameWnd method:
void CFrameWnd::DockControlBar(CControlBar* pBar, UINT nDockBarID, LPCRECT lpRect);
that is:
CFrameWnd* pWnd = (CFrameWnd*)AfxGetMainWnd();
if (pWnd && pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))
pWnd->DockControlBar(this, NULL, NULL);

Author

Commented:
It said:

"ambiguous call to overloaded function"

for

pWnd->DockControlBar(this, NULL, NULL);

What do I do?  heh

Author

Commented:
Oh wait... I just took out the two NULL statements and kept it as  pWnd->DockControlBar(this);    and it worked great.  Thanks!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.