如何取得控件句柄及控件座标?
如何取得小红框内控件句柄和座标位置?被这些API的组合搞昏头了()
程序代码:
Option Explicit Dim hWnd1 As Long, hWnd2 As Long Private Sub Command1_Click() Dim h& Dim Str As String Do h = FindWindowEx(hWnd1, h, vbNullString, vbNullString) If h <> 0 Then GetWindowText h, Str, 255 Debug.Print Str & " : " & h List1.AddItem h End If Loop Until h = 0 End Sub Private Sub Form_Load() Dim h& hWnd1 = Shell(App.Path & "\Aprcg.exe", vbHide) hWnd1 = FindWindow(vbNullString, "Pattern Reverse Compiler") h = FindWindowEx(hWnd1, hWnd2, vbNullString, vbNullString) End Sub
为啥Form_Load()的FindWindowEx取不到hWnd2
但是Command1_Click()的FindWindowEx却可以?
[ 本帖最后由 wube 于 2012-10-13 01:41 编辑 ]