RegisterHotKeys和全局键盘挂钩? [英] RegisterHotKeys and global keyboard hooks?

查看:82
本文介绍了RegisterHotKeys和全局键盘挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是 RegisterHotKeys 和全局键盘挂钩,它们如何工作?

What are RegisterHotKeys and global keyboard hooks, and how do they work?

我想创建一个关键点,使其专注于应用程序的Form(在最小化时),然后专注于文本框,因此,根据我的阅读,我需要使用 RegisterHotKeys 函数(这是满足我需要的更好的解决方案),但是我找不到如何或在何处可以选择自己的密钥(只有一个密钥- ESC ),然后命令它专注于我的表单,然后在文本框中.

I want to make a key to get focused on my application's Form (when it's minimized) and then focus on a textbox, so from what I've read I need to use the RegisterHotKeys function (that's a better solution for my needs), but i couldn't find how or where I can choose my own key (only one key - ESC) and then command it to focus on my form, and then on the textbox.

推荐答案

如何使用热键的示例.

class myform : Form
{
    public myform()
    {
        RegisterHotKey(Handle, id, modifiers, mykey);
    }
    protected override void WndProc(ref Message m)
    {
        if (m.Msg == 0x312) // this is WM_HOTKEY
        {
            Show();
        }
        base.WndProc(ref m);
    }
}

这篇关于RegisterHotKeys和全局键盘挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆