Results 1 to 9 of 9
  1. #1
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed

    Sending Input to a game

    So far I have been able to send input to Notepad application to see if it works and everything runs smoothly. My issue is when trying to implement the same function to a game.

    Currently im trying to make a click send once sentence but not even a letter appears.

    Code:
    private: System::Void StartMacroWTB_Click(System::Object^  sender, System::EventArgs^  e) 
    		 {
    			 HWND hwndNotepad = FindWindow(L"Archeage", NULL);
    			 SetForegroundWindow(hwndNotepad);
    			 Sleep(1000);
    			 INPUT ip;
    			 //Set up the INPUT structure
        ip.type = INPUT_KEYBOARD;
        ip.ki.time = 0;
        ip.ki.wVk = 0; //We're doing scan codes instead
        ip.ki.dwExtraInfo = 0;
    
        //This let's you do a hardware scan instead of a virtual keypress
        ip.ki.dwFlags = KEYEVENTF_SCANCODE;
        ip.ki.wScan = 0x1E;  //Set a unicode character to use (A)
    
        //Send the press
        SendInput(1, &ip, sizeof(INPUT));
    
        //Prepare a keyup event
        ip.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
        SendInput(1, &ip, sizeof(INPUT));
    
    	keybd_event(VK_RETURN,0x9c,0 , 0);
    	keybd_event(VK_RETURN,0x9c,KEYEVENTF_KEYUP , 0);
    
    	PostMessage(hwndNotepad, WM_KEYDOWN, VK_RETURN, 0);
    	PostMessage(hwndNotepad, WM_KEYUP, VK_RETURN, 0);
    		 }
    Ive tried 3 different methods and none of them work for the game itself. I dont know if this helps solve the problem but its an independent executable file that I am building. Do I have to make it into a DLL and inject it or can I keep it as it is?

    I looked at a program called Macro Recorder by Jitbit, tried it and it works fine but its not open source so I cant see how they implement their keypresses.
    Last edited by aanthonyz; 12-12-2014 at 11:45 AM.
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  2. #2
    InunoTaishou's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    The Internet
    Posts
    446
    Reputation
    20
    Thanks
    951
    My Mood
    Relaxed
    Code:
    HWND hwndNotepad = FindWindow(L"Archeage", NULL);
    to

    Code:
    HWND hwndNotepad = FindWindow(NULL, L"Archeage");
    Last edited by InunoTaishou; 12-12-2014 at 05:09 PM.
    https://www.mpgh.net/forum/signaturepics/sigpic210976_1.gif

  3. #3
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    Why can I not use the class name for the handle?
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  4. #4
    Biesi's Avatar
    Join Date
    Dec 2011
    Gender
    male
    Posts
    4,993
    Reputation
    374
    Thanks
    8,808
    My Mood
    Twisted
    Quote Originally Posted by aanthonyz View Post
    Why can I not use the class name for the handle?
    You can if you know it, but I assume you only know the window title

  5. #5
    InunoTaishou's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    The Internet
    Posts
    446
    Reputation
    20
    Thanks
    951
    My Mood
    Relaxed
    Quote Originally Posted by aanthonyz View Post
    Why can I not use the class name for the handle?
    "Archeage" does not look like a class name. You would have to open up Spy++ and get the class name to use it that way. (Or autoit's window info, I use it sometimes because it's extremely simple)

    You already know the window name so just use that
    https://www.mpgh.net/forum/signaturepics/sigpic210976_1.gif

  6. #6
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    Sorry forgot to mention I already checked with AutoIt. The Title is : - ArcheAge - Nov 18 2014 (20:28:40) Kyrios, and the Class name in fact is Archeage. Correction, ArcheAge, would the lowercase have caused the problem? I will check and edit after testing.

    EDIT: Nothing worked. Replaced Class name with window name, made it the same case as well, even added both class name and window name. I dont know if this matters but in settings it says DX9 and DX 11. I have it set to DirectX 9, does it being a DirectX game cause DirectInput to reject my keystrokes?
    Last edited by aanthonyz; 12-13-2014 at 04:10 PM. Reason: Update
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  7. #7
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored
    you could also hook the (key receive -> action) routine of the game(depends how it's managed) and fake sent keys

  8. #8
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    Any links/tutorials on hooking?
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  9. #9
    Miseryk's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    *
    Posts
    7
    Reputation
    10
    Thanks
    0
    Hook the keyboard or make ur sendkeys calling "NTSendInput", can't remember the params, debug it in olly.

    Regards.

Similar Threads

  1. [Help] Sending keystrokes to Directx game in VB.net
    By unSatisfied in forum Visual Basic Programming
    Replies: 3
    Last Post: 06-24-2013, 07:57 PM
  2. [Help Request] Focusing And Sending Keys To Particular Game
    By Crostator in forum Visual Basic Programming
    Replies: 5
    Last Post: 03-01-2012, 03:24 AM
  3. [Help Request] When I join A game it says send error report
    By inthemax in forum CrossFire Help
    Replies: 8
    Last Post: 09-17-2011, 05:14 AM
  4. Physics Game Brainstorming (Input your ideas)
    By arunforce in forum General
    Replies: 14
    Last Post: 02-19-2011, 03:15 PM