Re: wm_touch and wm_gesture Message
"Mao" <Mao@discussions.microsoft.com> wrote in message
news:FC4FFAFC-CEA4-4D78-A884-7DEABFD7B9BA@microsoft.com...
"Note also that the touch input handle in this parameter is no longer
valid
after the message has been forwarded using PostMessage, SendMessage, or
one
of their variants. These functions will close and invalidate this handle."
This refers to the lParam of WM_TOUCH; it becomes invalid after you post the
message again, but it doesn't say you can't PostMessage(WM_TOUCH). In fact,
by saying the above, Microsoft seems to be saying that you *can* call
PostMessage(WM_TOUCH), with the limitation mentioned (that lParam becomes
invalid).
Above is the note in the MS MSDN's wm_touch description, and i had tried
to
directly use postmessage and sendmessage in a button event, just like the
below example,
MESSAGE_MAP
ON_MESSAGE(WM_TOUCH , OnTouch);
void XXXX::OnBnClicked()
{
this->PostMessage(WM_TOUCH , wParam , lParam);
}
the OnTouch function has also been added in my program, but when the
PostMessage transferred the WM_TOUCH message, my onTouch function doestn't
be
triggled. Furthermore, if i changed the WM_TOUCH to any other Message,
like
WM_LBUTTONDOWN, the program processing is also correct(onTouch can be
triggled). So i think whether the wm_touch message can't be directly
triggled
if i have no any touch hardware. Or by other ways to triggle these
message.
Interesting. but if you post WM_LBUTTONDOWN, your app needs to changed to
add ON_WM_LBUTTONDOWN, as this is the appropriate message map entry for that
message. So maybe MFC message map is not set up correctly (although I do
see your code follows the example in
http://msdn.microsoft.com/en-us/library/dd371581%28VS.85%29.aspx).
To eliminate message map, try overriding your class's WndProc() and see if
you get WM_TOUCH there. BTW, I don't have Win 7 SDK installed. What is
WM_TOUCH #define to?
And can you try running your app in another OS besides Windows 7 (that does
not know anything about WM_TOUCH); see if you then receive WM_TOUCH message?
If so, then we know Win 7 somehow treats that message specially. (But I
don't think so, WM_TOUCH is just another predefined windows message).
-- David