Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

PostMessage Click - useful hwnd clicker


  • Please log in to reply
6 replies to this topic
infogulch
  • Moderators
  • 717 posts
  • Last active: Jul 31 2014 08:27 PM
  • Joined: 27 Mar 2008
The control doesn't have to be visible on the screen, but it needs the hwnd of the control. (I haven't tested it on a window yet, just controls.) Use ControlGet, hwndVar, hwnd, ... to get a control's hwnd.

Please test and tell me how it works!
PostClick(hwnd, X, Y, Count=1, Delay=50)
{ ; By Infogulch
	p := y << 16 | (x & 0xffff)
	Loop, %Count% {
		PostMessage, 0x201, 1, p, , ahk_id %hwnd%
		If (Delay)
			Sleep Delay
		PostMessage, 0x202, 0, p, , ahk_id %hwnd%
		If (Delay)
			Sleep Delay
	}
}

I've been using it myself for a game. I don't know what the difference is between this and ControlClick. I even had a glance in ahk's source, and they look like they do the same basic thing. But this works and ControlClick doesn't, so maybe you could tell me. :)

  • Guests
  • Last active:
  • Joined: --
Does it work?

infogulch
  • Moderators
  • 717 posts
  • Last active: Jul 31 2014 08:27 PM
  • Joined: 27 Mar 2008
Well, it does for me, I just want some more feedback, what did you find? :)

vahju
  • Members
  • 337 posts
  • Last active: Sep 21 2014 03:52 AM
  • Joined: 17 Feb 2008
Hey infogulch any chance you can explain each line for newbs who do not have any experience with post message commands (like me). Maybe break down this script line by line. Thanks.

infogulch
  • Moderators
  • 717 posts
  • Last active: Jul 31 2014 08:27 PM
  • Joined: 27 Mar 2008
vahju: sure! I'll try to do that this weekend.

I just updated it with a more accurate title, and fixed what looked like a bug, so if you're having problems with it, try copying it again.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

But this works and ControlSend doesn't, so maybe you could tell me. :)

Do you mean ControlClick? ControlSend doesn't support clicking.