找回密码
 加入
搜索
查看: 2215|回复: 3

请问如何获取菜单的下拉内容

  [复制链接]
发表于 2008-8-30 19:16:13 | 显示全部楼层 |阅读模式
例如,我想获取excel中的窗口菜单的内容,应该如何做呢?
发表于 2008-8-31 12:17:19 | 显示全部楼层
先用_GUICtrlMenu_GetMenu 得到窗口的菜单,再用_GUICtrlMenu_GetItemText 得到菜单文字
 楼主| 发表于 2008-9-1 22:10:11 | 显示全部楼层
你好,我在帮助文件里搜索你说的这两个函数,没有发现,请问这两个函数在哪里呢?多谢了
发表于 2008-9-2 23:14:39 | 显示全部楼层
原帖由 jchang 于 2008-9-1 22:10 发表
你好,我在帮助文件里搜索你说的这两个函数,没有发现,请问这两个函数在哪里呢?多谢了


在UDF中:
#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
        Local $hWnd, $hMain, $hItem1, $hItem2

        ; Open Notepad
        Run("Notepad.exe")
        WinWaitActive("无标题 - 记事本")
        $hWnd = WinGetHandle("无标题 - 记事本")
        $hMain = _GUICtrlMenu_GetMenu ($hWnd)

        ; Create subitem menu
        $hItem1 = _GUICtrlMenu_CreateMenu ()
        _GUICtrlMenu_InsertMenuItem ($hItem1, 0, "SubItem &1", 0x1000)
        _GUICtrlMenu_InsertMenuItem ($hItem1, 1, "SubItem &2", 0x1001)

        ; Create menu
        $hItem2 = _GUICtrlMenu_CreateMenu ()
        _GUICtrlMenu_InsertMenuItem ($hItem2, 0, "Item &1", 0x2000, $hItem1)
        _GUICtrlMenu_InsertMenuItem ($hItem2, 1, "Item &2", 0x2001)
        _GUICtrlMenu_InsertMenuItem ($hItem2, 2, "", 0)
        _GUICtrlMenu_InsertMenuItem ($hItem2, 3, "Item &3", 0x2002)
        _GUICtrlMenu_InsertMenuItem ($hItem2, 4, "Item &4", 0x2003)

        ; Insert new menu into Notepad
        _GUICtrlMenu_InsertMenuItem ($hMain, 6, "&AutoIt", 0, $hItem2)
        _GUICtrlMenu_DrawMenuBar ($hWnd)

EndFunc   ;==>_Main
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-19 11:27 , Processed in 0.078677 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表