using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.ComponentModel; using System.Data; using System.Runtime.InteropServices; using System.Diagnostics; using System.Threading; using System.Windows.Forms; using System.Drawing; namespace TextSendKeys { class Program { [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); static void Main(string[] args) { Process[] processes = Process.GetProcessesByName("game"); Process game1 = processes[0]; IntPtr p = game1.MainWindowHandle; ShowWindow(p,1); SendKeys.SendWait("{DOWN}"); Thread.Sleep(1000); SendKeys.SendWait("{DOWN}"); } } }
This program is designed to send twice the DOWN button in the game window. It only works when my window is minimized (it activates the window and does its work). If my window is activated (not minimized), nothing happens. How to solve this?
Thanks!:)
source share