Solved

Detect right click in toolbar docking area

Posted on 2007-03-29
6
303 Views
Last Modified: 2010-04-01
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!
0
Comment
Question by:bigsteve87
  • 2
  • 2
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 18817336
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.
0
 

Author Comment

by:bigsteve87
ID: 18817703
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.
0
 
LVL 86

Expert Comment

by:jkr
ID: 18817739
Have you added these to your toolbar, since the docking area belongs to that one?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 18817794
>>>> 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
0
 

Author Comment

by:bigsteve87
ID: 18819065
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!
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 18821932
>>>>It may not be the most efficient way,
PreTranslateMessage was called directly before translating the message. So indeed it is very efficient.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now