本文介绍了C ++热键运行功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,您希望将分配为运行功能的热键.我有一个带有Form的Windows 32项目,但是当我按时,该表单将在后台而不是活动窗口.

Hey looking to assign 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 .

有没有一种方法可以编写热键或快捷方式,因此,即使Form1处于非活动状态,当我按时,它也会运行该功能?

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

推荐答案

看看 RegisterHotKey 函数.

它允许您定义系统范围的热键.按下热键后,即使您的窗口未处于活动状态,您也会收到一条WM_HOTKEY消息.

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.

这篇关于C ++热键运行功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 07:44