HelpHow to make keypress only target process

Posts 1–4 of 4 · Page 1 of 1
How to make keypress only target process
i will make program C# but idk how to only star in target game, i'm us for farming only keypress "X" or "Space" for looting drop item in target game, i'm using system Diagnostics but always crass
Code:
static class Program
{
    const UInt32 WM_KEYDOWN = 0x0100;
    const int VK_F5 = 0x74;

    [DllImport("user32.dll")]
    static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);

    [STAThread]
    static void Main()
    {
        while(true)
        {
            Process [] processes = Process.GetProcessesByName("iexplore");

            foreach(Process proc in processes)
                PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_F5, 0);

            Thread.Sleep(5000);
        }
    }
}
Credits: vdk from StackOverflow

Simply change this code for your specifications.
You could try something like this

dynamic ws = Microsoft.VisualBasic.Interaction.CreateObject("WS cript.Shell", "");
ws.Run("Notepad.exe");
ws.SendKeys("123{TAB}");
Quote Originally Posted by HAKSRC View Post
You could try something like this

dynamic ws = Microsoft.VisualBasic.Interaction.CreateObject("WS cript.Shell", "");
ws.Run("Notepad.exe");
ws.SendKeys("123{TAB}");
Dude, that's a terrible example. That won't even attach to the process, it just sends a key it can cause some serious issues if you do that.
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us