Sign in to follow this  
Followers 0
Nahrix

_SendMessage to inactive window

19 posts in this topic

#1 ·  Posted (edited)

I am trying to write a simple bot for a game to execute a simple repetitive task while I browse the web. I want to send a single keystroke to the minimized, inactive window. After much googling on the topic, I couldn't find a single case where someone had successfully accomplished this task.

Here is the code snippet of my attempt to send a single spacebar keystroke to the inactive window:

#Include <SendMessage.au3>

_SendMessage(WinGetHandle("GameWindowTitle"), 0x100, 0x20, 1)
_SendMessage(WinGetHandle("GameWindowTitle"), 0x101, 0x20, 1)

Thank you very much in advance for any advice you can offer.

(If it helps, I'm running Vista 64-bit)

Edited by Nahrix

Share this post


Link to post
Share on other sites



Try ControlSend. I use that to send to minimized, unfocused windows..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Try ControlSend. I use that to send to minimized, unfocused windows..

I am sending the keystroke to a game window that has no obtainable control to send it (ie the autoit info tool, or any other tool provides blank information in the control section). The only way this seems possible is to use _SendMessage or some other method.

Share this post


Link to post
Share on other sites

Bump for desperate call for aide

Share this post


Link to post
Share on other sites

Bump again :D

Share this post


Link to post
Share on other sites

No, it does not use either.

Share this post


Link to post
Share on other sites

Keys are generally sent with PostMessage because you're not waiting on a reply from the window. Putting that aside for a moment, if you can't do:

ControlSend(handle to window, "", "", "{SPACE}")
( leaving the control id/ classnamenn param blank ) and it work, chances are, that it's not going to work anyway.

You could also test Send("{SPACE}") while the window you want to interact with is active to see if that works:

WinWaitActive("Window Name or handle")
Sleep(250)
Send({SPACE})

Other than that, anonymity of the program you wish to interact with will not help you much. You're making people take guesses that just waste their/our time.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I'm sorry, I don't want to waste your time. The game is called "Darkfall Online"

PostMessage doesn't work either, but Send to the activated window works perfectly fine.

Edit: Whoops, I tried PostMessage with another program which didn't work. AutoIt doesn't appear to have _PostMessage in the Include directory.

Edited by Nahrix

Share this post


Link to post
Share on other sites

ControlSend takes a HANDLE so try using the handle to the window...

$hwnd = WinGetHandle("the window")

ControlSend("","",$hwnd,"test")

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

Neither

ControlSend("", "", $hwnd, "{SPACE}")

nor

ControlSend($hwnd, "", $hwnd, "{SPACE}")

are working.

Share this post


Link to post
Share on other sites

I can get the handle of the window using the au3info tool, but attempting to manually use the handle, like so:

_SendMessage("0x0000000000150770", 0x100, 0x20, 1)

_SendMessage("0x0000000000150770", 0x101, 0x20, 1)

or doing the same with the ControlSend function, does not work.

Share this post


Link to post
Share on other sites

I can get the handle of the window using the au3info tool, but attempting to manually use the handle, like so:

_SendMessage("0x0000000000150770", 0x100, 0x20, 1)

_SendMessage("0x0000000000150770", 0x101, 0x20, 1)

or doing the same with the ControlSend function, does not work.

Remove quotations.

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

trancexx: Removing the quotations causes an error, "Unable to parse line"

volley:

Posted Image

Share this post


Link to post
Share on other sites

trancexx: Removing the quotations causes an error, "Unable to parse line"

Remove leading zeros.

Or use HWnd() function.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0