@ alexey.chumagin the embed code is not complete (missing missing). And here:
#include <GuiMenu.au3> #include <GuiTreeView.au3> #Include <SendMessage.au3> #Include <WindowsConstants.au3> $WinTitle= "1: 8.1" $WinText = " " WinWait($WinTitle, $WinText) ; $hDTCtrl = ControlGetHandle($WinTitle, "", "SysTreeView321") $hDTItem = _GUICtrlTreeView_FindItem($hDTCtrl, " ") $hDTIt_1 = _GUICtrlTreeView_FindItem($hDTCtrl, "", False, $hDTItem) ; WinActivate($WinTitle, $WinText) WinWaitActive($WinTitle, $WinText) ; _GUICtrlTreeView_SelectItem($hDTCtrl, $hDTIt_1, $TVGN_FIRSTVISIBLE) _GUICtrlTreeView_ClickItem ($hDTCtrl, $hDTIt_1, "left", True) ; $aRect = _GUICtrlTreeView_DisplayRect($hDTCtrl, $hDTIt_1, True) ControlClick($WinTitle, $WinText, $hDTCtrl, "left", 1, $aRect[0]-10, $aRect[1]+5) WinWait("[CLASS:#32768]") ; $hWnd = WinGetHandle("[CLASS:#32768]") $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0) $aRect = _GUICtrlMenu_GetItemRect($hWnd, $hMenu, 0) MouseClick("left", $aRect[0]+20, $aRect[1]+15, 1, 1)
A little explanation:
WinWait("[CLASS:#32768]") $hWnd = WinGetHandle("[CLASS:#32768]")
This is the code in which the context menu handle is received. #32768 is the name of a reserved system class that denotes a menu ( link here ).
source share