#include <MboThread.h>
Public Member Functions | |
MboWinMsgHandler (const MboString &strWndClassName="MboWinMsgHandler", bool bStart=true) | |
virtual | ~MboWinMsgHandler () |
virtual HWND | GetHWND () const |
virtual void | Stop () |
virtual LRESULT | ProcessMessage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
virtual LRESULT | ProcessDefault (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
virtual bool | PostMessage (UINT uMsg, WPARAM wParam, LPARAM lParam) |
virtual bool | PostMessage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
virtual HINSTANCE | GetModuleHandle () const |
Protected Member Functions | |
virtual const MboString & | WndClassName () const |
virtual const MboString & | WndTitleText () const |
virtual void | Action () |
virtual void | OnWindowCreated () |
virtual void | MessageHandler (MSG &msg) |
virtual bool | WndCreate () |
virtual bool | WndCalcMetrics () |
virtual void | WndDestroy () |
virtual bool | WndRegister () |
void | AddHWND () |
Protected Attributes | |
HWND | m_hwnd |
const MboString | m_strWndClassName |
Static Protected Attributes | |
static WndClassList | g_vWndClassList |
Friends | |
LRESULT CALLBACK | MboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
This class implementns a windows message handling facility to be used when working in shell or other applications where no message handler and/or message loop is accessible.
When you need to work with visible windows you must register your own class by overriding WndRegister() and most likely WndCreate().
Definition at line 537 of file MboThread.h.
mbo::MboWinMsgHandler::MboWinMsgHandler | ( | const MboString & | strWndClassName = "MboWinMsgHandler" , |
|
bool | bStart = true | |||
) | [explicit] |
The constructor will automatically start the message thread. However it has to wait a small amount of time before it can return.
If you need to need to define your own WndRegister() or WndCreate() methods in a derived class you must call the constructor with param bStart being false
and directly call Start().
strWndClassName | name of message handler | |
bStart | create the class and window and start the message handler thread. |
virtual mbo::MboWinMsgHandler::~MboWinMsgHandler | ( | ) | [virtual] |
Destroy/Release all resources registered and/or created.
virtual HWND mbo::MboWinMsgHandler::GetHWND | ( | ) | const [virtual] |
virtual void mbo::MboWinMsgHandler::Stop | ( | ) | [virtual] |
Generates an WM_DESTROY message for the message handler which triggers a call to the inherited Stop and hence stops the thread. However the method also calls inherited Stop() direct to force message loop termination on next message.
Reimplemented from mbo::MboThread.
virtual LRESULT mbo::MboWinMsgHandler::ProcessMessage | ( | HWND | hwnd, | |
UINT | uMsg, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [virtual] |
Overwrite this handler if you want to handle any message.
hwnd | Handle to the window procedure that received the message. This normally matches m_hwnd. | |
uMsg | Specifies the message received. | |
wParam | Specifies additional message information. The content of this parameter depends on the value of the Msg parameter. | |
lParam | Specifies additional message information. The content of this parameter depends on the value of the Msg parameter. |
Reimplemented in mbo::MboDrawWin.
virtual LRESULT mbo::MboWinMsgHandler::ProcessDefault | ( | HWND | hwnd, | |
UINT | uMsg, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [virtual] |
Handles default messages not handled by ProcessMessage.
hwnd | Handle to the window procedure that received the message. This normally matches m_hwnd. | |
uMsg | Specifies the message received. | |
wParam | Specifies additional message information. The content of this parameter depends on the value of the Msg parameter. | |
lParam | Specifies additional message information. The content of this parameter depends on the value of the Msg parameter. |
virtual bool mbo::MboWinMsgHandler::PostMessage | ( | UINT | uMsg, | |
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [virtual] |
Pass a message to the handler. Internally this method calls PostMessage with hwnd set to m_hwnd.
uMsg | Specifies the message to be posted. | |
wParam | Specifies additional message-specific information. | |
lParam | Specifies additional message-specific information. |
true
. virtual bool mbo::MboWinMsgHandler::PostMessage | ( | HWND | hwnd, | |
UINT | uMsg, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [virtual] |
Pass a message to the handler.
hwnd | Handle to the window whose window procedure is to receive the message. Two values have special meanings: Value Meaning
| |
uMsg | Specifies the message to be posted. | |
wParam | Specifies additional message-specific information. | |
lParam | Specifies additional message-specific information. |
true
. virtual HINSTANCE mbo::MboWinMsgHandler::GetModuleHandle | ( | ) | const [virtual] |
virtual const MboString& mbo::MboWinMsgHandler::WndClassName | ( | ) | const [protected, virtual] |
bStart
parameter of the constructor to false
.
virtual const MboString& mbo::MboWinMsgHandler::WndTitleText | ( | ) | const [protected, virtual] |
virtual void mbo::MboWinMsgHandler::Action | ( | ) | [protected, virtual] |
Message handler
Do this:
Implements mbo::MboThread.
virtual void mbo::MboWinMsgHandler::OnWindowCreated | ( | ) | [protected, virtual] |
Called after the window has been created by WndCreate(). This method may be overwritten in derived GUI classes to perform initial drawing.
Reimplemented in mbo::MboDrawWin.
virtual void mbo::MboWinMsgHandler::MessageHandler | ( | MSG & | msg | ) | [protected, virtual] |
Handle a message by first translating it and then dispatching it.
msg | Message to handle. |
virtual bool mbo::MboWinMsgHandler::WndCreate | ( | ) | [protected, virtual] |
Create an unvisible message window. Called during handler startup.
Reimplemented in mbo::MboDrawWin.
virtual bool mbo::MboWinMsgHandler::WndCalcMetrics | ( | ) | [protected, virtual] |
Register the window and calculate its metrics in case of visible windows of derived classes.
Reimplemented in mbo::MboDrawWin.
virtual void mbo::MboWinMsgHandler::WndDestroy | ( | ) | [protected, virtual] |
Destroy the message window.
Reimplemented in mbo::MboDrawWin.
virtual bool mbo::MboWinMsgHandler::WndRegister | ( | ) | [protected, virtual] |
Register the class used to specify the internally used message handler.
void mbo::MboWinMsgHandler::AddHWND | ( | ) | [protected] |
Add the instance with its identifying HWND to the list of registered windows.
Actually this does:
g_mhwndList[m_hwnd] = this;
LRESULT CALLBACK MboWndProc | ( | HWND | hwnd, | |
UINT | uMsg, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [friend] |
HWND mbo::MboWinMsgHandler::m_hwnd [protected] |
Definition at line 709 of file MboThread.h.
const MboString mbo::MboWinMsgHandler::m_strWndClassName [protected] |
window handle
Definition at line 711 of file MboThread.h.
WndClassList mbo::MboWinMsgHandler::g_vWndClassList [static, protected] |
the window class name as returned by WndClassName()
Definition at line 713 of file MboThread.h.
Hosted on code.google.com | © Marcus Börger | Generated on Fri Jan 18 21:21:13 2008 for MBO-lib by ![]() |