C#写了一个程序,需要用到Windows+Enter热键,但是这个热键被Windows的讲述人应用注册了,请问有什么办法覆盖或者取消掉它吗?热键

解决方案 »

  1.   

    你是说在窗体上将KeyPreview设置为True,Windows键在你的程序里也不能用,是吧?
      

  2.   


            public Form1()
            {
                InitializeComponent();
                RegisterHotKey(this.Handle, 7890, KeyModifiers.Windows, Keys.Enter);
            }
            [DllImport("user32.dll", SetLastError = true)]
            public static extern bool RegisterHotKey(
                    IntPtr hWnd,
                    int id,
                    KeyModifiers fsModifiers,
                    System.Windows.Forms.Keys vk
            );
    我用的是系统API,返回值是false,就是说,根本注册不了,另:是全局热键
      

  3.   

    另外,GetLastError函数返回的是:(1409)-热键已注册