Solved

MenuItemFromPoint()and GetMenuItemRect()

Posted on 1997-07-28
5
1,018 Views
Last Modified: 2013-12-03
Hi,
Actually, I'd like to know whether a mouse click was inside a menu (or a menu item). I thought that WM_LBBUTTONDOWN will give me the mouse click coordinates, and that MenuItemFromRect() will give the menu item selected.

However, this does not work (at least not always). I've tried to find an example of using MenuItemFromPoint() or GetMenuItemRect(), but I couldn't find any.

Do you have any idea?

Thanks,
Yarden Admon
(working with Windows NT 4.0, Visual C++ 5.0)
0
Comment
Question by:yarden
  • 3
  • 2
5 Comments
 

Author Comment

by:yarden
Comment Utility
Edited text of question
0
 
LVL 3

Accepted Solution

by:
jaba earned 150 total points
Comment Utility
You cant dispatch WM_LBUTTONDOW while menu activated.  Becouse menu is WINDOW , sysmodal window. It have  mouse and keyboard capture. All messages translating to menu`s window and dispatching by it. What why you cant work with mouse /keyboard messages when menu opened :-( Try to use other way to do what you want.
0
 

Author Comment

by:yarden
Comment Utility
I didn't fully understand your answer. Perhaps I should elaborate a little more.

I'm already receiving WM_LBUTTONDOWN from the window. At that point I would like to know whether the mouse click was inside or outside a menu.

However, it seems that the coordinates used by the menu functions  - MenuItemFromPoint() and GetMenuItemRect() - use coordinates which do not correspond to the mouse click coordinates.

If someone has any experience using these functions, please tell me ...


0
 

Author Comment

by:yarden
Comment Utility
I didn't fully understand your answer. Perhaps I should elaborate a little more.

I'm already receiving WM_LBUTTONDOWN from the window. At that point I would like to know whether the mouse click was inside or outside a menu.

However, it seems that the coordinates used by the menu functions  - MenuItemFromPoint() and GetMenuItemRect() - use coordinates which do not correspond to the mouse click coordinates.

If someone has any experience using these functions, please tell me ...


0
 
LVL 3

Expert Comment

by:jaba
Comment Utility
What king of menu you using ?
About cooridinates not corresponding to other. WM_LBUTTONDOWN point coordinates relative to the upper-left corner of the client area of the Window. GetMenuItemRect function return coordinates expressed in screen coordinates.
You should you ClientToScreen And ScreenToClient function to convert coordinates

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

17 Experts available now in Live!

Get 1:1 Help Now