PreTranslateMessage is not called during secondary modal loop. Don't look
for your messages there. Just add a handler to your FrameWnd, and you'll see
it there. In other words, the simplest way (ON_MESSAGE) solves your problem.
No need to kludge a message hook.
hi,
I did all the recommended things:
a. Tried posting directly to a Window, In my Case a CFrameWnd derived
class,
b. Used WM_APP based definition for the messages.
Both cases did not solve my problem.
I put up a message filter Hook, I found my custom message appearing
there, the window handle was also correct.
However during scrolling the custom message just did not appear in
CWinApp derived class's PreTranslateMessage. So the message was not
getting routed to the CFrameWnd derived class.
I ended up using the message filter function to route my message
specifically.
Regards
Chiman
Joseph M. Newcomer wrote:
It wouldn't surprise me that these messages are lost, because you don't
send them
anywhere. I presume you are using ::PostMessage, not CWnd::PostMessage,
because of the
initial meaningless parameter NULL. This causes it to behave like
PostThreadMessage,
which is DOCUMENTED (RTFM) as failing under a variety of conditions, such
as when you are
in a modal loop. Scrolling is an example of a modal loop. If you have a
CWnd* reference
to the window, call CWnd::PostMessage; if all you have is an HWND, use
it! But don't use
NULL. You can't PostThreadMessage to a GUI thread that has user-visible
elements. So
your code is incorrect, and will not work correctly until you fix it.
Also, you should consider using WM_APP messages or better still
Registered Window
Messages.
joe
On 31 Aug 2006 20:56:59 -0700, "Chimanrao" <chimanrao@gmail.com> wrote:
hi,
In my app when the user scrolls using the scroll bar, I post some
WM_USER based messages to to my main thread loop using the call
PostMessage(NULL,WM_SOME_MSG,wparam,lparam);
Whats happening is that this message is getting lost.
However if the user scrolls using the mouse wheel, this message is
being received.
Does windows handle messages differently while scrolling is on?
Regards
Chiman
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm