Go Back   GameKiller - Maple Story Hacks, Combat Arms Hacks & WonderKing Hacks > Programming & Reversing > General Programming & Reversing

Sending Key Presses to MS

This is a discussion on Sending Key Presses to MS within the General Programming & Reversing forums, part of the Programming & Reversing category; Alright, I'm havin a bit of trouble and I really don't have the time to keep sitting down trying to ...


Reply
 
LinkBack Thread Tools Display Modes
Old 01-24-2010, 02:25 PM   #1
Beginner Hacker
Feedback Score: 0 reviews
 
Join Date: Jan 2010
Posts: 53
Thanks: 2
Thanked 4 Times in 4 Posts
Default Sending Key Presses to MS

Alright, I'm havin a bit of trouble and I really don't have the time to keep sitting down trying to figure it out because of college and work. I've spent a load of time already, and figured it was time to ask for a bit of help.

Note: In C#, but I'll take any language and convert it if I have to.

I need to send certain key presses to MS. However, nothing I do seems to actually send the "Key" to MS, but instead just the string. I've been using SendInput and other relative functions, but nothing works. I've been told to try DirectInput, but when screwing with that I noticed it's more for READING keypresses/events, than actually sending them.

So, does anyone know to send readable key presses to MS? If not, that's fine, I can figure it out, it's just going to take a LOT longer than I would like.
TGForums is offline   Reply With Quote
Sponsored Links

Old 01-24-2010, 03:30 PM   #2
Beginner Hacker
Feedback Score: 0 reviews
 
KittyKittyBoy17's Avatar
 
Join Date: Sep 2009
Posts: 139
Thanks: 1
Thanked 22 Times in 17 Posts
Default Re: Sending Key Presses to MS

PostMessage + 5 Bypass
KittyKittyBoy17 is offline   Reply With Quote
Old 01-24-2010, 11:58 PM   #3
Beginner Hacker
Feedback Score: 0 reviews
 
Join Date: Jan 2010
Posts: 53
Thanks: 2
Thanked 4 Times in 4 Posts
Default Re: Sending Key Presses to MS

Originally Posted by KittyKittyBoy17 View Post
PostMessage + 5 Bypass
PostMessage only sends the string/character value, though. Not the actual keypress. So regardless of what bypass is used, I can't see that working in any way, shape, or form.
TGForums is offline   Reply With Quote
Old 01-25-2010, 06:15 AM   #4
Degenerate
Feedback Score: 1 reviews
 
Viera's Avatar
 
Join Date: Aug 2009
Location: New Zealand
Posts: 399
Thanks: 51
Thanked 54 Times in 35 Posts
Send a message via ICQ to Viera Send a message via AIM to Viera Send a message via MSN to Viera Send a message via Yahoo to Viera
Default Re: Sending Key Presses to MS

Originally Posted by TGForums View Post
PostMessage only sends the string/character value, though. Not the actual keypress. So regardless of what bypass is used, I can't see that working in any way, shape, or form.
You obviously don't know much about programing. PostMessage is exactly what you are looking for.

It's simple enough to achieve what you want, just send the WM_KEYDOWN message to MapleStory via it's windows process name (wndproc for short)

There are several ways to send a PostMessage instruction to it's wndproc, and one of which I will demonstrate (which is in C#)

First of all you will need to import the following into your project imports "System.Runtime.InteropServices;" This allows you to import and use dynamic link library files (also known as dll's).

Second you will need to import the FindWindow function and the PostMessage function which will be shown bellow;

//////////////////////////////////
//////// FINDWINDOW /////////
//////////////////////////////////

Code:
[DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr FindWindow(
            string lpClassName,
            string lpWindowName);

        IntPtr hWnd = FindWindow(
            null,
            "MapleStory");
//////////////////////////////////
//////// POSTMESSAGE ////////
//////////////////////////////////

Code:
[return: MarshalAs(UnmanagedType.Bool)]
        [DllImport("user32.dll", SetLastError = true)]
            static extern bool PostMessage(
            IntPtr hWnd,
            uint Msg,
            int wParam,
            int lParam);
Thirdly you need to define the WM_KEYDOWN event. Add this piece of code to your form coding (under public partial class)

Code:
const int WM_KEYDOWN = 0x100;
Now that we've got all the functions and imports sorted, all thats needed to do is call the PostMessage event using our parameters. For an example of the usage of PostMessage I will attempt to send the "A" Key to MapleStory' wndproc, the following is done so like:

Code:
PostMessage(hWnd, WM_KEYDOWN, 0x41, 0x1e0001);
Here I will list each Parameter of the PostMessage event so you can get a better understanding.

hWnd - Is the destination parameter (basically where the message will be delivered to in la mans terms)
WM_KEYDOWN - As stated before this is the KEY_DOWN event, it signifies a key being held down. Alternatively you can also use the KEY_PRESS event.
0x41 - Is the wParam which signifies what key is being used
0x1e0001 - Is the lParam which signifies what key is being used

You can find a list of wParameters and lParameters here: [Only Registered and Activated Users Can See Links. Click Here To Register...]

Ofcourse none of the above will work if you have not attached your program to MapleStory' wndproc, or in this case "hWnd". To do this, simply put the following code in your form_load events:

Code:
FindWindow(null, "MapleStory");
An alternative to this would be to put "MapleStoryClass" instead of MapleStory. If you are using "MapleStory" as the window name, you will only be able to use your program if you start it up before you start MapleStory. Using "MapleStoryClass" as the window to find will allow you to open up your program after MapleStory has been opened.

Thats all I have to say.

Last edited by Viera; 01-25-2010 at 06:23 AM.
Viera is offline   Reply With Quote
The Following User Says Thank You to Viera For This Useful Post:
TGForums (01-25-2010)
Old 01-25-2010, 02:41 PM   #5
Beginner Hacker
Feedback Score: 0 reviews
 
Join Date: Jan 2010
Posts: 53
Thanks: 2
Thanked 4 Times in 4 Posts
Default Re: Sending Key Presses to MS

Originally Posted by Viera View Post
You obviously don't know much about programing. PostMessage is exactly what you are looking for.

It's simple enough to achieve what you want, just send the WM_KEYDOWN message to MapleStory via it's windows process name (wndproc for short)

There are several ways to send a PostMessage instruction to it's wndproc, and one of which I will demonstrate (which is in C#)

First of all you will need to import the following into your project imports "System.Runtime.InteropServices;" This allows you to import and use dynamic link library files (also known as dll's).

Second you will need to import the FindWindow function and the PostMessage function which will be shown bellow;

//////////////////////////////////
//////// FINDWINDOW /////////
//////////////////////////////////

Code:
[DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr FindWindow(
            string lpClassName,
            string lpWindowName);

        IntPtr hWnd = FindWindow(
            null,
            "MapleStory");
//////////////////////////////////
//////// POSTMESSAGE ////////
//////////////////////////////////

Code:
[return: MarshalAs(UnmanagedType.Bool)]
        [DllImport("user32.dll", SetLastError = true)]
            static extern bool PostMessage(
            IntPtr hWnd,
            uint Msg,
            int wParam,
            int lParam);
Thirdly you need to define the WM_KEYDOWN event. Add this piece of code to your form coding (under public partial class)

Code:
const int WM_KEYDOWN = 0x100;
Now that we've got all the functions and imports sorted, all thats needed to do is call the PostMessage event using our parameters. For an example of the usage of PostMessage I will attempt to send the "A" Key to MapleStory' wndproc, the following is done so like:

Code:
PostMessage(hWnd, WM_KEYDOWN, 0x41, 0x1e0001);
Here I will list each Parameter of the PostMessage event so you can get a better understanding.

hWnd - Is the destination parameter (basically where the message will be delivered to in la mans terms)
WM_KEYDOWN - As stated before this is the KEY_DOWN event, it signifies a key being held down. Alternatively you can also use the KEY_PRESS event.
0x41 - Is the wParam which signifies what key is being used
0x1e0001 - Is the lParam which signifies what key is being used

You can find a list of wParameters and lParameters here: [Only Registered and Activated Users Can See Links. Click Here To Register...]

Ofcourse none of the above will work if you have not attached your program to MapleStory' wndproc, or in this case "hWnd". To do this, simply put the following code in your form_load events:

Code:
FindWindow(null, "MapleStory");
An alternative to this would be to put "MapleStoryClass" instead of MapleStory. If you are using "MapleStory" as the window name, you will only be able to use your program if you start it up before you start MapleStory. Using "MapleStoryClass" as the window to find will allow you to open up your program after MapleStory has been opened.

Thats all I have to say.
I understood all of that before lol, but thankyou for the time you spent in that response. And I figured PostMessage was only a char/string oriented function; not a keypressing one. I previously believed it was similar to SendWait, but then again I hadn't really looked into it. Sorry for my ignorance and thank you for your help.

PS: It really had nothing to do with not knowing how to program. It was simply that I didn't know PostMessage because, like I previously stated, I thought it was string/char sending and not the actual key.

EDIT:

Played around with it while in class, got it working. Thank you very much for the help.

Last edited by TGForums; 01-25-2010 at 02:54 PM.
TGForums is offline   Reply With Quote
Old 01-25-2010, 04:08 PM   #6
Degenerate
Feedback Score: 1 reviews
 
Viera's Avatar
 
Join Date: Aug 2009
Location: New Zealand
Posts: 399
Thanks: 51
Thanked 54 Times in 35 Posts
Send a message via ICQ to Viera Send a message via AIM to Viera Send a message via MSN to Viera Send a message via Yahoo to Viera
Default Re: Sending Key Presses to MS

Originally Posted by TGForums View Post
I understood all of that before lol, but thankyou for the time you spent in that response. And I figured PostMessage was only a char/string oriented function; not a keypressing one. I previously believed it was similar to SendWait, but then again I hadn't really looked into it. Sorry for my ignorance and thank you for your help.

PS: It really had nothing to do with not knowing how to program. It was simply that I didn't know PostMessage because, like I previously stated, I thought it was string/char sending and not the actual key.

EDIT:

Played around with it while in class, got it working. Thank you very much for the help.
No problem

I remember when I was making my first bot and was having trouble with PostMessage. Ah the good ol' days
Viera is offline   Reply With Quote
Old 01-25-2010, 06:23 PM   #7
Beginner Hacker
Feedback Score: 0 reviews
 
Join Date: Jan 2010
Posts: 53
Thanks: 2
Thanked 4 Times in 4 Posts
Default Re: Sending Key Presses to MS

Originally Posted by Viera View Post
No problem

I remember when I was making my first bot and was having trouble with PostMessage. Ah the good ol' days
It's not my first; normally I'd use SendInput, but I just recently found out that doesn't work for DirectX games, so I needed to find an alternative. And thanks to you finding my stupidity and letting me know that PostMessage wasn't what I was thinking it was (IE. Send, SendWait, etc), I actually managed to get it to work lol

The last bots for MS that I made were roughly 3-years ago and written in C++/Java. Then I moved onto FFXI, and was making bots there for those 3 years, but never had a problem with the automated input until now haha

Thankyou

And PS. I've been using FindWindow(null, "MapleStory"); for a while, and never had a problem with the order of execution. It seems to work fine, at least for me, regardless of the order I start the programs. I wonder what would cause the difference
TGForums is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads for: Sending Key Presses to MS
Thread Thread Starter Forum Replies Last Post
Sending Input to MS TGForums Global Maple Story Hacks Discussion 3 01-22-2010 10:00 PM
Please stop sending me messages. Benji SpamZilla 40 08-22-2009 11:03 AM
Packet Sending & Recieving 0wnzj00z Global Maple Story Hacks Discussion 1 08-18-2009 05:57 PM


GameKiller.net is not responsible for any content in any posting made by users on the site.