📄 qq尾巴演示代码.txt
字号:
由于是演示,所以没有什么特别的功能
设计思路:
1》找到当前用户正在运行的窗口中发送QQ消息的窗口
2》自动发送设定好的消息
3》循环控制使用
设计代码:
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
Private Declare Function GetWindowTextLength Lib "user32" Alias "
GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDLAST = 1
Private Const GW_HWNDNEXT = 2
Private Const GW_HWNDPREV = 3
Private Const GW_OWNER = 4
Private Const NILL = 0&
Private Const WM_SYSCOMMAND = &H112
Private Const SC_CLOSE = &HF060&
Function GetWin() As String
Dim NhWnd As Long
Dim Length, WinTitle$
Dim OkWin As String
NhWnd = GetWindow(hwnd, GW_HWNDFIRST)
While NhWnd <> 0
Length = GetWindowTextLength(NhWnd)
WinTitle$ = Space$(Length + 1)
Length = GetWindowText(NhWnd, WinTitle$, Length + 1)
If InStr(LCase(WinTitle$), "发送消息") > 0 Or InStr(LCase(WinTitle$), "聊
天中") > 0 Then
OkWin = OkWin & "\\" & NhWnd
End If
NhWnd = GetWindow(NhWnd, GW_HWNDNEXT)
Wend
GetWin = OkWin
End Function
Sub SendInfo(ByVal Info As String)
Dim OkWin, hCount
OkWin = GetWin()
'MsgBox OkWin
If Len(OkWin) > 0 Then
OkWin = Split(OkWin, "\\")
For hCount = 0 To UBound(OkWin)
If Len(OkWin(hCount)) > 0 Then
'MsgBox OkWin(hCount)
'MsgBox GetWinName(OkWin(hCount))
AppActivate GetWinName(OkWin(hCount))
SendKeys Info
SendKeys "%(s)"
End If
Next
End If
End Sub
Function GetWinName(ByVal WinID As Long) As String
If WinID < 1 Then Exit Function
Dim Length, WinTitle$
Length = GetWindowTextLength(WinID)
WinTitle$ = Space$(Length + 1)
Length = GetWindowText(WinID, WinTitle$, Length + 1)
GetWinName = WinTitle$
End Function
Private Sub Form_Load()
Me.Hide
Me.Move -100, -100, 0, 0
End Sub
Private Sub Timer1_Timer()
Call SendInfo("/mn 你看看我的大作发表了 /ka http://plmmm.k666.com 看看怎么样
/hx ,记得回帖哦! /mg /wen")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -