| Customize Help
| Save Settings

MbufHookFunction



Function Map
Synopsis
Hook a function to a buffer or container event.
Syntax
void MbufHookFunction(
MIL_ID ContainerOrBufId, //in
MIL_INT HookType, //in
MIL_BUF_HOOK_FUNCTION_PTR HookHandlerPtr, //in
void *UserDataPtr //in-out
)
Description

This function allows you to attach or detach a user-defined function to a specified buffer or container 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.

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.
Parameters
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.
Parameters
ContainerOrBufId

Specifies the identifier of the buffer or container.

HookType

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

function map For specifying the buffer event
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_FEATURE_CHANGE +

Hooks the function to the event that occurs when the value of a GenICam feature changes.

To enable an event to occur when the value of a specific feature changes, use MbufControlFeature() with M_FEATURE_CHANGE_HOOK set to M_ENABLE. Repeat for each feature which you want to enable a feature change event. To enable an event to occur when the value of any feature changes, use M_FEATURE_CHANGE + M_ALL.

This setting is only available for hooking to an image buffer.

(summarize)
v
Click to summarize M_MODIFIED_BUFFER +

Calls the hook-handler function at the end of any MIL function that modifies the specified buffer or container.

For a container, this event will occur any time the container is used a destination for a MIL function (unless none of the container's components is modified), any time a component is added to or removed from the container, as well as any time one of the container's components is modified directly using its MIL identifier. The hook-handler function will only be called once per call to a MIL function, unless M_ON_COMPONENT is specified.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Combination value for M_MODIFIED_BUFFER.

You can add the following value to the above-mentioned value to set whether to hook the function to changes in the container's components..

function map For hooking the function to changes in components
Click to summarize
Combination value
Description
Click to summarize M_ON_COMPONENT

Specifies to hook to changes in each component of the container individually, instead of to the container as a whole. When a component of the container changes, the hook function will be called as though it were hooked to that component. Using MbufGetHookInfo() with M_BUFFER_ID within the hook-handler function will return the buffer identifier of the component.

(summarize)
Combination value for M_FEATURE_CHANGE; M_MODIFIED_BUFFER.

You can add the following value to the above-mentioned values to set whether to detach the hook-handler function.

function map For detaching a hook-handler function
Click to summarizeCombination value Description
Click to summarize M_UNHOOK

Specifies to unhook the specified function if it was previously hooked to the specified event.

Combination value for M_FEATURE_CHANGE.

You can add the following value to the above-mentioned value to specify to hook the specified function to all feature change events.

function map For M_FEATURE_CHANGE
Click to summarize
Combination value
Description MIL system-specific
tooltip (‡)
Click to summarize M_ALL

Specifies to hook the specifies function to all feature change events.

v
HookHandlerPtr

Specifies the address of the function that should be called when the specified event occurs. The hook-handler function must be declared as follows:

MIL_INT MFTYPE HookHandler(
MIL_INT HookType,
MIL_ID EventId,
void *UserDataPtr
)

Parameters
HookType

Type of buffer event that generated the call.

EventId

Event identifier to pass to MbufGetHookInfo() when inquiring about the hooked event.

UserDataPtr

User data pointer that was passed (as UserDataPtr) to MbufHookFunction().

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.

UserDataPtr

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.
FEATURE CHANGE MODIFIED BUFFER ON COMPONENT UNHOOK ALL