|
-
Jun 28th, 2001, 10:33 PM
#1
Thread Starter
Hyperactive Member
OD Menus
If I cannot set an ID for a top menu, how am I supposed to be able to manipulate the way it is created just like the other sub-menus?
Let's say in this code
Code:
switch(di->itemID)
{
case ID_COLOR1:
SetTextColor(di->hDC,color);
break;
case ID_COLOR2:
SetTextColor(di->hDC,color);
break;
case ID_COLOR3:
SetTextColor(di->hDC,color);
break;
case hMenu:
color = RGB(00,00,255);
SetTextColor(di->hDC,color);
break;
}
How would I be able to add a case hMenu, without getting an error? I even saw VB programs change the text xcolor of their top-menus. What should I do. I tried a whole bunch of stuff(such as typecasting), but with no result Thanks for helping
Amon Ra
Amon Ra
The Power of Learning.
-
Jun 29th, 2001, 05:07 AM
#2
Monday Morning Lunatic
Try using the ID of the menu itself (defined when you made the resource file).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 29th, 2001, 10:25 AM
#3
Thread Starter
Hyperactive Member
Well...
I prefered to use the API to create my menus. here is the code
Code:
hMenu = CreateMenu();
hPopupMenu1 = CreatePopupMenu();
AppendMenu(hPopupMenu1, MF_STRING | MF_OWNERDRAW ,ID_FIRST, "");
AppendMenu(hPopupMenu1, MF_STRING | MF_OWNERDRAW,ID_SECOND, "");
AppendMenu(hPopupMenu1, MF_STRING | MF_OWNERDRAW,ID_COLOR1, "");
AppendMenu(hPopupMenu1, MF_STRING | MF_OWNERDRAW,ID_COLOR2, "");
AppendMenu(hPopupMenu1, MF_STRING | MF_OWNERDRAW,ID_COLOR3, "");
AppendMenu(hMenu,MF_POPUP ,(unsigned int)hPopupMenu1,"Voila");
SetMenu(hwnd, hMenu);
DrawMenuBar(hwnd);
UpdateWindow(hwnd);
You see for the last one, there is no ID_****. I tried to change the last line like this:
Code:
AppendMenu(hMenu,MF_POPUP | MF_OWNERDRAW ,(unsigned int)hPopupMenu1,"Voila");
Now, I could actually control the top level menu just like the other ones by putting an if() in my message handling. The problem is that now, the change applied to all the sub-menus as well.
Amon Ra
Amon Ra
The Power of Learning.
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
|