{"id":265,"date":"2009-07-12T23:26:10","date_gmt":"2009-07-12T17:56:10","guid":{"rendered":"http:\/\/techtwaddle.net\/?p=265"},"modified":"2011-04-12T23:26:27","modified_gmt":"2011-04-12T17:56:27","slug":"fun-with-menus","status":"publish","type":"post","link":"https:\/\/techtwaddle.co.in\/blog\/2009\/07\/12\/fun-with-menus\/","title":{"rendered":"Fun with menus!"},"content":{"rendered":"<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">I received a comment on one of my previous <\/span><a href=\"http:\/\/geekswithblogs.net\/TechTwaddle\/archive\/2009\/04\/16\/applications-creating-a-simple-ui-application-for-windows-mobile-6-again.aspx\" style=\"font-family: Comic Sans MS;\">posts<\/a><span style=\"font-family: Comic Sans MS;\">, correcting me on what I had mentioned. The menu bar resource was defined as below:<\/span><\/div>\n<p><font size=\"2\"><br style=\"font-family: Comic Sans MS;\" \/><br \/>\n<\/font><font size=\"2\" style=\"font-family: Verdana;\"><span style=\"color: rgb(0, 0, 128);\">IDR_MENU SHMENUBAR DISCARDABLE<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">BEGIN<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; IDR_MENU, <\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; 2,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; IDS_OK, 0, NOMENU,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; <\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; IDS_HELP, 0, 0,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">END<\/span><\/font><\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">And I had said, <\/span><span style=\"font-style: italic; font-family: Comic Sans MS;\">&quot;<\/span><font size=\"2\" style=\"font-style: italic; color: rgb(0, 128, 128); font-family: Comic Sans MS;\">Everything in between BEGIN and END defines the menu bar. The first line under BEGIN<\/font><span style=\"font-style: italic; font-family: Comic Sans MS;\"><span style=\"color: rgb(0, 128, 128);\"> should be the same as the menu bar identifier, IDR_MENU<\/span>&quot;<\/span><span style=\"font-family: Comic Sans MS;\">. Well, I was wrong there. The first line under <\/span><span style=\"font-family: Comic Sans MS; color: rgb(0, 0, 128);\"><span style=\"font-family: Verdana;\">BEGIN<\/span> <\/span><span style=\"font-family: Comic Sans MS;\">could be same as the menu bar identifier but it need not be. Thanks <\/span><a href=\"http:\/\/geekswithblogs.net\/TechTwaddle\/archive\/2009\/04\/16\/applications-creating-a-simple-ui-application-for-windows-mobile-6-again.aspx#479179\" style=\"font-family: Comic Sans MS;\">Binary<\/a><span style=\"font-family: Comic Sans MS;\"> for noticing that! The first line under <\/span><span style=\"font-family: Comic Sans MS; color: rgb(0, 0, 128);\"><span style=\"font-family: Verdana;\">BEGIN<\/span> <\/span><span style=\"font-family: Comic Sans MS;\">is the identifier of the popup menu that appears when the user clicks on one of the popup menus.&nbsp; If both the softkeys in your menu bar are buttons then the popup menu identifier could be specified as zero. So the correct way of doing it would be to define the menu bar as:<\/span><\/div>\n<p>\n<font size=\"2\" style=\"font-family: Verdana;\"><span style=\"color: rgb(0, 0, 128);\">IDR_MENU SHMENUBAR DISCARDABLE<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">BEGIN<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; IDR_MENU_POPUP, <\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; 2,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; IDS_OK, 0, NOMENU,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; <\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; IDS_HELP, 0, 0,<\/span><br style=\"color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"color: rgb(0, 0, 128);\">END<\/span><\/font><\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">and <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU_POPUP<\/span><span style=\"font-family: Comic Sans MS;\"> is defined as a popup menu,<\/span><\/div>\n<p>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU_POPUP MENU <\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MENUITEM &quot;System Metric&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IDM_SYSTEM_METRIC<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MENUITEM &quot;About&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IDM_HELP_ABOUT<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">END<\/span><\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">In the above menu bar, the left softkey is an &quot;OK&quot; button and right softkey is a popup menu with &quot;System Metric&quot; and &quot;About&quot; as its menu items. Just remember that <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU<\/span><span style=\"font-family: Comic Sans MS;\"> is the identifier of the softkey bar which is created and <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU_POPUP<\/span><span style=\"font-family: Comic Sans MS;\"> is the identifier of the popup menu, which appears when the user clicks on the right softkey &quot;Menu&quot;<\/span><\/div>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">Binary also raised another interesting point. How do we get popup menus on both right softkey and left softkey? Of course, the first thing I did was to remove the <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">NOMENU<\/span><span style=\"font-family: Comic Sans MS;\"> option from the part defining the left softkey. You can see the problem there can&#8217;t you? Both left softkey and right softkey become popup menus, but both the popup menus show the same menu items because we specified a single popup menu identifier, <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU_POPUP<\/span><span style=\"font-family: Comic Sans MS;\">, and that is why the same popup menu shows up for both the softkeys.<\/span><\/div>\n<p><img decoding=\"async\" src=\"\/images\/geekswithblogs_net\/TechTwaddle\/FunWithMenus\/Menus both popup2.JPG\" alt=\"\" \/>\n<\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">I was looking into how to get different popup menus for the 2 softkeys when Mr (or Ms) Binary replied again. Binary had figured out how.<\/span><\/div>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">You define the popup menu as usual but with two popup entries,<\/span><\/div>\n<p>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU_POPUP MENU <\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;Menu L&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;MENUITEM &quot;Menu Item1&quot;,&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;MENUITEM &quot;Menu Item2&quot;,&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;Menu R&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MENUITEM &quot;System Metric&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IDM_SYSTEM_METRIC<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MENUITEM &quot;About&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; IDM_HELP_ABOUT<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">END<\/span><br \/>\n&nbsp;<\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">and while creating the menubar in <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">WM_CREATE<\/span><span style=\"font-family: Comic Sans MS;\"> message, specify the following options,<\/span><\/div>\n<p>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case WM_CREATE:<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SHMENUBARINFO mbi;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset(&amp;mbi, 0, sizeof(SHMENUBARINFO));<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mbi.cbSize&nbsp;&nbsp;&nbsp;&nbsp; = sizeof(SHMENUBARINFO);<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mbi.hwndParent = hWnd;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color: rgb(0, 0, 255);\">mbi.nToolBarId = IDR_MENU_POPUP;<\/span><\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mbi.hInstRes&nbsp;&nbsp; = g_hInst;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style=\"color: rgb(0, 0, 255);\">mbi.dwFlags = SHCMBF_HMENU;<\/span><\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!SHCreateMenuBar(&amp;mbi)) <\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_hWndMenuBar = NULL;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_hWndMenuBar = mbi.hwndMB;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">The only difference is we specify the popup menu identifier for <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">nToolBarId<\/span><span style=\"font-family: Comic Sans MS;\"> member instead of the menu bar identifier and we also set the <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">SHCMBF_HMENU<\/span><span style=\"font-family: Comic Sans MS;\"> flag. When <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">SHCMBF_HMENU<\/span><span style=\"font-family: Comic Sans MS;\"> flag is not specified then the <\/span><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">nToolBarId<\/span><span style=\"font-family: Comic Sans MS;\"> value is treated as a toolbar identifer which creates our usual softkey bar with left and right softkeys. If the flag is set then <span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">nToolBarId<\/span> is treated as a menu identifier. Just a regular menu bar with menus and submenus. So now when you run the application you get,<\/span><\/div>\n<p><img decoding=\"async\" src=\"\/images\/geekswithblogs_net\/TechTwaddle\/FunWithMenus\/Menu both popup diff.JPG\" alt=\"\" \/><\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">Be sure to specify the message value if you want to handle these menu clicks. I have specified zero above because I am not really interested in handling these items.<\/span><\/div>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">So now a question pops up (pun intended), what if I have several popup menus and submenus in the popup identifier. Will it take only the first two and display them or will it do something strange? See for yourself, I used the following popup menu just for the sake of it,<\/span><\/div>\n<p>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">IDR_MENU_POPUP MENU <\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;File&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;&amp;Open&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;&amp;Save&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;E&amp;xit&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;Edit&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;&amp;Copy&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;C&amp;ut&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;&amp;Paste&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;View&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;&amp;Full Screen&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;&amp;Options&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; POPUP &quot;Help&quot;<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; BEGIN<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;Abou&amp;t&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MENUITEM &quot;He&amp;lp&quot;,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">&nbsp;&nbsp;&nbsp; END<\/span><br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<br style=\"font-family: Verdana; color: rgb(0, 0, 128);\" \/><br \/>\n<span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">END<\/span><\/p>\n<p><br style=\"font-family: Comic Sans MS;\" \/><br \/>\n<span style=\"font-family: Comic Sans MS;\">here&#8217;s what is does,<\/span><br style=\"font-family: Comic Sans MS;\" \/><\/p>\n<p><img decoding=\"async\" src=\"\/images\/geekswithblogs_net\/TechTwaddle\/Diff popups1.JPG\" alt=\"\" \/><\/p>\n<p><span style=\"font-family: Comic Sans MS;\">and,<\/span><\/p>\n<p>\n<img decoding=\"async\" src=\"\/images\/geekswithblogs_net\/TechTwaddle\/Diff popups2.JPG\" alt=\"\" \/>\n<\/p>\n<div style=\"text-align: justify;\"><span style=\"font-family: Comic Sans MS;\">I have never seen that on a ppc! I was surprised that it actually works and creates a full fledged menu bar with several menus. And notice the SIP button has moved to the right. The color of the menu bar has changed as well. A pretty interesting find, I would say.<\/span><\/div>\n<p>\nUpdate:<br \/>\nYou might also be interested in this post, <a href=\"http:\/\/geekswithblogs.net\/TechTwaddle\/archive\/2010\/01\/28\/fun-with-menus-part-ii-radio-menu-items-and-checkmenuradioitem.aspx\">Fun&nbsp;with menus &#8211; part II<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I received a comment on one of my previous posts, correcting me on what I had mentioned. The menu bar resource was defined as below: IDR_MENU SHMENUBAR DISCARDABLE BEGIN &nbsp;&nbsp;&nbsp; IDR_MENU, &nbsp;&nbsp;&nbsp; 2, &nbsp;&nbsp;&nbsp; I_IMAGENONE, IDM_OK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, &nbsp;&nbsp;&nbsp; IDS_OK, 0, NOMENU, &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; I_IMAGENONE, IDM_HELP, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, &nbsp;&nbsp;&nbsp; IDS_HELP, 0, &hellip; <a href=\"https:\/\/techtwaddle.co.in\/blog\/2009\/07\/12\/fun-with-menus\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Fun with menus!<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1ktFF-4h","_links":{"self":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/265"}],"collection":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/comments?post=265"}],"version-history":[{"count":1,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/265\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}