Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > 12Sky2
You last visited: Today at 19:09

  • Please register to post and access all features, it's quick, easy and FREE!

 

[C#] Question about SendKeys

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2010
Posts: 259
Received Thanks: 107
[C#] Question about SendKeys

Does anyone ever worked with SendKeys on C# with 12sky2?

I can't find a way to make SendKeys.Send() working.

For example:
I set a global hotkey on F10, whenever I press it it was supposed to do this for example:
PHP Code:
SendKeys.Send("4"
Whenever I press F10, he don't do the function to press number 4 for me.
So when I do press ENTER (for the chat) and press F10 . It types the 4 on the chat.

I don't understand why this works when pressing F10:
PHP Code:
SendKeys.Send("{ENTER}");
                    
SendKeys.Send("Hello world!");
                    
SendKeys.Send("{ENTER}"); 
It send "Hello world!" in the chat, but when I try to make it pressing AoE key it does not.

I hope you understood my question..
This is only to Programmers that understand C# and might have a solution for this.

P.S: Yes I am using:
PHP Code:
[DllImport("user32.dll")]
        private static 
extern bool RegisterHotKey(IntPtr hWndint iduint fsModifiersuint vk);

        [
DllImport("user32.dll")]
        private static 
extern bool UnregisterHotKey(IntPtr hWndint id); 
To detect if the key was pressed etc, that is working fine.

Thanks!



MyDooMJr is offline  
Old   #2

 
elite*gold: 0
The Black Market: 243/0/0
Join Date: Dec 2012
Posts: 12,909
Received Thanks: 7,954
Try it with Send/PostMessage.
Have you started it as admin?

Does the game have a hackshield?


Requi is offline  
Thanks
2 Users
Old   #3
 
elite*gold: 0
Join Date: Feb 2010
Posts: 259
Received Thanks: 107
Quote:
Originally Posted by Requi View Post
Try it with Send/PostMessage.
Have you started it as admin?

Does the game have a hackshield?
1- I will see what I can do with Send/postMessage soon.
2- No I didn't but I suppose it does on debug mode, gonna check later.
3- The game is protected by X-TRAP. But still how come it does work typing ingame chat, and it does not press the skills
MyDooMJr is offline  
Old   #4

 
elite*gold: 0
The Black Market: 243/0/0
Join Date: Dec 2012
Posts: 12,909
Received Thanks: 7,954
I've no idea. But it doesn't start with admin rights while debugging.
Made same Mistake a while ago.


Requi is offline  
Thanks
1 User
Old   #5
 
elite*gold: 0
Join Date: Feb 2010
Posts: 259
Received Thanks: 107
Quote:
Originally Posted by Requi View Post
I've no idea. But it doesn't start with admin rights while debugging.
Made same Mistake a while ago.
Ran the app as admin same effect.

Could you let me a link where I could learn that PostMessage thing or so ? Thanks. Google is a lil messy
MyDooMJr is offline  
Old   #6
 
elite*gold: 0
Join Date: Dec 2009
Posts: 1,723
Received Thanks: 972
Game uses Dinput8 for keyboard input for everything other than textboxs *and pressing enter to show /send chat*

You can code a Dinput hook that lets you simulate keys, it also has an array of bytes that it reads the state of keyboard into. Prehaps set them to 0x80 and the key is pressed maybe.

Or you can use PostMessage i think with some weird settings I can't remember what they were.

If using on anti hacks they will prevent this method so go with injected dll and dinput fun times...

Here is one I prepared eariler...
D3DSendKeys.h
Code:
#ifndef __D3DSENDKEYS_H__
#define __D3DSENDKEYS_H__

// for a full list of keys see
// http://msdn.microsoft.com/en-us/library/ee418641.aspx
// or dinput.h

#include <dinput.h>
#pragma comment(lib, "dinput.lib")

void ClickLeftMouse();
void PressKey(WORD scan);

#endif
D3DSendKeys.cpp
Code:
#include "D3DSendKeys.h"

void ClickLeftMouse()
{
	INPUT inp;
	inp.type = INPUT_MOUSE;
	inp.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
	SendInput(1, &inp, sizeof(INPUT));
	Sleep(20);
	memset((void*)&inp, 0, sizeof(INPUT));
	inp.type = INPUT_MOUSE;
	inp.mi.dwFlags = MOUSEEVENTF_LEFTUP;
	SendInput(1, &inp, sizeof(INPUT));
}


void PressKey(WORD scan)
{	
	INPUT inp[2];
	memset(inp,0,sizeof(INPUT));
	inp[0].type = INPUT_KEYBOARD;
	inp[0].ki.dwFlags = KEYEVENTF_SCANCODE;
	inp[0].ki.time = 1;
	inp[1] = inp[0];
	inp[1].ki.dwFlags |= KEYEVENTF_KEYUP;
	inp[0].ki.wScan = inp[1].ki.wScan = scan;
	SendInput(2, inp, sizeof(INPUT));
}
But of course thats C++ not C#

As for learning API's check out pinvoke and msdn maybe

good luck :P

Edit:
Back before I switched to C++ for game hacks, I had made Map Fun in C#.
Check out frmMain.cs here,
I may have had some basic sendkey functionality working to use skills or pickup items.
But I can't remember 100%..


Mega Byte is offline  
Thanks
3 Users
Reply



« Previous Thread | Next Thread »

Similar Threads
SendKeys an DirectX Fenster
Hallo Leute! Wie kann ich Keys an ein DirectX Game senden ? keybd_event schon versucht, klappt nicht. Das Spiel fängt die Werte so ab(Wenn...
2 Replies - .NET Languages
C# SendKeys
hi, i'm trying to make a bot for cabal in c#. The struture is all in good shape, i can access the memory very well and get all the values i...
5 Replies - General Coding
rPE SendKeys
HI, is it possible to use "SendKeys" in rPE custom filters?? so that when i recieved a packet it will press/send a specified KEY... for...
3 Replies - Ragnarok Online
SendKeys
Mal eine Frage an alle Programmierer ich habe mir einen Petfeeder geproggt mi dem befehl SendKeys ("{F3}{Enter}") wenn ich nun bei Flyff reingehe...
10 Replies - Flyff Main - Discussions / Questions
Free zu Sendkeys...
€dit: Meinte Frage zu Sendkeys^^ Sry... Hi, ich probiere in letzter zeit immer naja son Zeug halt aus um auch irgendwann was gutes zu scripten...
4 Replies - Metin2 Main - Discussions / Questions



All times are GMT +2. The time now is 19:09.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.