Click to See Complete Forum and Search --> : Message for Control, invisible at runtime


jaysunn
April 22nd, 2004, 05:07 AM
Hello ! :wave:

1. Sorry for my English
2. Bloody beginner

3. I have a ATL Full Control, invisible at runtime.

It is placed in a HTML Page with the <OBJECT> Tag.

There is a custom Message:

-----------------------------------------------------
#define MY_TEST (WM_APP + 1)

....

LRESULT OnTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

....

BEGIN_MSG_MAP(CmyClass14)
CHAIN_MSG_MAP(CComControl<CmyClass14>)
DEFAULT_REFLECTION_HANDLER()
MESSAGE_HANDLER(MY_TEST, OnTest)
END_MSG_MAP()
-----------------------------------------------------
OK. Compiles fine.


But how do I Post my Message?

Here is what I tried:

PostMessage(MY_TEST) or
::PostMessage(this->m_hWnd, MY_TEST, 0, 0)
gives me an Assertion failure at runtime with "::IsWindow(hWnd)"
That tells me PostMessage needs a Window. (?)

PostThreadMessage(GetCurrentThreadID(), MY_TEST, 0, 0) or
::PostThreadMessage(GetCurrentThreadID(), MY_TEST, 0, 0)
works, but the message handler OnTest is never called.


What can I do ???