Beispiel #1
0
        public static void BringOnTop()
        {
            var str = "";

            ControlForm = new ControlForm();
            ControlForm.CheckForIllegalCrossThreadCalls = false;
            ControlForm.Result.GotFocus += (o, e) =>
            {
                test++;
                ControlForm.Result.Focus();
                ControlForm.Result.Text = test.ToString();
            };
            var p = Cursor.Position;

            ControlForm.SetDesktopLocation(p.X, p.Y);
            ControlForm.Result.LostFocus += (o, e) =>
            {
                ControlForm.Close();
                BringOnTop();
            };
            ControlForm.Result.KeyPress += (o, e) =>
            {
                str += "a";
                ControlForm.Result.Text = str;
            };
            ControlForm.Show();
            ControlForm.Result.Focus();
        }
Beispiel #2
0
 private static void KeyBoardHook_KeyboardPressed(object sender, GlobalKeyboardHookEventArgs e)
 {
     if (!TextShown)
     {
         ControlForm = new ControlForm();
         var p = Cursor.Position;
         ControlForm.SetDesktopLocation(p.X, p.Y);
         ControlForm.SetText("OKOKOK" + test++);
         ControlForm.Show();
         try
         {
             var fptExam = Process.GetProcessesByName("FPT-Exam")[0];
             SetWindowPos(fptExam.MainWindowHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE);
         }
         catch (Exception) { }
         SetWindowPos(ControlForm.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     }
     else
     {
         ControlForm.Close();
     }
     TextShown = !TextShown;
 }