Tomas,
Non window classes such as the CWinApp object can only handle special
categories of messages that MFC routes to non-window classes.
You can post user defined messages to windows - such as the main frame
window.
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.
could someone tell how to send custom message to CWinApp derived objec. I
tied this:
#define MYMSG (WM_APP + 1)
...
ON_MESSAGE(MYMSG, DoSomething)
...
SendMessage(MYMSG);
This not works- object didn't handle this message.
Should i use ON_THREAD_MESSAGE and PostThreadMessage(...) instead?
Thans in advance
--
Tomas Butkus
I have not done this, but I think that all posted messages to your
application can be trapped in CWinApp::PreTranslateMessage(). Return
TRUE if you handle the message or call the base class if you do not. You
can post the message itself to the main window.
Or you can send/post a "fake command message" using WM_COMMAND and use
WPARAM/LPARAM to identify the message.
You can also use PostThreadMessage(), but these messages can be lost if
a modal dialog or message box is opened before the message is processed.
Actually I think it is strange that MFC did not implement a
CWinApp::SendMessage/PostMessage capability.
But if you want to send, rather than post, the message, why not just
call a function in your CWinApp derived class?
HTH,
David Wilkinson
--
Ajay Kalra
ajay...@yahoo.com
Microsoft VC++/MFC MVP
Note: Please post all replies to newsgroup only.
Tomas Butkus <tom...@nomagiclt.com> wrote in message
news:O1FIW#1x$GA.277@cppssbbsa04...