C++ Hotkey to run function

谁说胖子不能爱 提交于 2019-12-02 23:52:23

问题


Hey looking to assign F1 as a hotkey to run a function. I have a windows 32 project with a Form, however the form will be in the background and not the active window when I press F1.

Is there a way to code a hotkey or shortcut so when I press F1 it will run that function even if the Form1 isn't active?


回答1:


Have a look at the RegisterHotKey function.

It allows you to define a system-wide hot key. When the hot key is pressed, you will receive a WM_HOTKEY message even if your window is not active.



来源:https://stackoverflow.com/questions/44078608/c-hotkey-to-run-function

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