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
Solved

Detect right click in toolbar docking area

Posted on 2007-03-29
6
306 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

839 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