struct mii, cbSize as ulong, fMask as ulong, fType as ulong, _ fState as ulong, wID as ulong, hSubMenu as ulong, _ hbmpChecked as ulong, hbmpUnchecked as ulong, _ dwItemData as long, dwTypeData as ptr, cch as ulong mii.cbSize.struct = len(mii.struct) mii.fMask.struct = _MIIM_ID or _MIIM_SUBMENU menu #w, "Menu 1", "Dummy 1", [menu1] menu #w, "Menu 2", "Dummy 2", [menu2] menu #w, "Menu 3", "Dummy 3", [menu3] menu #w, "Menu 4", "Dummy 4", [menu4] open "Top-level menu demo" for window as #w #w "trapclose [quit]" hw = hwnd(#w) calldll #user32, "GetMenu", hw as ulong, hMenuBar as ulong for m = 0 to 3 calldll #user32, "GetSubMenu", hMenuBar as ulong, _ m as ulong, hSubMenu as ulong calldll #user32, "GetMenuItemID", hSubMenu as ulong, _ 0 as long, menuID as ulong calldll #user32, "RemoveMenu", hSubMenu as ulong,_ menuID as ulong, 0 as long, result as long mii.wID.struct = menuID calldll #user32, "SetMenuItemInfoA", hMenuBar as ulong, _ m as long, 1 as long, mii as struct, result as long next m wait [menu1] print "Menu 1 clicked" wait [menu2] print "Menu 2 clicked" wait [menu3] print "Menu 3 clicked" wait [menu4] print "Menu 4 clicked" wait [quit] close #w end
|