How do I send X keys to a game? [VB]

Discussion in 'Programming & Reversing Discussion' started by Zelcore, Apr 24, 2015.

Discuss How do I send X keys to a game? [VB] in the Programming & Reversing Discussion area at GameKiller.net

  1. Noire

    Noire Canada Elite Hacker

    Post Count:
    1,140
    Stats
    I've looked into this like years ago and got the same results.

    far as i can tell now, you basically have to hook maple's own onKey functions and send it that way. could be wrong though *shrugs*

    related page:
     

    Mr. Ad Advertisement

  2. Chai

    Chai Godly Hacker

    Post Count:
    657
    Stats
    Thanks to Xenon for helping me learn how to do it.
    This is the program you requested, in C++ ( )
    Every 180 seconds it will press "c" and the skill bound to it WILL activate :D

    Here is what you should be looking at:

    #include <windows.h>

    VOID OnKey(BYTE key) {
    PostMessage(FindWindow(L"MapleStoryClass", NULL), WM_KEYDOWN, key,MapVirtualKey(key, 0) << 16) + 1);
    PostMessage(FindWindow(L"MapleStoryClass", NULL), WM_KEYUP, key, MapVirtualKey(key, 0) << 16) + 1);
    }


    Then to make it press the C button all you have to do is say:

    OnKey(0x43);
     
  3. Noire

    Noire Canada Elite Hacker

    Post Count:
    1,140
    Stats

    oh awesome, i'll test this out on my trainer whenever i don't have to work lol
     
  4. Xenon

    Xenon Guest

    Stats
    That is merely francesco's way of doing it. Understand there are many ways to complete this task. Francesco prefers hooking MapleStory's OnKey function, which I find is really unnecessary, but he thinks it is better, and I will admit, it maybe a bit better, but the differences will be so small that I think it is really insignificant. Plus, it's easier just using PostMessage so why go and make your life harder?
     
  5. Chai

    Chai Godly Hacker

    Post Count:
    657
    Stats
    Welllllllll I don't know any other working methods, and to me, Franc[e]sco's method doesn't seem that hard.
    So I think I'll stick to it for now. None the less, feel free to mention any other ways we might be able to accomplish simulating keystrokes :D
     
  6. Xenon

    Xenon Guest

    Stats
    Just saying the OnKey method I gave you is the "PostMessage" way. It is not Francesco's method. :|
     
  7. Chai

    Chai Godly Hacker

    Post Count:
    657
    Stats
    Oh, I just meant, that's how he does it. Since that's what you said, "That is merely francesco's way of doing it."
     
  8. Xenon

    Xenon Guest

    Stats
    I'm talking to the OP about that. How Francesco does it:

    Code:
    typedef void(__fastcall *pfnCWndMan__OnKey)(__inout void *pthis, void *edx, uint32_t unknown, uint32_t key);
    static pfnCWndMan__OnKey CWndMan__OnKey = (pfnCWndMan__OnKey)0x011C1720;
    
    
    #pragma pack(push, 1)
    typedef struct tagCWvsContext {
        uint8_t windowmanager_offset[0xA4];
        void *pwindowmanager;
    } CWvsContext;
    #pragma pack(pop)
    
    
    void press_ctrl() {
        CWvsContext *server = *(CWvsContext **)0x017CB1E4;
        if (server && server->pwindowmanager) {
            CWndMan__OnKey(server->pwindowmanager, NULL, 0, 0x001D0000);
        }
    }
    
    #define MAPLEKEY_CTRL 0x001D0000
    #define MAPLEKEY_UP 0x80000000
    #define MAPLEKEY_DOWN 0x00000030
    
    
    void press_ctrl_combo() {
        CWvsContext *server = *(CWvsContext **)0x017CB1E4;
        if (server && server->pwindowmanager) {
            CWndMan__OnKey(server->pwindowmanager, NULL, 0, MAPLEKEY_CTRL | MAPLEKEY_DOWN);
            CWndMan__OnKey(server->pwindowmanager, NULL, 0, MAPLEKEY_CTRL);
            CWndMan__OnKey(server->pwindowmanager, NULL, 0, MAPLEKEY_CTRL | MAPLEKEY_UP);
        }
    
     
  9. Zelcore

    Zelcore Sweden The New Guy

    Post Count:
    14
    Stats
    Wow that was some really helpful information guys :)

    Thank you everyone for your time and explanations!
     
  10. ShivTekk

    ShivTekk Veteran Hacker

    Post Count:
    124
    Stats
    Back to the original post, on how to do it actually using VB.Net -

    Also, it's worth noting that you can use WM_KEYDOWN/KEYUP/CHAR messages with vb.net, also. It works similarly to what they posted, just in visual basic.
     
  11. DeceasedDeath

    DeceasedDeath The New Guy

    Post Count:
    28
    Stats
    SendInput is all I have to say m8
     
  12. CammaJamma

    CammaJamma Lurker

    Post Count:
    2
    Stats
    Hi, I know I am reviving this old post from the dead, but I was wondering if you could possibly enlighten me on how to use Macro Recorder with Maplestory (Private Server)? Once I've recorded the macro I wish to repeat, I click play but nothing happens.

    I am completely new to macros, but from what I gather, the keyboard commands aren't hooking to Maplestory/aren't recognized? I put a "switch to window" command for Maplestory at the beginning to ensure it is the active window.

    Any help would be much appreciated :D
     
  13. Chai

    Chai Godly Hacker

    Post Count:
    657
    Stats
    I just tested auto jumping and walking left, it seems to work fine for me on the official maplestory server.
    The only tip I could really give is run both processes as admin.
    Do you have a license for it? and do you have the newest version?
     
    Last edited: Sep 25, 2016
  14. CammaJamma

    CammaJamma Lurker

    Post Count:
    2
    Stats
    Hey, thanks for responding! :)

    I am currently using an older version as I didn't want to purchase before seeing if it works for my purposes.

    While the arrow keys for walking work fine when running as Admin, whenever I try and use skills on hotkeys, they don't register with MapleRoyals (private server I am playing on). I can simply revert to opening the skill tab and manually clicking the skills I want to use, but this isn't really ideal.
     
  15. Chai

    Chai Godly Hacker

    Post Count:
    657
    Stats
    I reccomend buying it, or using utorrent and pirate bay. to get a new version. That will likely fix your issues. Also, if you're looking to play the macro on a continuous loop, open playback settings and change the value to 0.
     
  16. Inversely

    Inversely Australia Lurker

    Post Count:
    6
    Stats
    Sorry to bump the thread, but I don't feel it deserves another one. I'm able to get my key presses to go through multiple methods (SendMessage, PostMessage, etc), but my issue is if the window was Inactive. As far as I've been reading, that isn't possible without hooking into Maple and using DirectInput and that would require a bypass? The other method I heard was to save the HWID/Handle and keep referring to it even when it's inactive (as findwindow only works on focus/active windows). I tried using Spy++ as suggested by some others and the only difference on inputs is "cRepeat:1" with every emulated key press compared to actual keypresses.

    Is there a bypassless method (and if not, what is a possible method) to sending keypresses to an inactive Maple Window? Thank you~
     

Share This Page