MIL_ID BufferId, | //in |
MIL_INT HookType, | //in |
MIL_BUF_HOOK_FUNCTION_PTR HookHandlerPtr, | //in |
void *UserDataPtr | //in |
This function allows you to attach or detach a user-defined function to a specified buffer event (for example, a modification to the buffer's contents). Once a hook-handler function is defined and hooked to an event, it is automatically called when the event occurs.
You can hook more than one function to an event by making separate calls to MbufHookFunction() for each function that you want to hook. MIL automatically chains and keeps an internal list of all these hooked functions. When a function is hooked, this new function is added to the end of the list. When the event happens, all user-defined functions in the list will be executed in the same order that they were hooked to the event. You can also remove any function from the list; in this case, MIL preserves the order of the remaining functions in the list.
Specifies the buffer event to which to hook the function. This parameter can be set to following value:
For specifying the buffer
event
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_MODIFIED_BUFFER + |
Calls the hook-handler function each time the specified buffer is modified by a MIL function. |
You can add the following value to the above-mentioned value to set whether to detach the hook-handler function.
For M_MODIFIED_BUFFER
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_UNHOOK |
Unhooks the specified function if hooked to an M_MODIFIED_BUFFER event. |
Specifies the address of the function that should be called when the specified event occurs. The hook-handler function must be declared as follows:
Upon successful completion, the hook-handler function should return M_NULL. Note MFTYPE and MIL_BUF_HOOK_FUNCTION_PTR are reserved MIL predefined types for functions and data pointers.
Type of buffer event that generated the call.
Event identifier to pass to MbufGetHookInfo() when inquiring about the hooked event.
User data pointer that was passed (as UserDataPtr) to MbufHookFunction().
Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if not used.
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |