Link to home
Start Free TrialLog in
Avatar of bigsteve87
bigsteve87

asked on

Detect right click in toolbar docking area

I'm not sure if I'm using the correct terminology for this.  What I'm trying to do is give a dropdown menu of avalable toolbars when the user right clicks on a blank space in the toolbar docking area.  Just like in Word or IE or nearly any microsoft app. I guess it's hard to search for since I'm not sure what this area is called.

I can take care of the rest of the details, I just can't figure out how to catch the message from clicking in this area.

I want to do this using VS2005 for a Windows MDI application.

Thanks!
Avatar of jkr
jkr
Flag of Germany image

I'd launch Spy++ (ships with VS2005) to find out what messages are being sent to the toolbar when the user right clicks on a blank space in the toolbar docking area, that should help to get started.
Avatar of bigsteve87
bigsteve87

ASKER

It gets the WM_RBUTTONUP message.  I'm not sure how to catch it.

CMainFrame is my CMDIFrameWnd class
I added :
to Mainframe.h
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);

to Mainframe.cpp
ON_WM_RBUTTONDOWN
and
void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point)

but it didn't catch it.
Have you added these to your toolbar, since the docking area belongs to that one?
ASKER CERTIFIED SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, the toolbar class didn't catch the message but CMainFrame::PreTranslateMessage(MSG* pMsg)did.

pMsg variable has a hwnd variable that matches the CToolbar::m_pDockBar->hwnd when area that I am trying to detect is clicked.  It may not be the most efficient way, but it works for me.  Thanks!
>>>>It may not be the most efficient way,
PreTranslateMessage was called directly before translating the message. So indeed it is very efficient.