开发者

Register Global Hotkey in Windows CE

开发者 https://www.devze.com 2023-04-05 21:02 出处:网络
i search for a method to register for a global hotkey, so i can trigger a method when the key gets pre开发者_开发知识库ssed.

i search for a method to register for a global hotkey, so i can trigger a method when the key gets pre开发者_开发知识库ssed.

It needs to work with Windows CE and Windows Mobile >=5.

[EDIT: It also needs to work when the application is hidden and/or the form has no focus]


If RegisterHotKey fails to do what you want for some reason, put in a keyboard hook. Hooks aren't "officially" supported, but for the keyboard they work just fine.


You can use RegisterHotKey function defined in coredll. On the devbuzz forum you can find a post called: code for c# hotkey register/unregister which shows an implementation

Another method is to run a separate thread and call GetAsyncKeyState in a loop with an acceptable Sleep time. GetAsyncKeyState should be independent of keyboard focus.


You can use RegisterHotKey function

Note: This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号