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.

Who is Participating?
itsmeandnobodyelseConnect With a Mentor Commented:
>>>> but it didn't catch it.
If it is a mdi you may get the message in your CYourChildFrame class.

You also could try to override CMainFrm::PreTranslateMessage and catch the  WM_RBUTTONDOWN there.

Regards, Alex
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.
bigsteve87Author Commented:
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
void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point)

but it didn't catch it.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Have you added these to your toolbar, since the docking area belongs to that one?
bigsteve87Author Commented:
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.
All Courses

From novice to tech pro — start learning today.