#windows postmessage

93 messages · Page 1 of 1 (latest)

zinc flame
#
    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)
primal steeple
real dragon
zinc flame
primal steeple
#

what game

zinc flame
zinc flame
primal steeple
#

yeah should work

zinc flame
#

the same code worked in python

primal steeple
#

I mean like

#

That method

zinc flame
#

but then in c++ it doesnt :/

zinc flame
#

ill take a look

primal steeple
#

if it has an anticheat

#

opening handles is a no no

primal steeple
#

i never played brawlstars

zinc flame
#

basically mimicing human behavior

primal steeple
#

100% should work

zinc flame
#

yep hopefully

primal steeple
#

Guessing you want to make an afk farmer

zinc flame
#

yes

primal steeple
#

yeah

#

you can take screenshots using the hwnd too

zinc flame
#

im already doing object detection xd

#

using hsv and opencv

#

but now im getting to the part where i need to press keys

primal steeple
#

do you want it to work while not having the window open

#

or that doesn't matter

zinc flame
#

i want the window to be in the background

primal steeple
#

yeah this is the only way i guess

zinc flame
#

postmessage or keybd_event?

primal steeple
#

post message i reckon if the emulator isn't using raw mouse

zinc flame
#

i mean its working

#

its just not holding it down but instead letting go and holding again

#

which is not ideal

bright ferryBOT
#

@zinc flame has reached level 2. GG!

zinc flame
#

i dont think ill be able to use keybd_event since it doesnt support windows in the background

primal steeple
#

postmessage is the only way i can think of that's easy

zinc flame
#

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

primal steeple
#

No clue test it

zinc flame
#

alright

gloomy cloak
zinc flame
#

no cant be that because i tried it on notepad too

#

presses d then waits out the sleep and presses d again

gloomy cloak
zinc flame
#

what i mean is that its not the app/game

#

ive tested it on multiple programs and its the same result

gloomy cloak
#

with sendinput

zinc flame
#

trying to send the input to a background window tho

gloomy cloak
#

why that ?

zinc flame
#

so i can use my pc to do other things while the program runs

gloomy cloak
#

so its just a anti afk ?

zinc flame
#

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

gloomy cloak
#

and whats the logic behind that ? XD

#

bcs thats completly useless what u do

zinc flame
#

i want to automate the game is the logic

gloomy cloak
#

ahhh

zinc flame
#

yea

gloomy cloak
#

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

zinc flame
#

its a phone game on an emulator

#

that would require me to be able to learn reverse engineering

gloomy cloak
zinc flame
#

brawl stars is phone only atm

gloomy cloak
#

mhhhhhhhhhh

primal steeple
zinc flame
#

i guess i was doing something wrong

#

Or the emulator was

#

After switching from LDPlayer to BlueStacks it now works somehow

#

¯_(ツ)_/¯

primal steeple
#

raw mouse input then

zinc flame
#

How does that work

primal steeple
#

google

zinc flame
#

ah i see

spring knot
#

@zinc flame no reason to switch to c++

#

should be fine using it in python

zinc flame
#

yeah but i really dislike python

bright ferryBOT
#

@zinc flame has reached level 3. GG!

zinc flame
#

i also want to learn more about c++

spring knot
#

fair enough ig

spring knot
#

/close

#

noo

zinc flame
#

/close