返回菜单属于哪个窗口
#Include <GuiMenu.au3>
_GUICtrlMenu_FindParent($hMenu)
$hMenu | 菜单句柄 |
成功: | 返回窗口句柄 |
失败: | 返回 0 |
#include <GuiMenu.au3>
_Main()
Func _Main()
Local $hWnd, $hMain
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
; Show that Menu handle belongs to Notepad
Writeln("Notepad handle: 0x" & Hex($hWnd))
Writeln("Menu Parent ..: 0x" & Hex(_GUICtrlMenu_FindParent($hMain)))
EndFunc ;==>_Main
; 写入一行文本到记事本
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln