HWND hwndChild = GetWindow(hWND, GW_CHILD);
WIN32::SendMessage(hwndChild, WM_ACTIVATE, WA_CLICKACTIVE, 0);
PostMessage(hwndChild, WM_KEYDOWN, 0x44, 0);
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
PostMessage(hwndChild, WM_KEYUP, 0x44, 0);
``` trying to **hold **a key down for a certain time, but what i get is instead the key being pressed twice (presumably at WM_KEYDOWN and at WM_KEYUP)
#windows postmessage
93 messages · Page 1 of 1 (latest)
take a look at the keybd_event
What are you making ducklett
you can press and release after the sleep
trrying to make a game helper
you can say cheats no one cares
what game
but does it work for apps that are in the background?
brawlstars
yeah should work
the same code worked in python
but then in c++ it doesnt :/
test it
i never played brawlstars
nah, its a mobile game so im on an emulator
basically mimicing human behavior
100% should work
yep hopefully
Guessing you want to make an afk farmer
yes
im already doing object detection xd
using hsv and opencv
but now im getting to the part where i need to press keys
i want the window to be in the background
yeah this is the only way i guess
postmessage or keybd_event?
post message i reckon if the emulator isn't using raw mouse
i mean its working
its just not holding it down but instead letting go and holding again
which is not ideal
@zinc flame has reached level 2. GG!
i dont think ill be able to use keybd_event since it doesnt support windows in the background
postmessage is the only way i can think of that's easy
yep
what code would you use to hold down a key?
HWND hwndChild = GetWindow(hWND, GW_CHILD);
WIN32::SendMessage(hwndChild, WM_ACTIVATE, WA_CLICKACTIVE, 0);
PostMessage(hwndChild, WM_KEYDOWN, 0x44, 0);
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
PostMessage(hwndChild, WM_KEYUP, 0x44, 0);``` would this not work?
the key should be held down for 1.5 seconds right
No clue test it
alright
maybe they are filtering for simulated input or doesnt even record it
no cant be that because i tried it on notepad too
presses d then waits out the sleep and presses d again
oh yea bcs notepad is the exact same program as the game
what i mean is that its not the app/game
ive tested it on multiple programs and its the same result
just send normal inputs
with sendinput
trying to send the input to a background window tho
why that ?
so i can use my pc to do other things while the program runs
so its just a anti afk ?
no i mean with sendinput the window has to be the active one
if i want to play or watch something else for example the program couldnt run
i want to automate the game is the logic
ahhh
yea
ig the game has no anticheat why dont u just go internal and yea call ingame functions to do stuff and there you also could do better checks etc
its a phone game on an emulator
that would require me to be able to learn reverse engineering
huh isnt the game available as pc game ?
brawl stars is phone only atm
mhhhhhhhhhh
it's an emulator so probably not
i guess i was doing something wrong
Or the emulator was
After switching from LDPlayer to BlueStacks it now works somehow
¯_(ツ)_/¯
raw mouse input then
How does that work
ah i see
yeah but i really dislike python
@zinc flame has reached level 3. GG!
i also want to learn more about c++
fair enough ig
/close