Solved

MenuItemFromPoint()and GetMenuItemRect()

Posted on 1997-07-28
5
1,058 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
[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
  • 3
  • 2
5 Comments
 

Author Comment

by:yarden
ID: 1402170
Edited text of question
0
 
LVL 3

Accepted Solution

by:
jaba earned 150 total points
ID: 1402171
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
ID: 1402172
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
ID: 1402173
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
ID: 1402174
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…

751 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