Sign in to follow this  
Followers 0
tmailkura

how to find handle rightclick menu

7 posts in this topic

i want find handle rightclick menu in pic

http://img245.imageshack.us/i/20091024214748.png/

Share this post


Link to post
Share on other sites



help me ! :)

Share this post


Link to post
Share on other sites

i understand Use "Start" from Toolbar.

code it not work!

i think

1 remove option > preference

2 remove ring click > force start

#Include <GuiListView.au3>
#include <WinAPI.au3>

#Include <GuiMenu.au3>
#include <Misc.au3>


Opt("WinTitleMatchMode", 4)
;Opt("TrayIconHide", 1)

ProcessWait("uTorrent.exe")

$hWindow = _ProcessGetWinEx("uTorrent.exe", "", "Torrent")
If Not $hWindow[0] Then Exit 1
    
WinWaitActive ($hWindow[1])
MsgBox(4096, "start", "start", 10)
$whwindow = WinGetHandle($hWindow[1],"")
$hControl = ControlGetHandle($hWindow[1], "", "[CLASSNN:SysListView322]")
$dll = DllOpen("user32.dll")
_DeletePreferences($hWindow[1])
_DisableForceStart($hWindow,$hControl) ; not work 100%

;-------------------code remove force start------------------------------



 
;------------------------------------------------------------------------
Func _DeletePreferences($title) ; windows title
$whwindow = WinGetHandle($title,"")
$hmainmenu = _GUICtrlMenu_GetMenu($whwindow)
$hFile = _GUICtrlMenu_GetItemSubMenu($hmainmenu, 1)
return _GUICtrlMenu_DeleteMenu ($hFile, 0)
EndFunc

Func _DisableForceStart($hWindow,$hControl)
    while True
        WinWaitActive ($hWindow[1])     
        If ControlClick($hWindow[1],"",$hControl,"right")Then
            MsgBox(4096, "PID is", "oooooooooo")
        EndIf
        If _IsPressed("02", $dll) Then  
            If _GUICtrlListView_GetItemFocused($hControl,_GUICtrlListView_GetSelectedIndices($hControl)) Then
                $pos = MouseGetPos()            
                MouseClick("left",$pos[0]-0.1,$pos[1]+0.1,10)
                ControlDisable ( $hWindow[1], "", $hControl)
                Sleep(10*1000)
                ControlEnable( $hWindow[1], "", $hControl)
            EndIf
        EndIf
    WEnd
    DllClose($dll)
EndFunc
Func _ProcessGetWinEx($ivPid, $svClass = "", $svTitle = "", $svText = "")
    $ivPid = ProcessExists($ivPid)
    If Not $ivPid Then Return(SetError(1, 0, 0))
    Local $avwArray = WinList()
    Local $avRet[1] = [0]
    For $i = 1 To $avwArray[0][0]
        If WinGetProcess($avwArray[$i][1]) = $ivPid Then
            If $svClass = "" Or _WinAPI_GetClassName($avwArray[$i][1]) = $svClass Then
                If ($svTitle = "" Or StringInStr($avwArray[$i][0], $svTitle)) And ($svText = "" Or StringInStr(WinGetText($avwArray[$i][1]), $svText)) Then
                    $avRet[0] += 1
                    ReDim $avRet[$avRet[0]+1]
                    $avRet[$avRet[0]] = $avwArray[$i][1]
                EndIf
            EndIf
        EndIf
    Next   
    Return $avRet
EndFunc

Share this post


Link to post
Share on other sites

this autoitinfo

post-53809-1256481122554_thumb.jpg

Share this post


Link to post
Share on other sites

Link

#include <GuiMenu.au3>
#include "WinEventHook.au3"
Opt('WinSearchChildren', 1)

HotKeySet('{ESC}', '_EXIT')

Global Const $MN_GETHMENU = 0x01E1
Global $hFunc, $pFunc
Global $hWinHook

$hFunc = DllCallbackRegister('_WinEventProc', 'none', 'ptr;uint;hwnd;int;int;uint;uint')
$pFunc = DllCallbackGetPtr($hFunc)

$hWinHook = _SetWinEventHook($EVENT_MIN, $EVENT_MAX, 0, $pFunc, 0, 0, _
                BitOR($WINEVENT_SKIPOWNPROCESS, $WINEVENT_OUTOFCONTEXT))
                
If $hWinHook = 0 Then Exit MsgBox(0x10, 'Error', 'Could not register callback procedure')

While 1
    Sleep(20)
WEnd

Func _EXIT()
    Exit
EndFunc

Func OnAutoItExit()
    _UnhookWinEvent($hWinHook)
    DllCallbackFree($hFunc)
EndFunc

Func _WinEventProc($hHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iEventThread, $imsEventTime)
    Local $hMenu
    
    If $iEvent =  $EVENT_SYSTEM_MENUPOPUPSTART Then
        If WinGetHandle("") <> WinGetHandle("[CLASS:SciTEWindow]") Then Return
        $hMenu = _SendMessage($hWnd, 0x01E1)
        If _GUICtrlMenu_IsMenu($hMenu) Then
            For $i = 0 To _GUICtrlMenu_GetItemCount($hMenu)-1
                If _GUICtrlMenu_GetItemText($hMenu, $i) = "select all" Then
                    _GUICtrlMenu_SetItemEnabled($hMenu, $i, False)
                    ExitLoop
                EndIf
            Next
        EndIf
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

Link

#include <GuiMenu.au3>
#include "WinEventHook.au3"
Opt('WinSearchChildren', 1)

HotKeySet('{ESC}', '_EXIT')

Global Const $MN_GETHMENU = 0x01E1
Global $hFunc, $pFunc
Global $hWinHook

$hFunc = DllCallbackRegister('_WinEventProc', 'none', 'ptr;uint;hwnd;int;int;uint;uint')
$pFunc = DllCallbackGetPtr($hFunc)

$hWinHook = _SetWinEventHook($EVENT_MIN, $EVENT_MAX, 0, $pFunc, 0, 0, _
                BitOR($WINEVENT_SKIPOWNPROCESS, $WINEVENT_OUTOFCONTEXT))
                
If $hWinHook = 0 Then Exit MsgBox(0x10, 'Error', 'Could not register callback procedure')

While 1
    Sleep(20)
WEnd

Func _EXIT()
    Exit
EndFunc

Func OnAutoItExit()
    _UnhookWinEvent($hWinHook)
    DllCallbackFree($hFunc)
EndFunc

Func _WinEventProc($hHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iEventThread, $imsEventTime)
    Local $hMenu
    
    If $iEvent =  $EVENT_SYSTEM_MENUPOPUPSTART Then
        If WinGetHandle("") <> WinGetHandle("[CLASS:SciTEWindow]") Then Return
        $hMenu = _SendMessage($hWnd, 0x01E1)
        If _GUICtrlMenu_IsMenu($hMenu) Then
            For $i = 0 To _GUICtrlMenu_GetItemCount($hMenu)-1
                If _GUICtrlMenu_GetItemText($hMenu, $i) = "select all" Then
                    _GUICtrlMenu_SetItemEnabled($hMenu, $i, False)
                    ExitLoop
                EndIf
            Next
        EndIf
    EndIf
EndFunc

Thank you so much example and library

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0