?
Solved

Detect right click in toolbar docking area

Posted on 2007-03-29
6
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

762 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