Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get the ID of the menu item under the mouse cursor
#1
The custom menu is displayed next to the system shell menu.

When the F11 hotkey is pressed or the right mouse button is pressed,
I need to obtain the ID of the menu item under the mouse cursor so that I can output the text of the menu item.

Function Menu_Edit
Trigger !v"" "#32768" /QM     Help - how to add the trigger to the macro
Code:
Copy      Help
out
int h=TriggerWindow

;if(MenuGetString(hwnd 1 &_s)) out _s ;;Why is there no output?

rep
,0.1
,ifk(F11)
,,int mh=win(mouse); out mh
,,int iid=1 ;;How to get the ID of the menu item under the mouse cursor?
,,Acc a.Find(h "MENUITEM" "" "" 0x1001 3 iid)
,,out a.Name
,,key Z           ;; Esc
,,break

Macro Macro51
Trigger !v"" "#32768" /EXPLORER     Help - how to add the trigger to the macro
Code:
Copy      Help
int hwnd=TriggerWindow

ARRAY(int) a; win("" "#32768" "explorer" 0 0 0 a); if(a.len>1) ret

SetTimer(0 0 100 &sub._Timer)
;
_s=
;1 open docx
;2 open other
_i=ShowMenu(_s 0 0 0 8)
out _i


#sub _Timer v
function u1 u2 timer u3
if !IsWindowVisible(a[0]) && !(RealGetKeyState(1) or RealGetKeyState(2))
,KillTimer 0 timer
,EndMenu


Messages In This Thread
get the ID of the menu item under the mouse cursor - by Davider - 08-21-2026, 03:52 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)