VS.net 2005 MFC QQ 2006 & TM 2006 消息发送 简单核心代码

本文提供了一段使用VS.net2005与MFC实现的QQ2006和TM2006消息自动发送的核心代码。该代码通过查找并操作目标窗口来实现消息的输入及发送功能,适用于即时通讯软件。

VS.net 2005 MFC QQ 2006 & TM 2006 消息发送 简单核心代码

 1None.gifvoid SendQQMsgDlg::SendQQmsg()
 2ExpandedBlockStart.gifContractedBlock.gifdot.gif{
 3InBlock.gif    CString Str,Info;
 4InBlock.gif    CWnd* QQ=AfxGetMainWnd()-> GetWindow(GW_HWNDFIRST);
 5InBlock.gif    while(QQ)
 6ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 7InBlock.gif        QQ->GetWindowTextW(Str);                
 8InBlock.gif        if(Str.Find(_T("")) > -1)
 9ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
10InBlock.gif            QQWindows=QQ;
11InBlock.gif            ((CWnd*)GetDlgItem(IDC_STATIC))->SetWindowTextW(Str);
12InBlock.gif            this->QQHideWindows=this->QQWindows->FindWindowExW(this->QQWindows->m_hWnd
13InBlock.gif                ,NULL,_T("#32770"),NULL);
14InBlock.gif            AfxWnd42=QQHideWindows->FindWindowExW(QQHideWindows->m_hWnd,NULL,_T("AfxWnd42"),NULL);
15InBlock.gif            RichEdit=AfxWnd42->FindWindowExW(AfxWnd42->m_hWnd,NULL,_T("RICHEDIT"),NULL);
16InBlock.gif            if(RichEdit)
17ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
18InBlock.gif                ((CWnd*)GetDlgItem(IDC_TEXT))->GetWindowTextW(Info);
19InBlock.gif                CRichEditCtrl *QQRcihEdit=(CRichEditCtrl*)(CWnd::FromHandle(RichEdit->m_hWnd));
20InBlock.gif                QQRcihEdit->ReplaceSel(Info);
21ExpandedSubBlockEnd.gif            }

22InBlock.gif            else
23ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
24InBlock.gif                return;
25ExpandedSubBlockEnd.gif            }

26InBlock.gif            SendBu=QQHideWindows->FindWindowExW(QQHideWindows->m_hWnd,NULL,NULL,_T("发送(&S)"));
27InBlock.gif            if(SendBu)
28ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
29InBlock.gif                SendBu->SendMessage(BM_CLICK);
30InBlock.gif                ((CWnd*)GetDlgItem(IDC_TEXT))->SetWindowTextW(_T(""));
31ExpandedSubBlockEnd.gif            }

32InBlock.gif            else
33ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
34InBlock.gif                return;
35ExpandedSubBlockEnd.gif            }

36ExpandedSubBlockEnd.gif        }

37InBlock.gif        QQ=QQ->GetWindow(GW_HWNDNEXT);        
38ExpandedSubBlockEnd.gif    }

39ExpandedBlockEnd.gif}
这个版本适合目前的QQ & TM,原理适合所有的即使聊天软件.

转载于:https://www.cnblogs.com/LIfelse/archive/2006/01/25/QQSendMsg.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值