日期:2014-05-18  浏览次数:21463 次

C# 模拟按键Win+R
请问怎么模拟Win+R?
System.Windows.Forms.SendKeys.SendWait("");我知道怎么模拟Alt+F4,但不知道Win+R怎么模拟?

------解决方案--------------------
C# code

        /// <summary>
        /// 键盘事件
        /// </summary>
        /// <param name="bvk"></param>
        /// <param name="bScan"></param>
        /// <param name="dwFlags"> 0 为按下,2为释放</param>
        /// <param name="dwExtraInfo">一般情况下设成为 0</param>
        [DllImport("user32.dll")]
        public extern static void keybd_event(byte bvk, byte bScan, int dwFlags, int dwExtraInfo);
        //调用
         keybd_event((byte)Keys.LWin, 0, 0, 0); //按下LWIN
         keybd_event((byte)Keys.R, 0, 0, 0); //按下R
         keybd_event((byte)Keys.LWin, 0, 2, 0);  //释放LWIN
         keybd_event((byte)Keys.R, 0, 2, 0);        //释放R