vba 模块1代码:Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd) As Long
Public Function EnumFunc(ByVal h1wnd As Long, ByVal lParam As Long) As Long
Dim sText As String
Dim lCaption As Long
Dim hnd As Long
MsgBox h1wnd
If h1wnd <> 0 Then
lCaption = GetWindowText(lhwnd, sText, lCaption)
End If
End Function
子程序代码:Sub go()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "某某软件")
MsgBox "句柄:" & hwnd
Dim h1wnd As Long
h1wnd = EnumChildWindows(hwnd, AddressOf EnumFunc, 0)
End Sub
问题:已获取某程序主窗口句柄,如何获取该程序某个按钮并虚拟一个点击事件,获取文本编辑框并设置/获取它的内容! 我的程序是有问题的!请大神动动手,不要无视,我是真的很迫切!我知道我读书少!但是你的不屑是我的迫切!摆脱了!