| Customize Help
| Save Settings


Function Map
Hook a function to a sequence event.
void MseqHookFunction(
MIL_ID ContextSeqId, //in
MIL_INT HookType, //in
void *UserDataPtr //in-out

This function allows you to attach or detach a user-defined function to a specified sequence event. 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 MseqHookFunction() 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.

You can obtain more information about the event from within the hook handler function using MseqGetHookInfo().

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.

Specifies the identifier of the sequence context. The sequence context must have been previously allocated using MseqAlloc().


Specifies the sequence event to which to hook the function. This parameter can be set to one of the following values:

function map For specifying the sequence event to which to hook the function
Click to summarizeValue Description
Click to summarize M_FRAME_END +

Hooks the function to the event that occurs when a frame has finished being processed.

Combination value for any of the possible values of the HookType parameter.

You can add the following value to the above-mentioned value to specify to unhook a hooked function.

function map For the HookType parameter
Click to summarizeCombination value Description
Click to summarize M_UNHOOK

Unhooks a hooked function.


Specifies the address of the function that should be called when the specified event occurs.

The hook-handler function, pointed to by HookHandlerPtr, must be declared as follows:

MIL_INT HookType,
MIL_ID EventId,
void *UserDataPtr


Type of event hooked.


Event identifier. You can pass the identifier to MseqGetHookInfo() to inquire about the hooked event.


User data pointer.

Upon successful completion, the hook-handler function should return M_NULL. Note, MFTYPE and MIL_SEQ_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.

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.