开发者

RegisterHotKeys and global keyboard hooks?

开发者 https://www.devze.com 2022-12-09 00:10 出处:网络
What are RegisterHotKeys and global keyboard h开发者_如何学JAVAooks, and how do they work? I want to make a key to get focused on my application\'s Form (when it\'s minimized) and then focus on a tex

What are RegisterHotKeys and global keyboard h开发者_如何学JAVAooks, and how do they work?

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.


Sample on how to use hot keys.

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);
    }
}
0

精彩评论

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

关注公众号