private static void Hook_KeyDown(object sender, KeyEventArgs e) { var key = e.KeyCode; if (key == Keys.Oem6 || key == Keys.Oem5 || key == Keys.Escape) { ProcessThread.Process(key, e.Shift, e.Control, e.Alt); } else if (key == Keys.Oem3) { } else if (key == Keys.LMenu) { if (TextShown) { var currResult = Program.Results.Dequeue(); Clipboard.SetText(currResult.Value); Program.CurrentResult = currResult.Key + "\r\n------------------------------\r\n" + currResult.Value; Program.Results.Enqueue(currResult); ControlForm.SetText(CurrentResult); } else { ProcessThread.LookupResource(); } } }
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; }