| MIL 10 Reference
| Customize Help
| Save Settings

MdispHookFunction



See also
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Hook a function to a display event.
Syntax
void MdispHookFunction(
MIL_ID DisplayId, //in
MIL_INT HookType, //in
MIL_DISP_HOOK_FUNCTION_PTR HookHandlerPtr, //in
void *UserDataPtr //in
)
Description

This function allows you to attach or detach a user-defined function to a specified display 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 MdispHookFunction() 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 is not available on network displays.

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
DisplayId

Specifies the identifier of the target display.

HookType

Specifies the display event type. This parameter can be set to the following:

function map For specifying the display event type
CollapseValue Description
Collapse M_KEY_CHAR +

Calls the hook-handler function each time the user presses a keyboard key, while the mouse cursor is in the display.

Collapse M_KEY_UP +

Calls the hook-handler function each time the user releases a keyboard key, while the mouse cursor is in the display.

Collapse M_MOUSE_LEFT_BUTTON_DOWN +

Calls the hook-handler function each time the user clicks the left mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_LEFT_BUTTON_UP +

Calls the hook-handler function each time the user releases the left mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_LEFT_DOUBLE_CLICK +

Calls the hook-handler function each time the user double-clicks the left mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_MIDDLE_BUTTON_DOWN +

Calls the hook-handler function each time the user clicks the middle mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_MIDDLE_BUTTON_UP +

Calls the hook-handler function each time the user releases the middle mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_MOVE +

Calls the hook-handler function each time the mouse cursor moves, while in the display.

Collapse M_MOUSE_RIGHT_BUTTON_DOWN +

Calls the hook-handler function each time the user clicks the right mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_RIGHT_BUTTON_UP +

Calls the hook-handler function each time the user releases the right mouse button, while the mouse cursor is in the display.

Collapse M_MOUSE_WHEEL +

Calls the hook-handler function each time the user scrolls the mouse wheel (up or down), while the mouse cursor is in the display.

Combination constant for the values listed in For specifying the display event type.

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

function map For detaching the hook-handler function
CollapseCombination value Description
Collapse M_UNHOOK

Unhooks the specified function if hooked to the specified event.

HookHandlerPtr

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 MFTYPE HookHandler(
MIL_INT HookType,
MIL_ID EventId,
void *UserDataPtr
)
Parameters
HookType

Type of event hooked.

EventId

Reserved for future use.

UserDataPtr

Data pointer that was passed to MdispHookFunction().

Upon successful completion, the hook-handler function should return M_NULL. Note, MFTYPE and MIL_DISP_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; mildisplay.dll.
KEY CHAR KEY UP MOUSE LEFT BUTTON DOWN MOUSE LEFT BUTTON UP MOUSE LEFT DOUBLE CLICK MOUSE MIDDLE BUTTON DOWN MOUSE MIDDLE BUTTON UP MOUSE MOVE MOUSE RIGHT BUTTON DOWN MOUSE RIGHT BUTTON UP MOUSE WHEEL UNHOOK