문제

What are RegisterHotKeys and global keyboard hooks, 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);
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top