public MainForm() { _random = new Random(); InitializeComponent(); _point = User32_Cursor.GetCursorPosition(); }
private void Timer_Tick(object sender, EventArgs e) { // // Find and "ok-away" the Citrix idle timeout windows - if activated if (checkBoxIB.Checked) { var windows = User32_Windows.FindWindowsWithText("idle timer expired"); foreach (var wdw in windows) { if (wdw == IntPtr.Zero) { continue; } richTextBoxLog.AppendText($"{DateTime.Now.ToLongTimeString()} - IdleBreaker\n"); User32_Windows.SetForegroundWindow(wdw); User32_Windows.SetActiveWindow(wdw); var inputs = new User32_SendInput.INPUT[1]; var input = new User32_SendInput.INPUT { type = 1 }; input.U.ki.wScan = User32_SendInput.ScanCodeShort.RETURN; input.U.ki.dwFlags = User32_SendInput.KEYEVENTF.SCANCODE; inputs[0] = input; User32_SendInput.SendInput(1, inputs, User32_SendInput.INPUT.Size); } } // // Move the mouse to prevent the screensaver from activating - if activated if (checkBoxSS.Checked) { //richTextBoxLog.AppendText($"{DateTime.Now.ToLongTimeString()} - ScreenSaverBreaker\n"); var newPoint = User32_Cursor.GetCursorPosition(); if (newPoint == _point) { MoveCursorRandomly(); MoveCursorRandomly(); } _point = newPoint; } }