开发者

Error : Could not register Hot Key using c#

I am using the below code to register hotkeys using c#. But sometimes i get the exception throwing "Couldn’t regi开发者_StackOverflowster the hot key." What will be the reason for this error ? And for not being consistent. How can i handle this ?

     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.");
    }


Reading the MSDN description for RegisterHotKey I came across:

RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key.

Ref

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜