怎样用vb获得qq群的qq群应用消息怎么关闭

查看: 10068|回复: 28
如何获取QQ聊天窗口中对方回复的消息
发送消息可以这样:
& & SendMessage lngEditHwnd, EM_REPLACESEL, 0, ByVal frmMain.txtSend.Text复制代码
其中 lngEditHwnd 是 QQ 聊天窗口中发送框的句柄。
那能否自动获取对方回复的消息呢?
GetWindowText 再从下往上分析找到特征分割处?
(我的目的非常明显,想搞一个自动化PMM系统 )
[ 本帖最后由 VBProFan 于
22:06 编辑 ]
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 WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Private Declare Sub RtlMoveMemory Lib &KERNEL32& (lpvDest As Any, lpvSource As Any, ByVal cbCopy 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
Public Function GetText(ByVal hWndNow As Long) As String
& & Dim hLength As Long
& & Dim bArr() As Byte, bArr2() As Byte
& & hLength = SendMessage(hWndNow, WM_GETTEXTLENGTH, 0, 0)
& & If hLength & 0 Then
& &&&ReDim bArr(hLength + 1) As Byte, bArr2(hLength - 1) As Byte
& &&&Call RtlMoveMemory(bArr(0), hLength, 2)
& &&&Call SendMessage(hWndNow, WM_GETTEXT, hLength + 1, bArr(0))
& &&&Call RtlMoveMemory(bArr2(0), bArr(0), hLength)
& &&&GetText = StrConv(bArr2, vbUnicode)
& & Else
& &&&GetText = ″″
& & End If
End Function
Private Sub Command1_Click()
Dim qqhwnd&
find:
qqhwnd = FindWindowEx(0&, qqhwnd&, &#32770&, vbNullString)
If qqhwnd = 0 Then MsgBox &No Msg&: End
If Not (GetText(qqhwnd) Like &与**交谈中& Or GetText(qqhwnd) Like &* - 群&) Then
&&GoTo find
End If
Dim chldhwnd&
chldhwnd& = FindWindowEx(qqhwnd&, 0, &#32770&, vbNullString)
chldhwnd& = FindWindowEx(chldhwnd&, 0, &RichEdit20A&, vbNullString)
MsgBox GetText(chldhwnd&)
End Sub复制代码
[ 本帖最后由 VBProFan 于
20:24 编辑 ]
正在为我的qqtab研究怎么获取qq09的聊天记录
饭版还在研究自动化PMM系统啊~~
又看见reker大坏蛋了~~
原帖由 btxdlibin 于
01:30 发表
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
chldhwnd& = FindWindowEx(qqhwnd&, 0, &#32770&, vbNullString)
&&If chldhwnd& = 0 Then chldhwnd& = qqhwnd&
&&chldhwnd& = FindWindowEx(chldhwnd&, 0, &RichEdit20A&, vbNullString)
对于 QQ2008,要加上红色那句才能正常工作。。。
虽然有点小缺陷,但还是谢谢 btxdlibin,我看到自动化PMM系统的曙光了,哇哈哈~~~
回复 #7 VBProFan 的帖子
我也是用2008版的.
难道我又用到盗版的?
& &┠#32770
& && & ┠RichEdit20A
''''''''''''''''''''''''''''''''''''''''''''''''''''''
盗版啊?不错,价格便宜.我一直用它.
盗版,明天见.
盗版,天天见!
恩,看来 2008 II 的确做了些改动
我的情况和 泡饭 一样,RichEdit20A 直接在主窗口下
本帖子中包含更多资源
才可以下载或查看,没有帐号?VB.NET如何从电脑微信版中的群里取得文字内容,并且进行回复?
[问题点数:40分,无满意结帖,结帖人u]
VB.NET如何从电脑微信版中的群里取得文字内容,并且进行回复?
[问题点数:40分,无满意结帖,结帖人u]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
匿名用户不能发表回复!|没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!tan126tan's Blog
已成功添加“”到 个分组
请不要超过6个字如何用VB或读取QQ消息_百度知道
如何用VB或读取QQ消息
如题,怎么用VB读出别人发过来的消息,不用QQ,用别的聊天软件也可以,最好能弄飞信的,这样就可以实现用手机遥控电脑或者自动回复短信了。弄的好的加分
我有更好的答案
VB读取QQ消息,依次读取QQ消息窗口01 Private Declare Function GetWindow Lib &user32& (ByVal hwnd As Long, ByVal wCmd As Long) As Long
02 Private Declare Function FindWindow Lib &user32& Alias &FindWindowA& (ByVal lpClassName As String, ByVallpWindowName As String) As Long
03 Private Declare Function GetWindowText Lib &user32& Alias &GetWindowTextA& (ByVal hwnd As Long, ByVallpString As String, ByVal cch As Long) As Long
Private Declare Function GetClassName Lib &user32& Alias &GetClassNameA& (ByVal hwnd As Long, ByVallpClassName As String, ByVal nMaxCount As Long) As Long
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Sub Command1_Click()
Dim hWin As Long
Dim strText As String
Dim strClass As String
Dim arr(1 To 5) As String
Dim flag As Integer
Dim length As Integer
List1.Clear
'第一个QQ消息窗口
hWin = FindWindow(&CTXOPConntion_Class&, vbNullString)
If hWin = 0 Then Exit Sub
strText = String$(50, vbNullChar)
GetWindowText hWin, strText, Len(strText)
strText = Left$(strText, InStr(strText, vbNullChar) - 1)
If InStr(strText, &OP_&) = 1 Then
strText = Mid$(strText, 4)
List1.AddItem strText
arr(flag) = strText
flag = flag + 1
'下一个窗口
hWin = GetWindow(hWin, GW_HWNDNEXT)
If hWin = 0 Then Exit Do
strClass = String$(50, vbNullChar)
GetClassName hWin, strClass, Len(strClass)
strClass = Left$(strClass, InStr(strClass, vbNullChar) - 1)
Loop While strClass && &CTXOPConntion_Class&
Loop While hWin
List1.Text = strText
先获取聊天回复框的句柄即可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 LongPrivate Const WM_GETTEXT = &HDPrivate Const WM_GETTEXTLENGTH = &HEPrivate Declare Sub RtlMoveMemory Lib &KERNEL32& (lpvDest As Any, lpvSource As Any, ByVal cbCopy 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 LongPublic Function GetText(ByVal hWndNow As Long) As String
Dim hLength As Long
Dim bArr() As Byte, bArr2() As Byte
hLength = SendMessage(hWndNow, WM_GETTEXTLENGTH, 0, 0)
If hLength & 0 Then
ReDim bArr(hLength + 1) As Byte, bArr2(hLength - 1) As Byte
Call RtlMoveMemory(bArr(0), hLength, 2)
Call SendMessage(hWndNow, WM_GETTEXT, hLength + 1, bArr(0))
Call RtlMoveMemory(bArr2(0), bArr(0), hLength)
GetText = StrConv(bArr2, vbUnicode)
GetText = 〃〃
End IfEnd FunctionPrivate Sub Command1_Click()
Dim qqhwnd&find:
qqhwnd = FindWindowEx(0&, qqhwnd&, &#32770&, vbNullString)
If qqhwnd = 0 Then MsgBox &No Msg&: End
If Not (GetText(qqhwnd) Like &与**交谈中& Or GetText(qqhwnd) Like &* - 群&) Then
Dim chldhwnd&
chldhwnd& = FindWindowEx(qqhwnd&, 0, &#32770&, vbNullString)
chldhwnd& = FindWindowEx(chldhwnd&, 0, &RichEdit20A&, vbNullString)
MsgBox GetText(chldhwnd&)End Sub
本回答被提问者采纳
建议去学一下基本的网络编程知识
为您推荐:
其他类似问题
qq消息的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。

我要回帖

更多关于 qq群匿名消息破解2017 的文章

 

随机推荐