ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
12
返回列表 发新帖
楼主: yvhf

[求助]VBA如何操作QQ信息发送--API

[复制链接]

TA的精华主题

TA的得分主题

发表于 2007-6-11 22:54 | 显示全部楼层
模擬QQ尾巴發送信息
		
Declare Function FindWindowExA Lib "user32" (ByVal Hwnd1 As Long, ByVal Hwnd2 As Long, _
                 ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function SendMessageA Lib "user32" (ByVal Hwnd As Long, ByVal wMsg As Long, _
                 ByVal wParam As Long, lParam As Any) As Long
Declare Function GetWindowTextA Lib "user32" (ByVal Hwnd As Long, ByVal lpString As String, _
                 ByVal cch As Long) As Long
Const EM_REPLACESEL = &HC2
Const BM_CLICK = &HF5

Sub Test()
  Dim Hwnd  As Long
  Dim Title As String
  Hwnd = FindWindowExA(0, 0, "#32770", vbNullString)
  Do While Hwnd > 0
     Hwnd = FindWindowExA(0&, Hwnd, "#32770", vbNullString)
     Title = Space(255)
     GetWindowTextA Hwnd, Title, 256
     If (Title Like "*聊天中*") Or (Title Like "*群*") Or (Title Like "*會話中*") Then
        SendMsg Hwnd, "QQ消息群發"
     End If
   Loop
End Sub

Function SendMsg(Hwnd As Long, Meg As String)
  Dim Hwnd1 As Long
  Dim Hwnd2 As Long
  Hwnd1 = FindWindowExA(Hwnd, 0, "#32770", vbNullString)
  Hwnd2 = FindWindowExA(Hwnd1, 0, "Button", "發送(S)")
  Hwnd1 = FindWindowExA(Hwnd1, Hwnd2, "AfxWnd42", vbNullString)
  Hwnd1 = FindWindowExA(Hwnd1, 0, "RichEdit", vbNullString)

  SendMessageA Hwnd1, EM_REPLACESEL, 0, ByVal Meg
  SendMessageA Hwnd2, BM_CLICK, 0, ByVal 0
End Function

TA的精华主题

TA的得分主题

发表于 2007-6-12 10:53 | 显示全部楼层
帮顶一下,希望有高手出现[em04]

TA的精华主题

TA的得分主题

发表于 2009-4-26 01:44 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
真的?试试看

TA的精华主题

TA的得分主题

发表于 2012-4-19 23:09 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2016-10-27 14:42 | 显示全部楼层
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Public Sub yvhf()

    Dim i%, a
    a = ThisWorkbook.Worksheets("QQ消息").Range("a" & Cells.Rows.Count).End(3).Row

    For i = 2 To a
        ShellExecute 0, "open", "tencent://message/?uin=" & Range("A" & i) & "&Site=LG&Menu=yes", "", "", 1       //A列中为QQ号
        Application.Wait (Now() + TimeSerial(0, 0, 3))
        SendKeys  Range("B" & i)       //B列为要发送的消息
        SendKeys "+(%s)"
    Next

End Sub

评分

2

查看全部评分

TA的精华主题

TA的得分主题

发表于 2018-10-4 07:42 | 显示全部楼层
试过5,6次了,用这种方法群发qq信息或群发qq截图,还是蛮稳定的。有没有高手能够解决怎么发送文件呀?试了一下,在vba中copy文件,再用上述的ctrl+v,不行。
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2025-1-16 10:56 , Processed in 0.019352 second(s), 6 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表