Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
457 views
in Technique[技术] by (71.8m points)

c# - Getting WM_TOUCH messages from every window and processing in my APP

I am developing touchscreen application. The goal of the application is when the end user is going to make vertical touch movement (a vertical line with his finger)on the screen on touchscreen device with Windows7 all of the active windows need to minimize (something like show desktop). My question is how can i process all the WM_TOUCH messages that happen everywhere in every window that is active on the desktop. There is no windows hook with which i can take all the WM_TOUCH messages. I tried to use the WH_GETMESSAGE with hope that i can extract the WM_TOUCH messages but is not working, I tried to use the WH_MOUSE_LL and got all the mouse events. There is function GetMessageExtraInfo with which i can see from where the mouse messages is initiated with this code:

if ((GetMessageExtraInfo().ToInt32() & MOUSEEVENTF_FROMTOUCH) == 0xFF515700) { textBoxLog.AppendText("asdada"); } if this is true then the message is initiated by TouchScreen device. This works only with the messages that are sent from my app(my app active window), but not with the mouse messages i am getting from the other windows outside my app window. I am researching this subject for a while and i still can't get any answer. So please if someone knows any way how can i get all the WM_TOUCH messages to my app please respond.

Mihail

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You must hook the global message proc. This way you are the first to get at all the messages. The way you are doing this will not work because your wndproc is only "active" when your windows is active.

Simply create a new wndproc that processes only the messages you want to be global and either allowing them to pass through or cutting them off depending on the logic you want.

http://msdn.microsoft.com/en-us/library/ms644990%28v=vs.85%29.aspx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...