The result of the above script is blank message box.
The standard menu items are all present.
I've squeezed the DllCallDebugger in the Class script and guess what: it started spitting error
-4 one after another. Now, I'm not 100% sure the debugger works correctly because I didn't have time to test it; this was the first time I actually tried to put it at work. But I feel the problem is somewhere in the DllCalls and most likely in Class.ahk.
Code:
Class_Alloc(size)
{
static AlreadyDone, HeapAlloc, ProcessHeap
if (!AlreadyDone)
{
AlreadyDone := true
HeapAlloc := Class_LoadDllFunction("Kernel32", "HeapAlloc")
DllCallDebugger()
ProcessHeap := DllCall("GetProcessHeap")
}
If the script output until the Menu2 error can be of any use for you, here it is:
Code:
Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.
087: Class_setString(MenuItemObject, "b2", MenuItemLabel)
590: Class_setValue(ClassObject, index, data, "String")
597: if (!ClassObject)
598: Return
591: }
088: }
367: VarSetCapacity(mii, 48, 0), NumPut(48, mii), NumPut(4, mii, 4)
369: if (subMenu)
372: Menu_SetMenuItemInfo(hMenu, Position, mii)
1347: if MenuNameOrHandle is integer
1348: hMenu := MenuNameOrHandle
1352: if (!hMenu)
1355: if (!Position := Menu_getIndex(Position, Menu_getMenuItemCount(hMenu)))
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.53)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.01)
089: }
249: if (ThisSize = 0)
251: if (ThisIndex > 0)
253: if (ThisIndex = 0)
254: Return,ThisSize
1356: Return
374: Return,MenuItem
051: MI_SetMenuItemIcon("Menu1", 5, A_AhkPath, 5, 16)
213: unused1 = 0
214: unused2 = 0
216: if MenuNameOrHandle is integer
219: h_menu := MI_GetMenuHandle(MenuNameOrHandle)
383: if !h_menuDummy
403: Menu,menuDummy,Add,:%menu_name%
404: h_menu := DllCall( "GetSubMenu", "uint", h_menuDummy, "int", 0 )
405: DllCall( "RemoveMenu", "uint", h_menuDummy, "uint", 0, "uint", 0x400 )
407: Menu,menuDummy,Delete,:%menu_name%
409: Return,h_menu
221: if !h_menu
224: if FilenameOrHICON is integer
237: {
240: if !(loaded_icon := h_icon := MI_ExtractIcon(FilenameOrHICON, IconNumber, IconSize))
443: if A_OSVersion in WIN_VISTA,WIN_2003,WIN_XP,WIN_2000
461: if DllCall("shell32.dll\ExtractIconExA","str",Filename,"int",IconNumber-1,"uint*",h_icon,"uint*",h_icon_small,"uint",1) (0.00)
463: {
464: SysGet,SmallIconSize,49
467: if (IconSize <= SmallIconSize)
467: {
468: DllCall("DestroyIcon","uint",h_icon)
469: h_icon := h_icon_small
470: }
475: if (h_icon && IconSize)
476: h_icon := DllCall("CopyImage","uint",h_icon,"uint",1,"int",IconSize,"int",IconSize,"uint",4|8)
478: }
480: Return,h_icon ? h_icon : 0
242: }
249: use_bitmap := (A_OSVersion="WIN_VISTA")
252: VarSetCapacity(mii,48,0), NumPut(48,mii), NumPut(0xA0,mii,4)
253: if DllCall("GetMenuItemInfo","uint",h_menu,"uint",ItemPos-1,"uint",1,"uint",&mii)
255: h_previous := use_bitmap ? NumGet(mii,44,"int") : MenuItem_getIconHandle(NumGet(mii,32))
072: Return,Class_getValue(MenuItemObject, "b1")
554: if (!ClassObject)
555: Return
257: if use_bitmap
282: {
288: if (h_icon)
289: {
290: if (!MenuItem := NumGet(mii, 32))
291: {
293: MenuItem := MenuItem_new("")
108: if (UserDefinedSize = "")
109: UserDefinedSize := MenuItem_setUserDefinedSize()
095: if (Size != "")
098: Return,UserDefinedSize
112: if (MenuItemObject := Class_Alloc(4 * UserDefinedSize + BuiltInSize))
032: if (!AlreadyDone)
040: start := subStr(size, 1,1 )
042: if (start >= "0" && start <= "9")
043: {
045: size += 8
046: }
058: addr := DllCall(HeapAlloc, "uint", ProcessHeap, "uint", 0x8, "uint", size)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403 (0.00)
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.02)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.52)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.00)
089: }
059: FileAppend,Alloc: %addr%
,MemoryLog.mem
060: Return,addr
125: Return,MenuItemObject
296: NumPut(MenuItem, mii, 32)
297: }
304: MenuItem_setIconHandle(MenuItem, h_icon)
077: Class_setValue(MenuItemObject, "b1", h_icon)
597: if (!ClassObject)
598: Return
078: }
305: }
307: NumPut(-1,mii,44)
308: }
310: if DllCall("SetMenuItemInfo","uint",h_menu,"uint",ItemPos-1,"uint",1,"uint",&mii)
311: {
313: if use_bitmap
318: DllCall("DestroyIcon","uint",h_previous)
320: Return,true
052: MenuItem_setValue1(MenuItem, "Menu1->Item5")
029: Class_setString(MenuItemObject, 1, Value1)
590: Class_setValue(ClassObject, index, data, "String")
597: if (!ClassObject)
598: Return
591: }
030: }
053: MenuItem_setValue2(MenuItem, 5)
039: Class_setValue(MenuItemObject, 2, Value2, "uint")
597: if (!ClassObject)
598: Return
040: }
058: Menu_Insert(1, "tray", "Menu1", ":Menu1")
305: OldMenuSize := Menu_getMenuSize_private(MenuName, hMenu)
1078: Old_Menu_UseErrorLevel := Menu_UseErrorLevel(true)
999: Old_Menu_UseErrorLevel := Menu_UseErrorLevel
1001: if (UseErrorLevel != "")
1002: {
1003: Menu,tray,UseErrorLevel,(UseErrorLevel) ? "" : "Off"
1004: Menu_UseErrorLevel := UseErrorLevel
1005: }
1007: Return,Old_Menu_UseErrorLevel
1081: if (hMenu := MI_getMenuHandle(MenuName))
383: if !h_menuDummy
403: Menu,menuDummy,Add,:%menu_name%
404: h_menu := DllCall( "GetSubMenu", "uint", h_menuDummy, "int", 0 )
405: DllCall( "RemoveMenu", "uint", h_menuDummy, "uint", 0, "uint", 0x400 )
407: Menu,menuDummy,Delete,:%menu_name%
409: Return,h_menu
1082: MenuSize := Menu_getMenuItemCount(hMenu)
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """") (0.00)
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.62)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.01)
089: }
1087: Menu_UseErrorLevel(Old_Menu_UseErrorLevel)
999: Old_Menu_UseErrorLevel := Menu_UseErrorLevel
1001: if (UseErrorLevel != "")
1002: {
1003: Menu,tray,UseErrorLevel,(UseErrorLevel) ? "" : "Off"
1004: Menu_UseErrorLevel := UseErrorLevel
1005: }
1007: Return,Old_Menu_UseErrorLevel
1089: Return,MenuSize
308: if (MenuItemLabel = "")
317: if (subStr(MenuItemLabel, 1, 1) = ":")
318: {
320: SubMenu := subStr(MenuItemLabel, 2)
322: if (!hSubMenu := MI_GetMenuHandle(SubMenu))
383: if !h_menuDummy
403: Menu,menuDummy,Add,:%menu_name%
404: h_menu := DllCall( "GetSubMenu", "uint", h_menuDummy, "int", 0 )
405: DllCall( "RemoveMenu", "uint", h_menuDummy, "uint", 0, "uint", 0x400 )
407: Menu,menuDummy,Delete,:%menu_name%
409: Return,h_menu
328: Menu,%MenuName%,add,%MenuItemName%,_
330: if (ErrorLevel && Menu_UseErrorLevel())
335: }
348: if (!hMenu)
355: if (OldMenuSize = MenuSize := Menu_getMenuItemCount(hMenu))
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.02)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.54)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.01)
089: }
356: {
358: Position := Menu_indexOf(hMenu, MenuItemName)
268: if (MenuItemName = "")
271: if MenuNameOrHandle is integer
272: hMenu := MenuNameOrHandle
276: if (!hMenu)
279: Loop,Menu_getMenuSize(hMenu)
1062: if MenuNameOrHandle is integer
1063: hMenu := MenuNameOrHandle
1067: if (!hMenu)
1070: Return,Menu_getMenuItemCount(hMenu)
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.45)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.00)
089: }
291: Return,0
361: MenuItem := Menu_getMenuItemObject(hMenu, Position)
1131: if MenuNameOrHandle is integer
1132: hMenu := MenuNameOrHandle
1136: if (!Position := Menu_getIndex(Position, Menu_getMenuItemCount(hMenu)))
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.52)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.01)
089: }
249: if (ThisSize = 0)
251: if (ThisIndex > 0)
253: if (ThisIndex = 0)
254: Return,ThisSize
1137: Return
364: MenuItem_setMenuItemLabel(MenuItem, MenuItemLabel)
087: Class_setString(MenuItemObject, "b2", MenuItemLabel)
590: Class_setValue(ClassObject, index, data, "String")
597: if (!ClassObject)
598: Return
591: }
088: }
367: VarSetCapacity(mii, 48, 0), NumPut(48, mii), NumPut(4, mii, 4)
369: if (subMenu)
370: NumPut(hSubMenu, mii, 20)
372: Menu_SetMenuItemInfo(hMenu, Position, mii)
1347: if MenuNameOrHandle is integer
1348: hMenu := MenuNameOrHandle
1352: if (!hMenu)
1355: if (!Position := Menu_getIndex(Position, Menu_getMenuItemCount(hMenu)))
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF (0.00)
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.02)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.52)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.01)
089: }
249: if (ThisSize = 0)
251: if (ThisIndex > 0)
253: if (ThisIndex = 0)
254: Return,ThisSize
1356: Return
374: Return,MenuItem
062: Menu_Move("Menu1", 1, 0)
420: if MenuNameOrHandle is integer
423: hMenu := MI_getMenuHandle(MenuNameOrHandle)
383: if !h_menuDummy
403: Menu,menuDummy,Add,:%menu_name%
404: h_menu := DllCall( "GetSubMenu", "uint", h_menuDummy, "int", 0 )
405: DllCall( "RemoveMenu", "uint", h_menuDummy, "uint", 0, "uint", 0x400 )
407: Menu,menuDummy,Delete,:%menu_name%
409: Return,h_menu
425: if (!hMenu)
428: if (!MenuSize := Menu_getMenuItemCount(hMenu))
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: }
080: Call = DllCall(
081: Loop,aParamCount
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
082: P:=NumGet(aParam+A_Index*4-4),V:=DllCallDebugger_TokenValue(P+0),T:=NumGet(P+8),Call.=(A_Index>1 ? ", ":"") . (T=1||T=2 ? V : """" V """")
086: Call.=")"
088: MsgBox,DllCall failed with ErrorLevel = %ErrorLevel%
Specifically: %Call% (0.01)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403
080: } (0.48)
061: Critical
063: id := wParam & 0xFFFF
065: if id in 65306,65403 (0.00)
080: } (0.01)
089: }
429: Return,0
066: Menu_MoveEx("Menu1", 1, "Menu2", 0)
487: if (FromMenuName = ToMenuName)
490: if (!hFrom := MI_getMenuHandle(FromMenuName))
383: if !h_menuDummy
403: Menu,menuDummy,Add,:%menu_name%
404: h_menu := DllCall( "GetSubMenu", "uint", h_menuDummy, "int", 0 )
405: DllCall( "RemoveMenu", "uint", h_menuDummy, "uint", 0, "uint", 0x400 )
407: Menu,menuDummy,Delete,:%menu_name%
409: Return,h_menu
493: if (!FromMenuSize := Menu_getMenuItemCount(hFrom))
1168: if (!GetMenuItemCount)
1171: Return,DllCall(GetMenuItemCount, "uInt", hMenu)
078: ListLines (0.00)
Press [F5] to refresh.