Detect StylusDown outside app window

雨燕双飞 提交于 2019-12-11 06:36:41

问题


Simple question, hope the answer won't be: "You cant" :-)

How (in code) can I subscribe to a "global" stylus down event. Windows 7 obviously does it in some way, as the little tablet icon appears as soon as I use the stylus (wacomm pen and touch, but this seems irrelevant).

I want to create a simple drawing app which runs silently in the background (perhaps a small taskbar icon) and pops up as soon as I pick up the stylus and start drawing..

I am able to do all these things with a window, but the StylusDown is an attached UI property. Is there some global property?

A semi transparent window overlaying all of my desktop all the time is not "really" an alternative..

Chris


回答1:


Short :

You can't. :-)

Long:

You way use p/invoke to call the windows API function GetCursorPos.

[DllImport("user32.dll")]
public static extern bool GetCursorPos(out Point pt);

You may want to call this function periodically with a timer to be up to date.



来源:https://stackoverflow.com/questions/1511682/detect-stylusdown-outside-app-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!