Jump to content
Moopler
Sign in to follow this  
Ra'sAlGhul

Help Keypress MapleStory C#

Recommended Posts

Hello guys i'm making a trainer for ms, but can't send keystrokes without the ms windows focused. I tried with the class, name of the windows, pid, and nothing...

I used PostMessage and MapVirtualKey to send key and FindWindow to find the maplestory windows.

[DllImport("user32.dll", EntryPoint = "PostMessageW")]
private static extern bool PostMessage(int hwnd, int wMsg, int wParam, int lParam);

[DllImport("user32.dll", EntryPoint = "FindWindow")]
private static extern int FindWindow(string lpClassName, string lpWindowName);

[DllImport("user32.dll")]
private static extern int MapVirtualKey(uint uCode, uint uMapType);

and use pid to get to correct maplestory windows if use multiclient, like

int hwnd = FindWindow(null, Process.GetProcessById(Int32.Parse(pid, NumberStyles.HexNumber)).MainWindowTitle);

then send the key

int lParam = (MapVirtualKey(key, 0) << 16) + 1;
PostMessage(hwnd, WM_KEYDOWN, key, lParam);
PostMessage(hwnd, WM_KEYUP, key, lParam);

But, don't work if maplestory windows not are focused.

Greetings and thanks!

 

Share this post


Link to post
1 hour ago, Ra'sAlGhul said:

Don't work

Did you look at the version tag, then realise you had to update it, then update it?

 

If not, try again.

Edited by DAVHEED

Share this post


Link to post
2 hours ago, DAVHEED said:

Did you look at the version tag, then realise you had to update it, then update it?

 

If not, try again.

Yep, I update it... Anyway I tried it before, in that version that is published and it did not work.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×