VB 实现取得其他窗口中某控件的句柄

来源:百度知道 编辑:UC知道 时间:2024/05/28 09:20:57
不是鼠标指向的控件,不是vb工程中的窗体上控件,API中GetFocus函数不好用,只能得到本窗口内的控件句柄,我要其他运行程序中某控件的句柄。谢谢
多谢,能否对findWindowEx函数详细说一些,如何用它能判断拥有焦点的控件呢?

留个邮箱,我发一份给你

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long'查找控件

Private Declare Function GetForegroundWindow Lib "user32" () As Long'得到当前桌面窗体

当你桌面有程序激活时,句柄可以通过GetForegroundWindow得到
findWindowEx得到已知句柄窗体中某个控件