标题:在一个窗口内有多个相同的控件,怎么获取需要的控件句柄??
取消只看楼主
suzhanpeng
Rank: 4
等 级:业余侠客
威 望:7
帖 子:72
专家分:248
注 册:2016-9-28
结帖率:75%
 问题点数:0 回复次数:1 
在一个窗口内有多个相同的控件,怎么获取需要的控件句柄??

我需要定位到hWnd5 = FindWindowEx(hWnd4, 12, "Button", "参考(&F)...")编程思路!!
搜索更多相关主题的帖子: 窗口 相同 控件 获取 句柄 
2017-12-02 13:22
suzhanpeng
Rank: 4
等 级:业余侠客
威 望:7
帖 子:72
专家分:248
注 册:2016-9-28
得分:0 
已经解决
用了个循环就搞定了
hwnd = FindWindow(vbNullString, "打开 ")
Label1.Caption = hwnd
hWnd2 = FindWindowEx(hwnd, 0, "DUIViewWndClassName", vbNullString)
Label2.Caption = hWnd2
hWnd3 = FindWindowEx(hWnd2, 0, "DirectUIHWND", vbNullString)
Label3.Caption = hWnd3
hWnd4 = FindWindowEx(hWnd3, 0, "FloatNotifySink", vbNullString)
Label4.Caption = hWnd4
hWnd5 = FindWindowEx(hWnd4, 0, "Button", "参考(&F)...")

Do While hWnd5 = 0
    hWnd4 = FindWindowEx(hWnd3, hWnd4, "FloatNotifySink", vbNullString)
    hWnd5 = FindWindowEx(hWnd4, 0, "Button", "参考(&F)...")
Loop
Label5.Caption = hWnd5

[此贴子已经被作者于2017-12-2 15:54编辑过]

2017-12-02 15:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-483031-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.446091 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved