Compilation of QQ pet star watching game Auxiliary Tools

Source: Internet
Author: User

Recently, a friend asked me to help him hook up his QQ pet, so he went to play the game. Other Games were not easy to write a helper tool at my level. This is only a little simpler for the star watching game. The operation of this game is very simple. after entering the game, there are two windows left and right. The window on the right will provide a map, then you need to set the stars to the correct positions in the left window. Based on the gap between the positions of your stars and the correct positions, you can divide them into three levels: Miss good prefect.

Therefore, I only need to mark the correct position of the stars in the graph on the left. My idea is to display the right image on the left in a translucent way. To achieve this goal, we need to complete the following tasks.

1. Obtain the location of the game window and the relative coordinates of the left and right windows in the game window.

First, use Spy ++ to view the name of the game window and register the window class name.

We can see that the title of the game window is "Penguin community", and the window registration class is twincontrol. so we can find the window and get its coordinates.

Rect qqrec; <br/> hwnd hqqsq; <br/> hqqsq = findwindow ("twincontrol", "Penguin community"); <br/> If (hqqsq = NULL) <br/>{< br/> MessageBox (null, "No window is found. Make sure the game has been started", "sorry", mb_ OK); <br/> return true; <br/>}< br/> getwindowrect (hqqsq, & qqrec );

Then we cut down the game window and use the drawing software to see the relative position of the left and right windows.

2. Create a translucent dialog box.

To display the right image on the left, the easiest way is to create a translucent dialog box on the left, and then set the background of the dialog box to the image on the right. This dialog box is not only translucent, but also penetrating the mouse. That is to say, the mouse clicking will not produce any effect on the dialog box.

Void sethwndtransparent (hwnd) <br/>{< br/> // transparent window and mouse penetration <br/> setwindowlong (hwnd, gwl_exstyle, getwindowlong (hwnd, gwl_exstyle) ^ 0x80000 | ws_ex_transparent); <br/> // No title bar <br/> setwindowlong (hwnd, gwl_style, getwindowlong (hwnd, gwl_style )&(~ Ws_caption); <br/> hinstance HI = loadlibrary ("user32.dll"); <br/> If (HI) <br/>{< br/> typedef bool (winapi * myfunc) (hwnd, colorref, byte, DWORD); <br/> myfunc fun = NULL; <br/> // get the setlayeredwindowattributes function pointer <br/> fun = (myfunc) getprocaddress (HI, "setlayeredwindowattributes"); <br/> If (fun) <br/> fun (hwnd, 0,129, 2); <br/> freelibrary (HI); <br/>}< br/>}

Then, move the newly created dialog box to the corresponding location and place it at the top.

Setwindowpos (HPIC, <br/> hwnd_topmost, // top <br/> 0, 0, 0, <br/> swp_nomove | swp_nosize); <br/> setwindowpos (HPIC, <br/> hwnd_topmost, <br/> qqrec. left + 32, <br/> qqrec. top + 79, <br/> 355, <br/> 402, <br/> swp_nozorder );

3. Drawing on the dialog box

You only need to use a bitblt function in the wm_paint message processing in the dialog box.

HDC = beginpaint (hwnddlg, & PS); <br/> bool result = bitblt (HDC, 0, 0,355,402, <br/> getdc (hqqsq), 424, 79, srccopy); <br/> endpaint (hwnddlg, & PS );

To refresh the dialog box, you only need

Invalidatergn (HPIC, null, false); // set the invalid region <br/> updatewindow (HPIC); // re-paint immediately

Shows the final result.

 

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.