コード例 #1
0
        void KListener_KeyDown(object sender, Keyboard.RawKeyEventArgs args)
        {
            if (args.Key.ToString() == Properties.Settings.Default["hotkey"].ToString() && !(bool)Properties.Settings.Default["alwaysTop"])
            {
                /*StringBuilder wTitle = new StringBuilder(13);
                 * if (Natives.GetWindowText(Natives.GetForegroundWindow(), wTitle, 13) > 0)
                 * {
                 *  if (wTitle.ToString() == "Guild Wars 2")
                 *  {
                 *      if (!inGame)
                 *      {
                 *          Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                 *          {
                 *              IntPtr handle = new WindowInteropHelper(this).Handle;
                 *              Natives.SetWindowLong(handle, Natives.GWL_ExStyle, Natives.WS_EX_Transparent);
                 *          }));
                 *
                 *          Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                 *          {
                 *              IntPtr gwHandle = Natives.FindWindow(null, "Guild Wars 2");
                 *              Natives.SetForegroundWindow(gwHandle);
                 *              inGame = true;
                 *          }));
                 *      }
                 *      /*else if ((bool)Properties.Settings.Default["alwaysTop"])
                 *      {
                 *          Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                 *          {
                 *              IntPtr handle = new WindowInteropHelper(this).Handle;
                 *              SetWindowLong(handle, GWL_ExStyle, WS_EX_Transparent);
                 *          }));
                 *
                 *          Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                 *          {
                 *              IntPtr gwHandle = FindWindow(null, "Guild Wars 2");
                 *              SetForegroundWindow(gwHandle);
                 *              inGame = true;
                 *          }));
                 *      }*/
                /*}
                 * else
                 * {
                 *  Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                 *  {
                 *      IntPtr handle = new WindowInteropHelper(this).Handle;
                 *      Natives.SetWindowLong(handle, Natives.GWL_ExStyle, Natives.WS_EX_Layered);
                 *      inGame = false;
                 *  }));
                 *
                 *  LogWindow.ClickTroughVoid();
                 * }
                 * } */

                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
                    IntPtr handle = new WindowInteropHelper(this).Handle;
                    Natives.ShowWindow(handle, 4);
                }));
            }
        }
コード例 #2
0
 void KListener_KeyDown(object sender, Keyboard.RawKeyEventArgs args)
 {
     if (ListenForKey)
     {
         Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
         {
             txtbox_hotkey.Text = args.Key.ToString();
         }));
     }
 }
コード例 #3
0
 void KListener_KeyUp(object sender, Keyboard.RawKeyEventArgs args)
 {
     if (args.Key.ToString() == Properties.Settings.Default["hotkey"].ToString() && !(bool)Properties.Settings.Default["alwaysTop"])
     {
         Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
         {
             IntPtr handle = new WindowInteropHelper(this).Handle;
             Natives.ShowWindow(handle, 6);
         }));
     }
 }