Fallen Empires- Petros

Hi,
I have hotkeys working but i have one isshue. The program i am making is a game trainer (modfies the data ect). I need to able to activate hotkeys in game. But hotkeys seem to work in every other place but in game (i have to alt tab out of it and press the hotkeys) How can i make them work in game






Re: Game Technologies: General Hotkeys =/

Ken_L

I could be wrong - but I believe the game framework is different...

So I think you need to add references to the System.Windows.Forms namespace.

This link says it is the System.Wind... class - just not sure what the ... means

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.keypress(VS.71).aspx






Re: Game Technologies: General Hotkeys =/

deodorant

Have you tried creating a system-wide hotkey Take a look at RegisterHotKey, and UnregisterHotKey.

The bottom of the RegisterHotkey has a good example of how to set a hotkey and execute code when it's pressed.

Hope this helps!





Re: Game Technologies: General Hotkeys =/

Fallen Empires- Petros

Tht didnt seem to work =(






Re: Game Technologies: General Hotkeys =/

deodorant

Really Maybe the game has some sort of anti-detection about that. Which game is it And could you post your code





Re: Game Technologies: General Hotkeys =/

Fallen Empires- Petros

deodorant wrote:
Really Maybe the game has some sort of anti-detection about that. Which game is it And could you post your code

i can't get the code today because its on my other computer so i will have it tommorow.

www.legacygamers.net

Thts the site. Its a private server of a game called gunz. They have protection (but other trainers ppl make in delphi have hotkeys tht work just fine). They just recently patched my trainer but other private servers of "gunz" have the same effect on me and hotkeys.






Re: Game Technologies: General Hotkeys =/

nobugz

Games usually rely on DirectInput instead of the message loop for input. Hotkey notifications can only be seen with a message loop.





Re: Game Technologies: General Hotkeys =/

Fallen Empires- Petros

is thier anyway at all i can use direct input to make the hotkeys work or somthing






Re: Game Technologies: General Hotkeys =/

nobugz

No.





Re: Game Technologies: General Hotkeys =/

deodorant

That's weird it doesn't work for you. By using those API's I posted eariler, I could control my iTunes via hotkeys while using any application, even Gunz. That was a while ago, maybe over a year or two ago, so maybe they have changed something. Here's the code I used, maybe it will help:- (Sorry about the formatting, in a rush)

API

public int Alt = 0x1;

public int Control = 0x2;

public int Shift = 0x4;

public int Windows = 0x8;

[DllImport("user32.dll", SetLastError=true)]

static extern bool RegisterHotKey( IntPtr hWnd,

int id,

int fsModifiers,

int vk);

[DllImport("user32.dll")]

static extern bool UnregisterHotKey(IntPtr hWnd,
int id);

public bool SetHotKeys(IntPtr ptrHandle, int intID, int intModKey, int intMainKey)

{

return RegisterHotKey(ptrHandle, intID, intModKey, intMainKey);

}

Assigning key

SetHotKeys(this.Handle, 40000, Alt, (int)'P'); // Toggle pause/play

WndProc

if (m.Msg == 0x0312) //WM_HOTKEY
{

switch ((int)m.WParam) // WParam = hotkey ID's we registered before

{

case 40000:

// CODE

break;

}

}