How to compile the QQ account application tool

Source: Internet
Author: User

How to compile the QQ account application tool
Author: ddsoft


We all know that there are a lot of software applications for QQ numbers. You only need to fill in the verification code on the software, you can automatically apply for a QQ, and save it. It simplifies the registration process.


Generally, there are two types of software. One program uses the IE control to fill in data directly to these forms, and the other is what we will talk about today, use the Packet Method to automatically apply for QQ.

Think about the following problems:
1. Where is the GIF image of the verification code? How can I ask the program to get the picture and display it.
2. Analysis and construction of the http request.
Of course, the second is the focus.

Complete the first task first.
We open www.reg.qq.com and have this http request.
2.gif: 2Kx is required to download this attachment, which is automatically deducted from the download.
The text is:
GET: http://captcha.qq.com/getimage? Aid = 1007901 & 0.3621022082160978
Accept :*/*
Referer: http://reg.qq.com/
Accept-Language: zh-CN
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; the http://www.bkjia.com); SLCC2 ;. net clr 2.0.50727 ;. net clr 3.5.30729 ;. net clr 3.0.30729; Media Center PC 6.0 ;. NET4.0E ;. NET4.0C)
Host: captcha.qq.com
Connection: Keep-Alive
---------------------------------------------
Http://captcha.qq.com/getimage? Aid = 1007901 & 0.3621022082160978
Check whether there are two values in this url.
Log on to reg.qq.com again and you will find that the number after aid = has not changed, but the second data has changed.
This is easy to understand, because each login has a different verification code.

But for the first data, take a closer look at the previous package and you will know that 1007901 is generated by GetDay. One day may be added. Haha! But today, no matter how you change the verification code, it will not change.

OK. The GIF image has been obtained.
 
Code:
Char szAccept [] = "Accept: */gif ";
Char szReferer [] = "Referer: http://reg.qq.com/?r=n=r=n ";
CString strBuffer = _ T ("");
CString strRecv = _ T ("");

HINTERNET hSession;
HINTERNET hConnect;
HINTERNET hRequest;
BOOL bReturn = FALSE;
CString str = _ T ("/getimage? Aid = 1007901 & 0.0022421072022002497 ");
// Previously used Socket, and now uses Wininet APIs to establish a link
HSession = InternetOpen ("InetAll", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
HConnect = InternetConnect (hSession, "captcha.qq.com", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1 );
HRequest = HttpOpenRequest (hConnect, "GET", str, NULL, "http://reg.qq.com/", (PCSTR *) szAccept, INTERNET_FLAG_RELOAD, 1 );

// Submit a Data Form
 
BReturn = HttpSendRequest (hRequest, NULL,-1, NULL, 0 );
If (! BReturn)
{
MessageBox ("failed to send Http request! "," Prompt ", MB_ICONERROR | MB_ OK );
Return FALSE;
}

// The image is generated later.
HFile. Open ("temp. dat", CFile: modeWrite | CFile: modeCreate, NULL );

InternetReadFile (hRequest, szRecvBuf, 1024, & dwNumberOfBytesRead );
 
}
1.2 How can I display this image in the VC dialog box.
This article describes how to implement the above functions by using the OLE method of the COM interface.
To use the COM interface of IPicture, the main interfaces are IPicture and IPictureDisp. The latter is derived from the IDispatch interface for automatic access to image attributes. Image objects also support the external interface ipropertypolicysink, so that users can make decisions when the image attributes change. The image object also supports the IPersistStream interface, so it can save and load itself from an instance object of an IStream interface, and the IStream interface also supports data reading and writing of the stream object.

We can use the OleLoadPicture function to load images from a stream containing image data. This function simplifies the process of creating a stream-based image object. You can create a new image object and initialize it with the content in the stream. Its function prototype is:

STDAPI OleLoadPicture (IStream * pStream, // pointer to a stream containing image data
LONG lSize, // number of bytes read from the stream
BOOL fRunmode, // initial value corresponding to image attributes
REFIID riid, // Interface ID involved, which describes the type of the interface pointer to be returned
VOID ppvObj // address of the interface pointer variable used in rrid );

First put the image data into the memory

Code:
Bool CQQ number application tool Dlg: LoadPic (CString m_path)
{
IStream * pStm;
CFileStatus fstatus;
CFile file;
LONG cb;
If (file. Open (m_path, CFile: modeRead) & file. GetStatus (m_path, fstatus) & (cb = fstatus. m_size )! =-1 ))
{
HGLOBAL hGlobal = GlobalAlloc (GMEM_MOVEABLE, cb );
LPVOID pvData = NULL;
If (hGlobal! = NULL)
{
If (pvData = GlobalLock (hGlobal ))! = NULL)
{
File. Read (pvData, cb );
GlobalUnlock (hGlobal );
CreateStreamOnHGlobal (hGlobal, TRUE, & pStm );
}
}
}
Return TRUE;
}

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.