Esempio n. 1
0
 public bool IsSimulatorOpen()
 {
     return(WinApi.FindWindow(null, this.Name) != IntPtr.Zero);
 }
Esempio n. 2
0
        public void SendMessage(string action)
        {
            IntPtr intPtr = WinApi.FindWindow(null, this.Name);

            string[] strArrays = SimulatorInfo.HotKeyList.Split(new char[] { ',' });
            IntPtr   zero      = IntPtr.Zero;

            zero = (!this.Name.Contains("雷電") ? intPtr : WinApi.FindWindowEx(intPtr, 0, null, null));
            if (action == strArrays[0])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.D7), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.D7), 0);
                return;
            }
            if (action == strArrays[1])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.D8), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.D8), 0);
                return;
            }
            if (action == strArrays[2])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.D9), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.D9), 0);
                return;
            }
            if (action == strArrays[3])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.D0), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.D0), 0);
                return;
            }
            if (action == strArrays[4])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.U), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.U), 0);
                return;
            }
            if (action == strArrays[5])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.I), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.I), 0);
                return;
            }
            if (action == strArrays[6])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.O), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.O), 0);
                return;
            }
            if (action == strArrays[7])
            {
                WinApi.SendMessage(zero, this.WM_KEYDOWN, Convert.ToInt32(Keys.P), 0);
                Thread.Sleep(100);
                WinApi.SendMessage(zero, this.WM_KEYUP, Convert.ToInt32(Keys.P), 0);
            }
        }
Esempio n. 3
0
        public bool IsSimulatorOpen()
        {
            IntPtr hwndCalc = WinApi.FindWindow(null, Name);

            return(hwndCalc != IntPtr.Zero);
        }