stlab.adobe.com Adobe Systems Incorporated

message_handler_t Class Reference

#include <windows_message_handler.hpp>

List of all members.

Classes

struct  property_t

Public Types

typedef boost::function
< LRESULT(HWND window, UINT
message, WPARAM wparam, LPARAM
lparam, WNDPROC next_proc)> 
callback_t

Public Member Functions

template<const char * ProcName>
void install (HWND window)
bool is_installed () const
 message_handler_t (callback_t callback=callback_t())
void set_callback (callback_t callback)
void uninstall ()
 ~message_handler_t ()

Detailed Description

Class that manages a message handling function attched to a win32 HWND.

Definition at line 30 of file windows_message_handler.hpp.


Member Typedef Documentation

typedef boost::function<LRESULT (HWND window, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC next_proc)> callback_t

Function prototype for the message handling function.

Parameters:
windowHWND that received the message
messagewin32 message sent to the window
wparamwparam argument sent with the message
lparamlparam argument sent with the message
next_procthe next WNDPROC in the handler chain; can be invoked with CallWindowProc to chain to the next handler
Returns:
LRESULT to be returned from the WNDPROC.

Definition at line 43 of file windows_message_handler.hpp.


Constructor & Destructor Documentation


Member Function Documentation

void install ( HWND  window )

Attach the message handler to the window with a specific string handle. A given string handle can be attached to a window at most once, attempting to re-install a handler with the same string handle on a given window is an error. Attempting to install a message handler to two windows at the same time is an error.

Note that the ProcName template argument is a const char*, which requires a very specific coding style to be used by clients. The string being passed must be staticly defined, but cannot be a string literal, as the following example demonstrates: extern const char my_proc_name_k[] = "my-unique-proc-name";

message_handler_t handler(&my_handler_func); handler.install<my_proc_name_k>(my_hwnd);

Definition at line 66 of file windows_message_handler.hpp.

bool is_installed (  ) const

Definition at line 71 of file windows_message_handler.hpp.

void set_callback ( callback_t  callback )

Definition at line 74 of file windows_message_handler.hpp.

void uninstall (  )

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google