Help with sending keys

Posts 1–5 of 5 · Page 1 of 1
Help with sending keys
I need help with sending the space key to Combat Arms.

Apparently you can't do VKs anymore since Nexon patched them or something like that. So my bunny hop doesn't work. It's MSVC++ and Windows forms project...

I have tried :
SendKeys::Send();
SendKeys::SendWait();
GenerateKey(); (Person made function)
keybd_event( VK_SPACE, 0x45, KEYEVENTF_EXTENDEDKEY, 0 );
keybd_event( VK_SPACE, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );

etc...
Nothing seems to work. Is there any way I can do this?
You can try PostMessage()

PostMessage Function()

I did a little demo for Notepad for you.

Code:
#include <windows.h>
#include <iostream>

using namespace std;

HWND hwnd;
HWND child;

int main()
{
    hwnd = FindWindow(0,"Untitled - Notepad");
    if(!hwnd)
    {
             return 0;
    }
    child = FindWindowEx(hwnd,0,"edit",0);
    if(!child)
    {
              return 0;
    }
    
    SetForegroundWindow(child);
    Sleep(500);
           
    PostMessage(child,WM_KEYDOWN,(WPARAM)VkKeyScan('w'),0);
    
    cin.get();
}
Pretty much just types W into the edit box on NotePad.

FindWindowEx was just to find the child window, in this case it's the giant edit box where you type. I don't think you need to do that for CA though.
Code:
child = FindWindowEx(hwnd,0,"edit",0);
"edit" is the system class. If you were to make a textbox using windows api, the system class would be "edit", if you were making a button, it would be "button" etc etc..

More info here:

CreateWindow Function()
Quote Originally Posted by Void View Post
You can try PostMessage()

PostMessage Function()ⓘ

I did a little demo for Notepad for you.

Code:
#include <windows.h>
#include <iostream>

using namespace std;

HWND hwnd;
HWND child;

int main()
{
    hwnd = FindWindow(0,"Untitled - Notepad");
    if(!hwnd)
    {
             return 0;
    }
    child = FindWindowEx(hwnd,0,"edit",0);
    if(!child)
    {
              return 0;
    }
    
    SetForegroundWindow(child);
    Sleep(500);
           
    PostMessage(child,WM_KEYDOWN,(WPARAM)VkKeyScan('w'),0);
    
    cin.get();
}
Pretty much just types W into the edit box on NotePad.

FindWindowEx was just to find the child window, in this case it's the giant edit box where you type. I don't think you need to do that for CA though.
Code:
child = FindWindowEx(hwnd,0,"edit",0);
"edit" is the system class. If you were to make a textbox using windows api, the system class would be "edit", if you were making a button, it would be "button" etc etc..

More info here:

CreateWindow Function()ⓘ
Thanks I'll try this out now.
That ought to work, but PostMessage() is kind of slow. A Global Key board hook would be faster and the better choice. I believe BA posted some source for one. Copy and paste till your heart desire.

Hmmmm... wdf is HD when you need him, must have worn himself after that VB thing...
Quote Originally Posted by why06 View Post
That ought to work, but PostMessage() is kind of slow. A Global Key board hook would be faster and the better choice. I believe BA posted some source for one. Copy and paste till your heart desire.

Hmmmm... wdf is HD when you need him, must have worn himself after that VB thing...
WUT?! I'm still here just stopped flaming noobs, instead I wait for my mignions(crushed and ilovecookies) do it for me my plan isnt working yet tho, they are too soft and squishy, like the squishy toys.
But I will bend them to my will >=D soon they will flame ch00bs just like me ill be so proud :P
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?