-
December 4th, 2019, 06:39 AM
#1
UINT_PTR numbers among a program's identifiers..
Hello,
I have a simple question regarding the UINT_PTR passed as parameter to a InsertMenu function as in
Code:
HMENU hM1;
hM1 = GetMenu(hWnd);
HMENU hM2;
hM2 = CreateMenu();
InsertMenu(hM1, 0, MF_POPUP | MF_BYPOSITION, UINT_PTR(hM2), TEXT("Item 1"));
hM2 = CreateMenu();
InsertMenu(hM1, 1, MF_POPUP | MF_BYPOSITION, UINT_PTR(hM2), TEXT("Item 2"));
The question is if there is any guarantee that the UINT_PTR(hM2) will be unique among the menu's all identifiers, and also among programs's all identifiers..Suppose that the program also has a button identifier
#define ID_BUTTON1 15
Is there any guarantee that some UINT_PTR(hM2) will not be 15 ?
Best,
D Narcis
Last edited by 2kaud; December 4th, 2019 at 09:27 AM.
Reason: Added code tags
-
December 4th, 2019, 01:15 PM
#2
Re: UINT_PTR numbers among a program's identifiers..
A menu handle (e.g. hM1) is different from a menu ID constant, but there is no guarantee that the values could be the same.
-
December 9th, 2019, 08:00 AM
#3
Re: UINT_PTR numbers among a program's identifiers..
Ok, so it should be avoided even for popup menu items, because it might interfere with other identifiers when processing the WM_COMMAND message..
-
December 9th, 2019, 12:51 PM
#4
Re: UINT_PTR numbers among a program's identifiers..
Originally Posted by dnarcistrinca
Ok, so it should be avoided even for popup menu items, because it might interfere with other identifiers when processing the WM_COMMAND message..
There is a range of user IDs that you should use. I'm on a phone now so I can't look this up for you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|