toCode:HWND hwndNotepad = FindWindow(L"Archeage", NULL);
Code:HWND hwndNotepad = FindWindow(NULL, L"Archeage");
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.
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?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); }
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:
toCode:HWND hwndNotepad = FindWindow(L"Archeage", NULL);
Code:HWND hwndNotepad = FindWindow(NULL, L"Archeage");
Last edited by InunoTaishou; 12-12-2014 at 05:09 PM.
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:
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:
you could also hook the (key receive -> action) routine of the game(depends how it's managed) and fake sent keys
▲
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:
Hook the keyboard or make ur sendkeys calling "NTSendInput", can't remember the params, debug it in olly.
Regards.