Summary In a Windows system environment, the QQ message transmission process is used to simulate the QQ message transmission process using the message driver mechanism of the operating system.
Keyword QQ Message Group Fair Software Analog Message Cycling SPY
I. Introduction
QQ has been the most remarkable timely communication software in China. In the past six years, it has made it a "world first" name in the IM market. In the domestic market, QQ market share has exceeded 70%, the user group is huge, I am a user of Tencent QQ. I don't know if QQ members can send groups, but I can't enjoy this service, I will send my colleagues and friends. Online Google, find a few small software, but add an advertising tail after the message. Still do yourself:
If you want to analyze Tencent QQ protocol to write a QQ message is a complicated thing, then have there be a simple way? The answer is yes: there is!
Since Windows uses a message loop to handle the input information, if we can use the program to generate "Message issued by the Mouse and Keyboard Operation", you should be able to send QQ messages, which will send QQ messages in batches, that is Group.
two
,Implementation
When QQ sends a message to a person, the window shown below (dialog window) is created, and our message is to fill in the message content, then click Send. To simulate the QQ message, we need to fill in the message content, then the analog key is sent.
The first step is to find the chat main window. The title of the window is to chat with *****, we can find this window by using the FindWindowEx function.
Step 2, find the control of the input message and fill in the message inside. Note: It may be that Tencent has set a few windows in the window. If you are interested, you can use Microsoft's tool Spy yourself. By using Spy observation, it is found that the control is a RicheDit class. If the location is shown above, we still use the FindWindowEx function to find it, then get the pointer, through the pointer to some data.
In the third step, the operation of the mouse point sends a button can be used by obtaining the pointer of the button, and then sending a BM_Click message.
Through the simulation, it is very good. To create a simple dialog program with VC6, add a button (change the CAPTION value to send), fill the execution code for the button:
void CMySMSDlg :: QQSendMessage () {CString str; CWnd * pMainWnd = AfxGetMainWnd () -> GetWindow (GW_HWNDFIRST); while (pMainWnd) {HWND hWnd, hNext; hWnd = pMainWnd-> m_hWnd; pMainWnd-> GetWindowText (str); IF (Str.Find)> - 1) {// find chat main window begin // find richedit hwnd = findwindowex (pmainwnd-> m_hwnd, null, "# 32770", null); PMainWnd = CWnd :: FromHandle (hWnd); hWnd = FindWindowEx (pMainWnd-> m_hWnd, NULL, "AfxWnd42", NULL); CWnd * pChildWnd = CWnd :: FromHandle (hWnd); int nLen = str.GetLength (); hNext = FindWindowEx (pChildWnd- > m_hwnd, null, "richedit", null); if (hnext) {// find message fill in control cricheditctrl * prich = (cricheditctrl *) (CWnd :: fromHandle (HNEXT)); prote-> getWindowText (str); prote -> setsel (Nlen, Nlen); Prich-> ReplaceSel ("Yucheng Foreign Language School Huang Dong"); // Fill in the content you want to send} else return; // find message send button hWnd = findwindowex (pmainwnd-> m_hwnd, NULL, NULL, NULL); While (hwnd) {pchildwnd = cWnd :: fromHandle (hwnd); pchildwnd-> getWindowText (STR); if (Str.Find)> - 1) {PchildWnd-> SendMessage BM_Click); // Send Return; // Exit} hWnd = findwindowex (PMainWnd-> M_HWND, HWND, NULL, NULL);} return;} // find chat main window ELSE PMAINWND = PMainWnd-> getWindow (gw_hwndnext); // Continue to find} // While To this, the main components have been implemented. How to make the program automatically open the chat window for each friend, and this is not too much, leaving you to study, this idea is suitable for all IM software.
The program is compiled under VC6 (the file is small, only 20KB), the operating system is Windows 2000 SP4, the QQ version is 2004 SP1, and you need to open a chat window before pressing the Send button.