Use VC ++ to create QQ automatic login software

Source: Internet
Author: User
Use VC ++ to create QQ automatic login software[

Recently, during the training at Huawei, the instructors were busy and didn't have much time to teach us. They just showed us the documents and code. After reading the code, they wanted to come up with this. Spy ++ is used to find the title or ID of each window in the QQ logon box.

Principle: in fact, it is not difficult to find the number input and password input boxes in the QQ login box, and then fill in the data.

Enter the data here to send the message to it and simulate the keyboard.

1. Check whether the QQ logon box is enabled. Otherwise, enable it.

// Find the Login Dialog Box of QQ. If QQ is not started, start it first.
Pwnd = findwindow (_ T ("#32770"), _ T ("QQ User Logon "));
If (! Pwnd)
{
Process_information lpprocessinformation;
Startupinfo;
Memset (& startupinfo, 0, sizeof (startupinfo ));
Memset (& lpprocessinformation, 0, sizeof (process_information ));
Startupinfo. cb = sizeof (startupinfo );
Startupinfo. dwflags = startf_forceofffeedback;
Startupinfo. dwx = 0;
Startupinfo. dwy = 0;
Startupinfo. lpdesktop = NULL;
Startupinfo. lpreserved = NULL;
Startupinfo. lpreserved2 = NULL;
Startupinfo. lptitle = NULL;
CreateProcess (_ T ("D: // Tencent // QQ // coralqq.exe"), null, false,
Normal_priority_class, null, null, & startupinfo, & lpprocessinformation );
}

2. After opening and opening, you can obtain the QQ number box and Password box handle.

Note that the QQ Password box is a subwindow of the logon box. You must first find the logon box and then step by step find the QQ Password box. The message is sent to them. The QQ Password box is copied to the clipboard and then sent to wm_paste. However, because the QQ keyboard encryption and protection technology is used, wm_paste cannot be sent, but wm_char messages must be sent through a simulated keyboard, let it receive the password one by one.

If (pwnd)
{
// Obtain the QQ number input box pointer
Ccombobox * pcob = (ccombobox *) pwnd-> getdlgitem (138 );
If (pcob)
{
M_edtcode.setsel (0,-1 );
M_edtcode.copy ();

// Delete the original number and send a copy message to the number input box.
Pcob-> setcursel (0 );
Pcob-> deletestring (0 );
Pcob-> sendmessage (wm_paste, 0, 0 );
}

// Because the QQ Password box is contained in the subwindow in the main window, obtain the subwindow first and then find it one by one.
Cwnd * pcwnd = pwnd-> getnextwindow (gw_child );
Pcwnd = pcwnd-> getnextwindow (gw_hwndnext );
While (pcwnd! = NULL)
{
If (pcwnd) // find
{
Cedit * ppwd = (cedit *) pcwnd-& gt; getdlgitem (16038 );
If (ppwd)
{
Char ckey;
Char Buf [20];
Memset (BUF, 0, sizeof (BUF ));
// Because my program is Unicode, conversion is required here. If not, no conversion is required.
Int iret = widechartomultibyte (cp_acp, wc_compositecheck,
M_strpassword.getbuffer (m_strpassword.getlength ()),
M_strpassword.getlength (), Buf, 20, null, null );

// Clear the Password box
Ppwd-> setsel (0,-1 );
Ppwd-> clear ();
I = 0;

// Send the passwords one by one. The message cannot be copied here, because the QQ Password box cannot be copied.
While (I <iret)
{
Strncpy (& ckey, BUF + I, 1 );
Ppwd-> sendmessage (wm_char, (wparam) ckey, 0 );
I ++;
}
Break;
}
}
Pcwnd = pcwnd-> getnextwindow (gw_hwndnext );
}

3. After filling in the number and password, you can send a click message to log on to QQ.

// After finding the login button, send the message with the mouse clicked
Cbutton * pbtnlogin = (cbutton *) pwnd-& gt; getdlgitem (16032 );
If (pbtnlogin)
{
Pbtnlogin-> postmessage (wm_lbuttondown, 0, 0 );
Pbtnlogin-> postmessage (wm_lbuttonup, 0, 0 );
}

4. You only need to add wm_timer to automatically log on to QQ. As for this, we will not talk about it here.

V. Conclusion:

The technology used here is to send (data) messages to other processes, mainly to find the handle to receive messages from the other processes (SPY ++ is used here ), after finding it, you can send (data) messages to others. For example, I installed a PP for someone else a few days ago, but PP has a browser. As long as you open the PP stuff, it will come out. I think it is very eye-catching and you can send a wm_hide message to it. Others can be used at will!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.