QQ自动发信息的代码.docx
《QQ自动发信息的代码.docx》由会员分享,可在线阅读,更多相关《QQ自动发信息的代码.docx(17页珍藏版)》请在冰豆网上搜索。
![QQ自动发信息的代码.docx](https://file1.bdocx.com/fileroot1/2023-1/11/958d5f66-1e12-4cd2-8fef-d81c98218c85/958d5f66-1e12-4cd2-8fef-d81c98218c851.gif)
QQ自动发信息的代码
QQ自动发信息的代码
VFPCODE:
DECLAREINTEGERFindWindowExINuser32;
INTEGERhwndParent,;
INTEGERhwndChildAfter,;
STRING@lpszClass,;
STRING@lpszWindow
DECLAREINTEGERGetForegroundWindowINuser32
DECLAREINTEGERSendMessageINuser32INTEGER,INTEGER,INTEGER,STRING@
DECLAREINTEGERGetClassNameINuser32INTEGER,STRING@,INTEGER
DECLAREINTEGERGetWindowINuser32;
INTEGERhwnd,;
INTEGERwFlag
BM_CLICK=0xF5
EM_REPLACESEL=0xC2
SendMg='
qqHwnd=GetForegroundWindow()&&得到当前窗口句柄
ClassName=REPLICATE(CHR(0),255)
GetClassName(qqHwnd,@ClassName,LEN(ClassName))&&窗口类型
IFALLTRIM(ClassName)='#32770'&&初步判定是否是聊天窗口
FirstHwnd=findWindowEx(qqHwnd,0,"#32770",NULL)&&获得第一个子窗口
IFFirstHwnd<>0
SendHwnd=FindWindowEx(FirstHwnd,0,"Button","发送(S)")&&获得发送按钮句柄
IFSendHwnd<>0
ListHwnd=findWindowEx(FirstHwnd,0,"RichEdit20A",NULL)&&获得聊天记录窗口句柄
EditHwnd=GetWindow(GetWindow(ListHwnd,2),5)&&根据聊天记录窗口得到输入窗口句柄
IFEditHwnd<>0
SendMessage(EditHwnd,EM_REPLACESEL,0,SendMg)&&往输入框自动发送消息
SendMessage(SendHwnd,BM_CLICK,0,0)&&自动按下'发送'按钮
ENDI
ENDI
ENDI
ENDI
把代码放入timer控件,定时发送即可,注意发送间隔不要太快哦!
如果要想隐蔽发送,我们可以先把捕获的窗口句柄记录下来,并且把聊天记录框的信息记录下来,然后检测其是否处于最小化状态,最小化状态我们可以通过WM_SIZE消息来得到,如果是那么就自动发送,发送后把聊天记录框的内容还原,这样等打开最小化的聊天界面时就不会被察觉是否被发送过消息了。
顺便说下,要想写QQ尾巴代码只需要判断下QQ聊天窗口所处于的状态顺便拦截下发送状态并且发送后再把发送痕迹处理下就可以了
VFP手机短信收发(源代码)
*-----------------------------------------------
* 手机短信收发(仅供参考,不同手机需要稍微修改代码)
**红雨(提供)
*说明:
1、手机数据线连接电脑可以直接收发。
2、红外线的要装一个虚拟串口软件
*-----------------------------------------------
Clear
SetSafetyOff
SetTalkOff
*-----------------------------------------------
*发送短信测试
?
[发送:
],SendSMSMessage([13000000000],[VFP发送测试],3)
Return
*-----------------------------------------------
*读取短信测试
IfUsed([TSMSMessage])
UseInTSMSMessage
Endif
?
[读取:
],ReadSMSMessage([TSMSMessage],3)
Return
*-----------------------------------------------
*删除短信测试
IfUsed([TSMSMessage])
LocallcDelList
lcDelList=[]
SelectTSMSMessage
Scan
lcDelList=lcDelList+[,]+Alltrim(Str(nMark))
Endscan
?
[删除:
],DeleteSMSMessage(lcDelList,3)
Endif
Return
*-----------------------------------------------
*读取手机短信
*-----------------------------------------------
FunctionReadSMSMessage(tcCursName,tnComPort)
tcCursName=Iif(Type([tcCursName])=[C]And!
Empty(tcCursName),tcCursName,[TSMSMessage]+Sys(2015))
tnComPort=Iif(Type([tnComPort])=[N]AndBetween(tnComPort,1,9),Int(tnComPort),3)
LocalIsOK,loMSComm,lcReadData
IsOK=.F.
*打开串口
loMSComm=OpenSMSComm(tnComPort)
IfType([loMSComm])=[O]And!
Isnull(loMSComm)AndloMSComm.PortOpen
*读取短信
lcReadData=SendStrAndGetData(loMSComm,[AT+CSCS="GSM"],5) &&+CSCS:
("IRA","GSM","UCS2")
If[OK]$lcReadData
lcReadData=SendStrAndGetData(loMSComm,[AT+CMGF=0],5)
If[OK]$lcReadData
lcReadData=SendStrAndGetData(loMSComm,[AT+CMGL=0],5)
If[OK]$lcReadData
lcReadData=SendStrAndGetData(loMSComm,[AT+CMGL=4],30)&&0未读1已读2待发3已发4全部
If[OK]$lcReadData
IsOK=.T.
lcReadData=Strt(lcReadData,[OK],[+CMGL:
])
LocallnHead,lcHead,lnInfo,lcInfo,liInfo
lnHead=18
lcHead=[+CMGL:
]
lnInfo=Occu([+CMGL:
],lcReadData)-1
CreateCurs(tcCursName)(nMarkI,cReadC(4),cPhoneC(20),tTimeT,cTextC(250) )
IflnInfo>0
ForliInfo=1TolnInfo
lcInfo=Strt(Subs(lcReadData,At(lcHead,lcReadData,liInfo),At(lcHead,lcReadData,liInfo+1)-At(lcHead,lcReadData,liInfo)),lcHead,[])
m.nMark=Val(Subs(lcInfo,1,At([,],lcInfo,1)-1))
LocallnRead
lnRead=Val(Subs(lcInfo,At([,],lcInfo,1)+1,At([,],lcReadData,2)-At([,],lcReadData,1)-1))
m.cRead=Iif(lnRead=0,[未读],Iif(lnRead=1,[已读],Iif(lnRead=2,[待发],Iif(lnRead=3,[已发],[未知]))))
LocallnIlen
lnIlen=Val(Subs(lcInfo,At([,],lcInfo,3)+1))*2+18
lcInfo=Subs(lcInfo,At(Chr(13),lcInfo)+2,lnIlen)
LocallnSerPhone,liSerPhone,lcSerPhone,lnSerPhlen
lnSerPhone=Evaluate([0x]+Left(lcInfo,2))*2
lcSerPhone=Subs(lcInfo,3,lnSerPhone)&&除去前面的[08]
lcSerPhone=Subs(lcSerPhone,3) &&除去前面的[91]
lcSerPhone=Strt(lcSerPhone,[F],[]) &&除去中间的[F]
lnSerPhlen=Ceiling(Len(lcSerPhone)/2)
m.cSerPhone=[]
ForliSerPhone=1TolnSerPhlen
m.cSerPhone=m.cSerPhone+ Subs(lcSerPhone,2*liSerPhone,1)+Subs(lcSerPhone,2*liSerPhone-1,1)
Endfor
LocallnPhoto,liphone,lcPhone,lnPhlen
lnPhoto=2+lnSerPhone+Iif(lnRead<2,2,4)
lnPhlen=Evaluate([0x]+Subs(lcInfo,lnPhoto+1,2))
lnPhoto=2+lnSerPhone+Iif(lnRead<2,6,8)
lcPhone=Strt(Subs(lcInfo,lnPhoto+1,Iif(Mod(lnPhlen,2)=0,lnPhlen,lnPhlen+1)),[F],[])
lnPhlen=Ceiling(Len(lcPhone)/2)
m.cPhone=[]
ForliPhone=1TolnPhlen
m.cPhone=m.cPhone+ Subs(lcPhone,2*liPhone,1)+Subs(lcPhone,2*liPhone-1,1)
Endfor
LocallnCodeType,lcCodeType
lnCodeType=lnPhoto+lnPhlen*2
lcCodeType=Subs(lcInfo,lnCodeType+1,4)
LocallnTime,liTime,lcTime,lcTemp
lcTemp=Iif(lnRead<2,[20],[])
lnTime=lnPhoto+lnPhlen*2+4
lcTime=Subs(lcInfo,lnTime+1,Iif(lnRead<2,10,0))
ForliTime=1To5
lcTemp=lcTemp+ Subs(lcTime,2*liTime,1)+Subs(lcTime,2*liTime-1,1)
Endfor
m.tTime=Ctot(Transform(lcTemp,[@R9999.99.9999:
99:
99]))
lnText=lnTime+Iif(lnRead<2,10+4,0+2)
IflcCodeType=[0008]
lnTlen=Evaluate([0x]+Subs(lcInfo,lnText+1,2))*2
m.cText=SMSDeCodeChina(Subs(lcInfo,lnText+2+1,lnTlen))
Else
lnTlen=Evaluate([0x]+Subs(lcInfo,lnText+1,2))
lnTlen=2*(Int(lnTlen/8)*7+Mod(lnTlen,8))
m.cText=SMSDeCodeEnglish(Subs(lcInfo,lnText+2+1,lnTlen))
Endif
Select(tcCursName)
AppeBlan
GathMemv
Endfor
Endif
Endif
Endif
Endif
Endif
*--关闭串口
=CloseSMSComm(loMSComm)
Endif
ReturnIsOK
Endfunc
*-----------------------------------------------
*删除手机短信
*-----------------------------------------------
FunctionDeleteSMSMessage(tcNumbList,tnComPort)
tnComPort=Iif(Type([tnComPort])=[N]AndBetween(tnComPort,1,9),Int(tnComPort),3)
LocallcNotDeleteList,loMSComm,lcDeleStr,lcRetuStr,liList
lcNotDeleteList=tcNumbList
*打开串口
IfType([tcNumbList])=[C]And!
Empty(tcNumbList)
loMSComm=OpenSMSComm(tnComPort)
IfType([loMSComm])=[O]And!
Isnull(loMSComm)AndloMSComm.PortOpen
lcNotDeleteList=[]
tcNumbList=[,]+tcNumbList+[,]
ForliList=1ToOccurs([,],tcNumbList)
lcDeleStr=Allt(Getwordnum(tcNumbList,liList,[,]))
If!
Empty(lcDeleStr)
lcRetuStr=SendStrAndGetData(loMSComm,[AT+CMGD=]+lcDeleStr,10)
If!
[OK]$lcRetuStr
lcNotDeleteList=lcNotDeleteList+[,]+lcDeleStr
Endif
Endif
Endfor
Endif
*--关闭串口
=CloseSMSComm(loMSComm)
Endif
ReturnlcNotDeleteList
Endfunc
*-----------------------------------------------
*发送手机短信
*-----------------------------------------------
FunctionSendSMSMessage(tcToPhone,tcMessage,tnComPort)
tcToPhone=Iif(Type([tcToPhone])=[C],tcToPhone,[])
tcMessage=Iif(Type([tcMessage])=[C],tcMessage,[])
tnComPort=Iif(Type([tnComPort])=[N]AndBetween(tnComPort,1,9),Int(tnComPort),3)
LocalIsOK,loMSComm
IsOK=.F.
If!
Empty(tcToPhone)And!
Empty(tcMessage)
*打开串口
loMSComm=OpenSMSComm(tnComPort)
IfType([loMSComm])=[O]And!
Isnull(loMSComm)AndloMSComm.PortOpen
*初始化手机
IfMobileInit(loMSComm)
*发送短信
LocallcSerCPhone,lnSerCPhone,lcSendPhon