已经正常的设置了全局快捷键,在其他程序中都能响应.
但是如果在一个按钮中使用了
            this.Hide();
            this.ShowInTaskbar = false;,就响应不了...求高手指教.
设置快捷键的代码如下using System.Runtime.InteropServices;
        [DllImport("user32.dll", SetLastError = true)]
        public static extern bool RegisterHotKey(
         IntPtr hWnd, 
         int id, 
         KeyModifiers fsModifiers, 
         Keys vk 
        );        [DllImport("user32.dll", SetLastError = true)]
        public static extern bool UnregisterHotKey(
         IntPtr hWnd, 
         int id 
        );
        [Flags()]
        public enum KeyModifiers
        {
            None = 0,
            Alt = 1,
            Control = 2,
            Shift = 4,
            Windows = 8
        }        protected override void WndProc(ref Message m)
        {
            const int WM_HOTKEY = 0x0312;            if (WM_HOTKEY == m.Msg)
            {
                switch (m.WParam.ToInt32())
                {
                    case 101: button1.PerformClick();
                        break;
                }            }            base.WndProc(ref m);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            RegisterHotKey(Handle,101,KeyModifiers.None,Keys.F9);
        }