Code: Select all
#NoEnv
HandlerFunc := Func("MenuHandler").Bind("Bingo!")
Menu, MyMenu, Add, FirstItem, % HandlerFunc
Menu, MyMenu, Insert, FirstItem, SecondItem, % HandlerFunc
Menu, MyMenu, Show
ExitApp
MenuHandler(Param) {
MsgBox, 0, MenuHandler, %A_ThisMenuItem% with Param = %Param%
}
Code: Select all
---------------------------
C4079502.ahk
---------------------------
Error: Target label does not exist.
Specifically: SecondItem
Line#
003: HandlerFunc := Func("MenuHandler").Bind("Bingo!")
004: Menu,MyMenu,Add,FirstItem,HandlerFunc
---> 005: Menu,MyMenu,Insert,FirstItem,SecondItem,HandlerFunc
006: Menu,MyMenu,Show
007: ExitApp
009: {
010: MsgBox,0,MenuHandler,%A_ThisMenuItem% with Param = %Param%
011: }
012: Exit
013: Exit
The current thread will exit.
---------------------------
OK
---------------------------