gpt4 book ai didi

c# - 错误 : Could not register Hot Key using c#

转载 作者:太空狗 更新时间:2023-10-29 20:29:13 25 4
gpt4 key购买 nike

我正在使用以下代码使用 C# 注册热键。但有时我会抛出异常“无法注册热键”。这个错误的原因是什么?并且因为不一致。我该如何处理?

     public void RegisterHotKey(ModifierKeys modifier, Keys key)
{
// increment the counter.
_currentId = _currentId + 1;

// register the hot key.
if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key))
throw new InvalidOperationException("Couldn’t register the hot key.");
}

最佳答案

阅读我遇到的 RegisterHotKey 的 MSDN 描述:

如果为热键指定的击键已被另一个热键注册,RegisterHotKey 将失败。

Ref

关于c# - 错误 : Could not register Hot Key using c#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3465731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com