0

我注册了两个热键

RegisterHotKey(thiswindow, (uint) WindowKeys.Alt, 1, (int)Keys.D1); 
RegisterHotKey(thiswindow, (uint) WindowKeys.Alt, 2, (int)Keys.D2);

现在我如何区分它们使用:

protected override void WndProc(ref Message keyPressed)
        {
            if (keyPressed.Msg == 0x0312)
            {
                if (alt+d1 is pressed)
                   //do something
                if (alt+d2 is pressed)
                   //do something
            }

            base.WndProc(ref keyPressed);
        }

我在导入了 user32.dll 的 WinForm 项目中执行此操作。

4

0 回答 0