Jump to content
Sign in to follow this  

Getting middle color of a window

Recommended Posts

Hello All here is my code can anyone please help me?

If _IsPressed("20") Then
    $Pos = WinGetPos("Window")
    $Color = pixelgetcolor($Pos[0]/2,$Pos[1]/2)

I'm trying to get middle color of window but pixelgetcolor still don't get the middle...

anyone to help?

Edited by Trojan55

Share this post

Link to post
Share on other sites

#include <Misc.au3>
Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("20", $hDLL) Then
        $hWnd = WinGetHandle("AutoIt Help")  ; change to your window
        $Pos = WinGetPos($hWnd)
        $Color = PixelGetColor($Pos[0] / 2, $Pos[1] / 2)

        MsgBox(0, "", $Pos[0] & "," & $Pos[1] & @CRLF & "0x" & Hex($Color, 6))



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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...