Jump to content
Sign in to follow this  

PixelSearch Desktop (Program Manager Window)

Recommended Posts


I'm writing a script to verify a particular wallpaper has been applied. Before you ask why I don't just look at the screen, it's because I have some 2000 machines to check across Europe. :)

Here's the script I have so far, which works fine if the desktop is visible;

$progman = WinGetHandle("Program Manager")
$colour = 0x0099E3

$xMin = Int(@DesktopWidth * 0.92)
$xMax = Int(@DesktopWidth * 0.95)
$yMin = Int(@DesktopHeight * 0.85)
$yMax = Int(@DesktopHeight * 0.88)

    $coord = PixelSearch($xMin, $yMin, $xMax, $yMax, $colour, 0, 5, $progman)
Until @error = 0

MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

The reason for all the $xMin type variables is that it allows me to search the same small block of wallpaper, regardless of resolution.

The problem I have is, if a window is covering that portion of the desktop, PixelSearch doesn't seem to be able to find that colour, even though I've specified the window handle for Program Manager, though I'm starting to suspect the window handle variable is only there for PixelCoordMode changes and not to target the actual window for colour searching.

I guess my question boils down to this: Is it possible to search for a pixel colour in a window that's sitting behind other windows (as the desktop often is)?

Thanks in advance.

Share this post

Link to post
Share on other sites

Why don't you read the registry key, can the users replace the file?

Because I've changed the registry value. I don't want to know what it's set to in the registry, I want to know what's visible on the screen.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.