找回密码
 加入
搜索
楼主: a0204080

[AU3基础] [已解决]使用AU3窗口信息工具 无法 捕捉到 QQ 仙侠传的 窗口 就教…………

 火... [复制链接]
发表于 2010-11-1 16:00:26 | 显示全部楼层
用spy++可以
发表于 2010-11-1 18:27:38 | 显示全部楼层
回复 15# a0204080


    哈,那可不一定哦。加油, 相信自己,GOGOGO
发表于 2010-11-2 01:06:32 | 显示全部楼层
头痛啊,,问题无法解决。。。
发表于 2010-11-2 07:02:59 | 显示全部楼层
匹配类的方法,应该和QQ2009登陆 窗口一样!
发表于 2010-11-2 12:30:50 | 显示全部楼层
为啥不能从进程着手呢,找到对应进程,进而转到对应的窗口,进而获取窗口句柄之类的
发表于 2010-11-3 01:01:13 | 显示全部楼层
同情中....新手还要努力呀
 楼主| 发表于 2010-11-3 08:36:40 | 显示全部楼层
回复 20# 飘云

进程和窗口通过什么找啊?
发表于 2010-11-3 14:57:08 | 显示全部楼层
枚举所有窗口
#Include <WinAPI.au3>
_WinAPI_EnumWindows([$fVisible = True])

列出所有窗口的句柄,然后获取由指定窗口创建的线程标识

#Include <WinAPI.au3>
_WinAPI_GetWindowThreadProcessId($hWnd, ByRef $iPID)

然后,因为已知进程名,所以检查该指定进程是否存在.
ProcessExists ( "进程" )

成功则返回进程PID,将此PID与之前_WinAPI_GetWindowThreadProcessId获取到的PID值进行比较,相同则确定了窗口句柄,不同就继续下一个比较,直到所有窗口比较完为止,确定了窗口句柄后,可以用_WinAPI_GetWindowText获取指定窗口的标题条文本

#Include <WinAPI.au3>
_WinAPI_GetWindowText($hWnd)

这样,窗口标题就有了~

以上结论论坛搜索里都能搜到的相关的内容,另外Au3的帮助文档里也能找到,希望你学会搜索,遇到问题可以先搜搜论坛再问
发表于 2010-11-3 15:09:23 | 显示全部楼层
本帖最后由 飘云 于 2010-11-3 15:11 编辑

帮你找了个UDF

;===============================================================================
;
; Function Name:    _ProcessGetHWnd
; Description:      Returns the HWND(s) owned by the specified process (PID only !).
;
; Parameter(s):     $iPid                - the owner-PID.
;                                        $iOption        - Optional : return/search methods :
;                                                0 - returns the HWND for the first non-titleless window.
;                                                1 - returns the HWND for the first found window (default).
;                                                2 - returns all HWNDs for all matches.
;
;                   $sTitle                - Optional : the title to match (see notes).
;                                        $iTimeout        - Optional : timeout in msec (see notes)
;
; Return Value(s):  On Success - returns the HWND (see below for method 2).
;                                                $array[0][0] - number of HWNDs
;                                                $array[x][0] - title
;                                                $array[x][1] - HWND
;
;                   On Failure        - returns 0 and sets @error to 1.
;
; Note(s):                        When a title is specified it will then only return the HWND to the titles
;                                        matching that specific string. If no title is specified it will return as
;                                        described by the option used.
;
;                                        When using a timeout it's possible to use WinWaitDelay (Opt) to specify how
;                                        often it should wait before attempting another time to get the HWND.
;
;
; Author(s):        Helge
;
;===============================================================================
Func _ProcessGetHWnd($iPid, $iOption = 1, $sTitle = "", $iTimeout = 2000)
        Local $aReturn[1][1] = [[0]], $aWin, $hTimer = TimerInit()
        
        While 1
                
                ; Get list of windows
                $aWin = WinList($sTitle)
                
                ; Searches thru all windows
                For $i = 1 To $aWin[0][0]
                        
                        ; Found a window owned by the given PID
                        If $iPid = WinGetProcess($aWin[$i][1]) Then
                                
                                ; Option 0 or 1 used
                                If $iOption = 1 OR ($iOption = 0 And $aWin[$i][0] <> "") Then
                                        Return $aWin[$i][1]
                                
                                ; Option 2 is used
                                ElseIf $iOption = 2 Then
                                        ReDim $aReturn[UBound($aReturn) + 1][2]
                                        $aReturn[0][0] += 1
                                        $aReturn[$aReturn[0][0]][0] = $aWin[$i][0]
                                        $aReturn[$aReturn[0][0]][1] = $aWin[$i][1]
                                EndIf
                        EndIf
                Next
                
                ; If option 2 is used and there was matches then the list is returned
                If $iOption = 2 And $aReturn[0][0] > 0 Then Return $aReturn
                
                ; If timed out then give up
                If TimerDiff($hTimer) > $iTimeout Then ExitLoop
                
                ; Waits before new attempt
                Sleep(Opt("WinWaitDelay"))
        WEnd
        
        
        ; No matches
        SetError(1)
        Return 0
EndFunc   ;==>_ProcessGetHWnd

评分

参与人数 1金钱 +30 收起 理由
hzxymkb + 30

查看全部评分

 楼主| 发表于 2010-11-6 19:12:16 | 显示全部楼层
回复 24# 飘云


好是 晦涩  难懂 哦……
先去 尝试 下 哦
加油 !!
发表于 2010-11-7 09:36:26 | 显示全部楼层
飘云的例子很好,用API枚举窗口句柄,再对比窗口句柄对应的窗口名和进程名就能得到想要的窗口了
 楼主| 发表于 2010-11-8 16:42:28 | 显示全部楼层
哈哈获取到了!!
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $aWindows, $i, $text
    $aWindows = _WinAPI_EnumWindows()
    For $i = 1 To $aWindows[0][0]
        $text = "Window Handle: " & $aWindows[$i][0] & @LF
        $text &= "Window Class: " & $aWindows[$i][1] & @LF
        $text &= "Window Title: " & WinGetTitle($aWindows[$i][0]) & @LF
        $text &= "Window Text: " & WinGetText($aWindows[$i][0]) & @LF
        $text &= "Window Process: " & WinGetProcess($aWindows[$i][0])
        MsgBox(0, "Item " & $i & " of " & $aWindows[0][0], $text)
    Next
EndFunc 
一个一个 终于 找到 了
谢谢 飘云!![img][/img]
谢谢关注 这个 帖子的 人……
[img][img][img][img][img][/img][/img][/img][/img][/img]
 楼主| 发表于 2010-11-8 16:44:17 | 显示全部楼层
成功的 图片 不会上传……
发表于 2011-8-2 00:19:19 | 显示全部楼层
你找到窗口标题又如何?你又不能操作内存!白费力气!
发表于 2011-8-18 06:26:09 | 显示全部楼层
我也好想知道唷~_~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-16 23:02 , Processed in 0.079604 second(s), 17 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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