如何在 Windows 中挂钩全局快捷方式?

发布于 2024-07-13 02:48:46 字数 285 浏览 4 评论 0原文

我记得几年前使用过一个程序,它允许我通过自定义伽玛斜坡和其他调整来微调显示器的设置。 它能够为不同的用途创建不同的屏幕设置配置文件,并设置全局热键快捷键来激活它们,而无需退出您所在的程序。

我的问题是,如何为此设置挂钩? 当我只想在一个屏幕上访问桌面而想继续在另一个屏幕上工作时,我厌倦了 WINDOWS-D 最小化所有内容。 (我有 2 个显示器是有原因的!)所以我认为编写一个 Delphi 小应用程序应该不会那么困难,它将最小化一台显示器上的所有内容。 唯一的问题是将其连接到热键。 有谁知道这个 API 是什么?

I remember using a program, some years back, that allowed me to fine-tune my monitor's settings with custom gamma ramps and other adjustments. It had the ability to create different screen-settings profiles for different uses, and setup global hotkey shortcuts to activate them without switching out of the program you're in.

My question is, how do you set up the hook for that? I'm sick of WINDOWS-D minimizing everything when I only want access to the desktop in one screen and I want to keep working in the other one. (I have 2 monitors for a reason!) So I figure it shouldn't be that difficult to hack up a little Delphi app that will minimize everything on one monitor. The only problem is hooking it to a hotkey. Does anyone know what the API is for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴者 2024-07-20 02:48:46

http://www.swissdelphicenter.ch/torry/showcode.php?id=147

基本上分为三个步骤:

注册

// Register Hotkey Win + A
id1 := GlobalAddAtom('Hotkey1');
RegisterHotKey(Handle, id1, MOD_WIN, VK_A);

处理

procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;

{ .... }

// Trap Hotkey Messages
procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
  if Msg.HotKey = id1 then
    ShowMessage('Win + A pressed !');

注销

UnRegisterHotKey(Handle, id1);
GlobalDeleteAtom(id1);

http://www.swissdelphicenter.ch/torry/showcode.php?id=147

Basically there are three steps:

Register

// Register Hotkey Win + A
id1 := GlobalAddAtom('Hotkey1');
RegisterHotKey(Handle, id1, MOD_WIN, VK_A);

Handle

procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;

{ .... }

// Trap Hotkey Messages
procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
  if Msg.HotKey = id1 then
    ShowMessage('Win + A pressed !');

Unregister

UnRegisterHotKey(Handle, id1);
GlobalDeleteAtom(id1);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文