MIL_ID GraListId, | //in |
MIL_INT HookType, | //in |
MIL_GRA_HOOK_FUNCTION_PTR HookHandlerPtr, | //in |
void *UserDataPtr | //in |
This function allows you to attach or detach a user-defined function to a specified graphics list event (for example, a modification to the graphics list'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 MgraHookFunction() 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.
Unlike most other functions that modify a MIL object, you can call this function concurrently from multiple threads on the same MIL graphics list (GraListId) without using an M_MUTEX object, as long as all the other parameters of the concurrent calls do not also share data.
Specifies the identifier of the graphics list to which to hook a function. The graphics list must have been previously allocated on the required system using MgraAllocList().
Specifies the graphics list event to which to hook the function. This parameter can be set to one of the following values:
For specifying the graphics list
event
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_GRAPHIC_LIST_MODIFIED + |
Calls the hook-handler function each time the specified graphics list is modified in any way, either by a MIL function or by interactive manipulations. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_GRAPHIC_MODIFIED + |
Calls the hook-handler function each time the specified graphics list's graphics are modified by a MIL function or by interactive manipulations. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_GRAPHIC_SELECTION_MODIFIED + |
Calls the hook-handler function each time a graphic is selected or deselected, either by a MIL function or by interactive manipulations. |
||||||||||||||||||||||||||||||||||||||
M_INTERACTIVE_GRAPHIC_STATE_MODIFIED + |
Calls the hook-handler function each time the specified graphics list's interactive state is modified by a MIL function or by interactive manipulations. |
You can add the following value to the above-mentioned values to set whether to detach the hook-handler function.
For detaching the hook-handler
function
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_UNHOOK |
Unhooks the specified function if hooked to the specified 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:
Type of graphics list event that generated the call.
Event identifier to pass to MgraGetHookInfo() when inquiring about the hooked event.
User data pointer that was passed to the UserDataPtr parameter of MgraHookFunction().
Upon successful completion, the hook-handler function should return M_NULL. Note MFTYPE and MIL_GRA_HOOK_FUNCTION_PTR are reserved MIL predefined types for functions and data pointers.
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. |