void WatchHWNDs() { while (true) { CurrentWindow = NativeWin32.GetForegroundWindow(); if (CurrentWindow == m_MyHWND) { NativeWin32.SetForegroundWindow(LastWindow); } LastWindow = CurrentWindow; Thread.Sleep(10); } }
void killer() { int index = 0; while (true) { if (NativeWin32.GetForegroundWindow() != CurrentWindow) { //SendKeys.SendWait(m_Alphabet[index].ToString()); SendKeys.SendWait("qwertyuiopasdfghjklzxcvbnm"); index++; if (index >= 26) { index = 0; Thread.Sleep(200); } } } }
void m_KeyboardManager_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Close(); } if (e.KeyCode == Keys.Space) { if (NativeWin32.GetForegroundWindow() != CurrentWindow) { //SendKeys.SendWait(m_Alphabet[index].ToString()); SendKeys.SendWait("qwertyuiopasdfghjklzxcvbnm"); index++; if (index >= 26) { index = 0; Thread.Sleep(200); } } } }