-
First of all, your question is not very appropriate, because the hook function is a ** function, the system specifies the parameters, and passes the parameters, you write the content, and then the system calls it under certain trigger conditions.
For example, if you build a wh mouse hook, then the three parameters of mouseproc are passed by the operating system (actually win32 platform), the meaning is how ncode handles messages, wparam message identification, lparam is a mousehookstruct structure pointer, and what we need to do is to use these three parameters to complete the function we want to achieve, which is the meaning of the ** function!
Generally, there are three functions used to make hooks, and the main solution is the definition of hook functions
1.Create a hook: setwindowshookex, the four parameters are the hook type, the hook function address, the instance handle of the dll where the hook function is located, the id number of the thread you want to monitor after installing the hook, and the return parameter is the hook handle.
2.unhookwindowshookex, which has only one argument, is the hook handle to be unloaded.
3.Hook function (arbitrary name), three parameters, the specific meaning is related to the hook type.
Here's a simple example:
For example, if you want to write a program that displays the name of the window in the main program when the mouse is moved to **.
1) If the mouse is only confined to the window, then the above three functions 1, 2, and 3 are all written in the running main program, for example, function 1 can be written in the message response function when a button is pressed, function 2 can be written in the message response function when the button is released, and function 3 can be written as long as it is not written in other functions, because it is inherently an independent function to be defined.
2) If the mouse can move anywhere on the screen, then the above functions 1 and 2 are the same as (1), but function 3 should be written in a separate dll, because the global hook is installed at this time, in order to achieve the purpose of obtaining the window name, there may be some other work in the dll, such as setting up a shared segment, about these will not be detailed here.
If you want to ask how to populate the parameters of setwindowshookex or the specific meaning of the three parameters of the hook function, then you can refer to msdn, because the parameters are related to the hook type, the message to be hooked.
-
Introduction to several important APIs of Substrate.
function prototype: void hookclassload(string name, hook);
This method implements a notification when a specified class is loaded. Because a class can be loaded at any time, substrate provides a way to detect when a class of interest to the user is loaded.
-
Put a mouse hook.
-
Methods are defined in .
Work with plug-in hooks.
param string $hook hook name.
param mixed $params pass in parameters.
return void
function hook($hook,$params=array())
-
First of all, I don't know how the landlord knows about hooks, if you don't know much about hook knowledge, look at the basic knowledge on the first floor, if you understand, help you explain how to implement hooks and hook functions in the easy language.
First step 1 register the hook: hook handle setwindowshookex (13, & hook function, getmodulehandlea (0), 0).
Here you can see that the second argument makes our hook function, and when it encounters a function pointer parameter, you need to add & before the function name
symbol to indicate that the pointer to the function is passed, and the second step is the hook function: version 2
Subroutines hook functions, integers, arguments icode, integers.
Parameter wparam, integer type.
Argument lparam, integer This is the definition of this function, and this function must be defined in this way, the number and type of parameters.
And the return value must be according to this definition, in this function you can intercept the message, but remember that once you process the message you return 1 to tell the system that the message was intercepted by you, otherwise return callnexthookex (hook handle, icode, wparam, lparam) so that the system can execute other hooks.
The third step is to unhook the hook unhookwindowshookex
Clause. 1. Use graphics software (such as CorelDraw) to make the materials required for dynamic expressions, and export them to jpg format (you can also use the existing ** to combine them yourself). In Photoshop, remove the ** and put it in a folder in order of dynamic expression changes. >>>More
The first way: Replace Samsung i9000 system sound files.
Eliminate the sound of taking pictures with your own camera. >>>More
private sub command1_click()dim i as integer
dim sum as long >>>More
After selecting the main keyword in the excel sorting dialog box, click the option, you can choose the custom sequence as the sorting order, which makes the sorting convenient, fast and easier to control, so how to customize the sorting method for cell text or numbers in excel, let's take a look! >>>More
1.Select **, right-click, select "Add Stocks", and press Ctrl or Shift. >>>More