'因为还有一层"常规"的"#32770"才到"Edit"
'完整代码如下
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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 SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
WinH = FindWindow("#32770", vbNullString)
Dim Wintxt As String * 256
Do While WinH <> 0
SendMessage WinH, WM_GETTEXT, ByVal 256, ByVal Wintxt
If InStr(Wintxt, "属性") Then
a = FindWindowEx(WinH, 0&, "#32770", "常规")
If a <> 0 Then
b = FindWindowEx(a, 0&, "Edit", vbNullString)
b = FindWindowEx(a, b, "Edit", vbNullString)
b = FindWindowEx(a, b, "Edit", vbNullString)
b = FindWindowEx(a, b, "Edit", vbNullString)
SendMessage b, &HD, ByVal 256, ByVal Wintxt
Exit Do
End If
End If
WinH = FindWindowEx(0, WinH, "#32770", vbNullString)
DoEvents
Loop
MsgBox Replace(Wintxt, Chr(0), "")
End Sub
想要干啥我没看明白。