Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MenuItemFromPoint()and GetMenuItemRect()

Posted on 1997-07-28
5
Medium Priority
?
1,107 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
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Screencast - Getting to Know the Pipeline

782 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