Share via


XR_HOOKPROC (Compact 2013)

3/28/2014

This function receives messages intended for the visual host window. This function is an application-defined callback function, which you can use to monitor or process any windows message that the graphics, windowing, and events subsystem (GWES) sends to the foundation window for the visual host.

The XR_HOOKPROC type defines a pointer to this callback function.

Syntax

BOOL CALLBACK HostHookProc(
    VOID* pv,
    HWND hwnd,
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam,
    LRESULT* pRetVal
);

Parameters

  • pv
    [in] Custom parameter that you define in XRWindowCreateParams.pvUserParam that is passed into this hook procedure.
  • hwnd
    [in] Handle to the window that the message is sent to.
  • Msg
    [in] Specifies the message.
  • wParam
    [in] Specifies additional message information. The contents of this parameter depend on the value of the uMsg parameter.
  • lParam
    [in] Specifies additional message information. The contents of this parameter depend on the value of the uMsg parameter.
  • pRetVal
    [out] Specifies the value to return out of the host WndProc for that message.

Return Value

Returns TRUE if the hook procedure handled the intercepted message. Returns false if you want XAML for Windows Embedded to handle the intercepted message instead.

Remarks

XAML for Windows Embedded uses XR_HOOKPROC internally. HostHookProc is a placeholder for the name of an application-defined function that you implement.

You can implement this callback function to intercept and process windows messages that GWES sends to the foundation window for the visual host. The message-handling code in your hook procedure can process any windows message sent to the window before that window processes it.

For example, you can define a custom object that provides a message-handling routine and pass a handle to that object into XRWindowCreateParams.pvUserParam. Then, in the hook procedure, you can call the methods on the custom object in order to process the messages that the hook procedure intercepts.

If you do not want the visual host to process a particular message after your hook procedure intercepts it, write code to handle that message so that it always returns TRUE. Otherwise, the message-handling code for that message must return FALSE.

If you implement a hook procedure, define the custom callback function in the .h file as follows:

Important

For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.

static BOOL CALLBACK HostHookProc(VOID* pv, HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT* pRetVal);

In the previous code example, HostHookProc represents the function name that you defined for your callback function.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

XAML for Windows Embedded Functions
XRWindowCreateParams