SetText不可以就一个个打字进去啊- -
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Const WM_SETTEXT = &HC
Const WM_CHAR = &H102
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 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 Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Handle As Long
Private Sub Command1_Click()
Dim hwnd As Long
'取得桌面窗口
hwnd = GetDesktopWindow()
'取得桌面窗口的第一个子窗口
hwnd = GetWindow(hwnd, GW_CHILD)
Dim strTitle As String 255 '用来存储窗口的标题
'通过循环来枚举所有的窗口
Do While hwnd <> 0
'取得下一个窗口的标题
GetWindowText hwnd, strTitle, Len(strTitle)
If Left$(strTitle, 1) <> vbNullChar Then
If InStr(Left$(strTitle, InStr(1, strTitle, vbNullChar)), "交谈中") > 0 Then '检查是否包含定义的字符
tmp1 = hwnd
t1 = FindWindowEx(tmp, 0, "AfxWnd42", "")
t2 = FindWindowEx(t1, 0, "RichEdit20A", "")
SendMessage t2, WM_CHAR, Asc("中"), &H0
SendMessage t2, WM_CHAR, Asc("文"), &H0
End If
End If
'调用GetWindow函数,来取得下一个窗口
hwnd = GetWindow(hwnd, GW_HWNDNEXT)
Loop
End Sub
我没有QQ2008,自己试试看,别说不知道怎么自动按回车
'--------------------------
旧的回答
原来是喊话工具啊,你囧死我了
看看这个先
>
以上就是关于VB用API获取不到QQ2008聊天窗口的输入框全部的内容,包括:VB用API获取不到QQ2008聊天窗口的输入框、C#如何获得QQ聊天框中的信息、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)