?
Solved

Unique IDs for menu items and dialog controls

Posted on 1998-11-25
3
Medium Priority
?
238 Views
Last Modified: 2008-03-17
I am desperate for answers to these questions. I am writing an application that will return a numeric unique ID that belongs to a control. I know can get the controls numeric ID with the function GetDlgControlID. If it is a menu, I know I can get an ID with the function GetMenuItemID. The problems I have are as follows:

Problem 1: GetMenuItemID works fine if I specify the position of the menu item in the menu or submenu. However, if I want to receive a unique identifier for a top-level menu or a submenu, GetMenuItemID does not work. GetMenu and GetSubmenu only returns handles, while what I need is a unique identifier. Anyone knows how to do get the unique identifier of a top-level menu or a submenu (not just the handle)?

Problem 2: GetDlgControlID works fine except for when I need to get the unique identifier of a label. Then the function returns nothing or zero. Also, if a control is in a group frame, the function seems to return the identifier of the frame control and not for the individual controls within the frame. Anyone knows how to return values for labels or for controls within a group frame?

(The reason I need the unique ID is to eventually search a given header file *.h to find the ID_SOMESTRING defined for a particular numeric number.)


I would greatly appreciate fast replies, as I need it for student work.

Thanks,
Lene Jacobsen
0
Comment
Question by:ljac
[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
3 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1446845
The label can most likely not be solved. The label is fake control and has no window handle. It paints directly on the parent. Since it is no child window, it has no child dialog ID. You can use a tool like Spy32 (shipped with MsDev Studio) to see that it has no window handle and therefor no ID. I'm sorry
I don't understand why getMenuItemId does not work. I'll see if I can look into that.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 190 total points
ID: 1446846
The label can most likely not be solved. The label is fake control and has no window handle. It paints directly on the parent. Since it is no child window, it has no child dialog ID. You can use a tool like Spy32 (shipped with MsDev Studio) to see that it has no window handle and therefor no ID. I'm sorry
I don't understand why getMenuItemId does not work. I'll see if I can look into that.
0
 

Author Comment

by:ljac
ID: 1446847
"Problem 1" and second part of "Problem 2" was not solved
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

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