|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Derpicus Newbie cheater Reputation: 1
Joined: 30 Mar 2016 Posts: 15
|
Posted: Thu Mar 31, 2016 9:10 pm Post subject: Send Keypress w/No Focus [Resolved] |
|
|
I am needing to have the O key sent to an application that has no focus.
I know how to use hWnd/SendMessage in VB.Net/C#/C++, but want to have it done via Lua. How can I send a keypress to the application that I'm attached to, without having focus on the application. Either AA or Lua will be fine, I just need help.
Alright, so I can define the keys in my CT script:
Code: |
define(KEY_NORMAL,0)
define(KEY_EXTENDED,1)
//The 11 is the key code from MSDN
define(VK_CONTROL,11)
define(HoldCTRL,0)
define(CTRLKey,VK_CONTROL)
define(CTRLKeyType,KEY_EXTENDED)
define(ReloadKey,'R')
define(ReloadKeyType,KEY_NORMAL)
|
What do I do, from here, or is there a better way? Assuming I need to use the window handle, somehow, and simulate a keypress. How would I get the hwnd and use SendMessage, if that would work? Keys being CTRL and R. Also, the kepresses need to be looped at 100ms intervals; so it needs to keep pressing as long as the box is checked.
Last edited by Derpicus on Sat Apr 02, 2016 7:06 am; edited 1 time in total |
|
Back to top |
|
|
Derpicus Newbie cheater Reputation: 1
Joined: 30 Mar 2016 Posts: 15
|
Posted: Sat Apr 02, 2016 5:27 am Post subject: |
|
|
I managed to find the solution to this, myself.
Since it was based on direct-x, I had to push keycodes to the function used to process them. It works pretty simply, like this (after defining the keycode).
Code: |
mov esi,[*Pointer*]
mov ecx,[esi+A4]
push edx
push 00
call *Pointer*
ret
*Pointer*:
jmp WhateverName
db 90 90 90 90 90
Ret:
|
Also a simple jmp. If anyone needs help with this, simply let me know and if I have the same game, I'll help you!
|
|
Back to top |
|
|
pozzum Newbie cheater Reputation: 0
Joined: 19 Jun 2015 Posts: 22
|
Posted: Sat Apr 02, 2016 10:08 am Post subject: |
|
|
You happen to have wwe 2K16? I've been thinking of starting a project requiring key presses while not in focus and If this possible for that game that'd be awesome
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|