View previous topic :: View next topic |
Author |
Message |
Twistedfate Expert Cheater Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Sat Nov 11, 2017 3:07 pm Post subject: Control send ... send hotkey to background |
|
|
I want to send f1 to game running in background is that possible?how ? |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Nov 12, 2017 8:53 am Post subject: |
|
|
I wrote this last night but apparently the website thought it was a sqlinject attack lol DB has probably fixed it since I'm no longer banned but... here's a link to pastebin anyways (same one I sent DB to show I really wasn't trying anything lol)
https://pastebin.com/fjFfw6rV |
|
Back to top |
|
|
Twistedfate Expert Cheater Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Sun Nov 12, 2017 11:11 am Post subject: |
|
|
thank you for reply but I dont want to download external software .
this coded by atoms
I want to use something like that but to send key press to the window can we use sendMessage(hWnd ..
sorry I am still beginner
Code: | local hWndNotepad = findWindow('Notepad');
local hWndChild = getWindow(hWndNotepad, 5); -- Get the child edit control..
sendMessage(hWndChild, 0x0100, 0x48, 0); -- Send WM_KEYDOWN
sendMessage(hWndChild, 0x0101, 0x48, 0); -- Send WM_KEYUP
sendMessage(hWndChild, 0x0102, 0x48, 0); -- Send WM_CHAR
|
Can I edit this code to send key presses to the game I need something that |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Nov 12, 2017 2:12 pm Post subject: |
|
|
Hm, I hadn't expected sendMessage to work based on something I'd found when googling before but that does. Presumably because it uses the child window
Since I'm not sure how atom0s found the number 5 all I can tell you is to test random numbers with your game and see if you can get it to work. While CE does have a "dissect windows" tool accessed from the memory browser for notepad it only shows the main window not the children for notepad so not sure if that'll be any use here... |
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Sun Nov 12, 2017 5:54 pm Post subject: |
|
|
You can read up on how getWindow works here:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx
It is just a wrapper around the normal Win32 API 'GetWindow'. The second param 5 means 'GW_CHILD', which means:
Quote: | The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is NULL. The function examines only child windows of the specified window. It does not examine descendant windows. |
In the example you mentioned that I wrote, it was just a hard-coded method to show a basic jist of sending keys to a child control of another window. I wouldn't recommend relying on using '5' all the time in other situations as the Z-order of controls is not guaranteed to be the same on all machines or on all launches of a process.
Instead, you should iterate over the controls and look for the specific one you want via using the GW_HWNDFIRST / GW_HWNDLAST / GW_HWNDNEXT commands. _________________
- Retired. |
|
Back to top |
|
|
|