I have made a general summary of the five types of plug-in. Everyone has a certain understanding of these plugs. Now it is shallow to talk about some of the knowledge of the external production ~~~ ~ First, let's talk about the plug-in plug-in, which is the easiest way to do when I first write.
I still remember that I was still in the "Stone" era, I saw someone hanging a software (plug-in) person, I could go four outdoors (I didn't know how to hang it outside. ^), So I found this software. Over the study (after taking it, he listened to others said that this is a hanging). It is found that this stuff is actually not difficult, and it is not difficult to see that there is no way to go in different places. There is a impulse of this function, then I will take some information on MSDN, I find this kind of function, only a few simple API functions can be done: 1. First we have to know the location of the mouse (for Keep the location of the current mouse) So we will use the API function getCursorpos, which uses the following: BOOL getCursorpos (LPPoint LPPOINT / / Address of Structure for Cursor Position; 2, we move the mouse to the characters Where to go, we will use the SetCursorpos function to move the mouse position, which is as follows: Bool setCursorpos (int X, // horizontal position int y // vertical position); 3, the simulation mouse is issued and put Opening action, we want to use the mouse_event function to implement, use the method of use Next: void mouse_event (DWORD DWFLAGS, // Flags Specifying Various Motion / CLICK VARIANTS DWORD DX, // Horizontal Mouse Position Or Position Change Dword DY, / / vertical mouse position or position change DWORD dwData, // amount of wheel movement DWORD dwExtraInfo // 32 bits of application-defined information); dwFlags in its place, many of the available events such as mobile MOUSEEVENTF_MOVE, left button down MOUSEEVENTF_LEFTDOWN, left Key to let go of MouseEventf_leftup, the specific stuff is still checked MSDN ~~~~~ Ok, with the previous knowledge, we can take a look at the person's removal. GetCursorpos (Point); SetCursorpos (Ranpoint (80, Windowx), Ranpoint (80, Windowy)); // Ranpoint is a homemade random coordinate function mouse_event (MouseEventf_leftdown, 0, 0, 0); mouse_event (MouseEventf_leftup 0, 0, 0, 0); SetCursorpos (Point.x, Point.y); Look at the above code, is it very simple to see the characters ~~, give a three, there are many good things East can be achieved with this skill (I have said, TMD, this is the practice of garbage, I believe it ~~~), next, then look at the automatic attacking practice in the game (required to attack fast Key's), the truth is still the same, just use the API difference ~~~, this time we want to use the keybd_event function, the usage is as follows:
VOID keybd_event (BYTE bVk, // virtual-key code BYTE bScan, // hardware scan code DWORD dwFlags, // flags specifying various function options DWORD dwExtraInfo // additional data associated with keystroke); we have to know the scan code can not be directly Using, you want to use a function mappvirtualkey to turn the key value to the scanning code, the specific usage method of MapVirtualKey is as follows: uint mappvirtualkey (uint ucode, // virtual-key code or scan code uint umaptype // translation to perform); ok, ratio This quick pick is Ctrl A, let us see how the actual code is written: keybd_event (vk_control, mapvirtualkey (vk_control, 0), 0, 0); keybd_event (65, MapVirtualKey (65, 0), 0 , 0); KeyBD_EVENT (65, MapVirtualKey (65, 0), KeyEventf_keyup, 0); KeyBD_Event (VK_Control, MapVirtualKey (vk_control, 0), keyeventf_keyup, 0); First simulate Press the CTRL button, then simulate Press A , Then simulate the A key, finally release the CTRL button, which is a cycle that simulates the shortcut. (Seeing this, almost a certain understanding of the simple exterior ~~~~ Do you try? If you give an imitation, you can have a better Dongdong, this is going to see your comprehension. ~~, but don't be happy too early, this is only starting, there is more complex Dongdong waiting for you ~~) Copyright Description: You can copy, distribute, download this document. However, you may not take it, change this article, or use this article to see any form of interest. Author Blog:
http://blog.9cbs.neet/mprogramer/