Function Reference


_GUICtrlMenu_FindParent

Retrieves the window to which a menu belongs

#include <GuiMenu.au3>
_GUICtrlMenu_FindParent ( $hMenu )

Parameters

$hMenu Menu handle

Return Value

Success: the window handle.
Failure: 0.

Related

_GUICtrlMenu_GetMenu

Example

#include <GuiMenu.au3>

Example()

Func Example()
        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   ;==>Example

; Write a line of text to Notepad
Func Writeln($sText)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CRLF)
EndFunc   ;==>Writeln