patriciaxxx
Programmer
The following code creates a popup menu with 7 options 1x, 1.5x etc.
How do I create the following behavior… set one option, say 2x, to a variable as checked when the menu is first created and then when you click on another it becomes the only checked one and passes a value to the variable, and so on.
And how do you create an entry with a bitmap and text together on the same item. The following code creates a bitmap item and a text item but they are two separate menu items I want the item as one with bitmap and text together, how is this done?
Any help would be much appreciated as menu creation using API is new and confusing to me and all the examples I have seen are either very simple and don’t cover these points or in any code but VBA.
How do I create the following behavior… set one option, say 2x, to a variable as checked when the menu is first created and then when you click on another it becomes the only checked one and passes a value to the variable, and so on.
Code:
Dim hMenu As Long
Dim hSubMenuMagnification As Long
hSubMenuMagnification = CreatePopupMenu
AppendMenu hSubMenuMagnification, 0, 121, "1x"
AppendMenu hSubMenuMagnification, 0, 122, "1.5x"
AppendMenu hSubMenuMagnification, 0, 123, "2x"
AppendMenu hSubMenuMagnification, 0, 124, "3x"
AppendMenu hSubMenuMagnification, 0, 125, "4x"
AppendMenu hSubMenuMagnification, 0, 126, "8x"
AppendMenu hSubMenuMagnification, 0, 127, "16x"
hMenu = CreatePopupMenu()
AppendMenu hMenu, MF_STRING, lngEXIT_APP, "Show Magnifying Glass…"
AppendMenu hMenu, MF_POPUP, hSubMenuMagnification, "Magnification"
AppendMenu hMenu, MF_SEPARATOR, ByVal 0&, ByVal 0&
AppendMenu hMenu, MF_STRING, lngRESTORE_WINDOW, "Exit"
buildMenu = hMenu
And how do you create an entry with a bitmap and text together on the same item. The following code creates a bitmap item and a text item but they are two separate menu items I want the item as one with bitmap and text together, how is this done?
Code:
AppendMenu hMenu, MF_STRING, lngEXIT_APP, "Show Magnifying Glass…"
AppendMenu hMenu, MF_BItMAP, 102, CLng(Forms!frmSystray.ImageList.ListImages(2).Picture)
Any help would be much appreciated as menu creation using API is new and confusing to me and all the examples I have seen are either very simple and don’t cover these points or in any code but VBA.