Jump to content

_SendMessage to inactive window


 Share

Recommended Posts

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
Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...