getMenuText(menuName){
Handle := MenuGetHandle(menuName)
; 获取菜单内菜单项的数目.
item_count := DllCall("GetMenuItemCount", "ptr", Handle)
ret := ""
Loop, % item_count
{
menuItemIndex := A_Index - 1 ;菜单项位置索引
; 获取菜单项字符串长度
strLen := DllCall("GetMenuStringA", "Ptr", Handle, "UInt", menuItemIndex, "Ptr", 0, "Int", 0, "UInt", 0x400)
; 分配缓冲区
VarSetCapacity(buffer, strLen + 1)
; 获取菜单项字符串
DllCall("GetMenuStringA", "Ptr", Handle, "UInt", menuItemIndex, "Ptr", &buffer, "Int", strLen + 1, "UInt", 0x400)
; 显示菜单项字符串
ret.= StrGet(&buffer, strLen, "CP0") "`n"
; 释放资源
; DllCall("GlobalFree", "Ptr", &buffer)
}
MsgBox, % ret
}
暂无讨论,说说你的看法吧