Sign in to follow this  
Followers 0
ardavirus

make PixelGetColor reading from clipboard

4 posts in this topic

#1 ·  Posted (edited)

I am trying to make PixelGetColor to read from a bitmap I have saved on clipboard.

Here it is my logic and testing.

-I maximize an empty notepad.

-Then I screen capture a bitmap of 5x5 near the center (all pixels should be 0xFFFFFF).

-I use the Bitmap handle ($hSC) inside the PixelGetColor to measure the upper left pixel of my previous capture.

The problem is that instead of getting 0xFFFFFF in my output msgBox which is the first pixel of my 5x5 capture, I get 0x86A4D5 which is the first pixel of the entire screen. Here is my code:

#include <ScreenCapture.au3>

If WinExists("Untitled - Notepad") Then
    WinActivate("Untitled - Notepad")
    Else
        MsgBox(0,"Not found","Notepad is not running")
EndIf

Sleep(2000)

Local $hSC = _ScreenCapture_Capture("",400,400,405,405,False)
Local $color = PixelGetColor (1,1,$hSC)
MsgBox(0,"The Hex color is",Hex($color,6))
_WinAPI_DeleteObject($hSC)

Any hint to help me move on will be much appreciated. Thank you for your time to read this.

Edited by ardavirus

Share this post


Link to post
Share on other sites



Direct from the helpfile

If FileName is blank, this

function will capture the screen and return a HBITMAP handle to the bitmap image.

You really should read the helpfile on a function you are having trouble with.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

You really should read the helpfile on a function you are having trouble with.

In fact that was the idea, having the handle of the BITMAP that is saved on the clipboard, from my inexprient point of view, was the best thing. I use the BITMAP directly from clipboard (using it's handle that i presume points there) and then i drop the handle with _WinAPI_DeleteObject.

Doing some thinking between posts I figured that I might was wrong considering the BITMAP on clipboard an object, but saving the bitmap somewhere else then get it's handle seems the same thing if not more complicated. I really can't think of a solution on how to proceed from this point, just need a minor hint to get me to right direction.

And I am trying to read everything there is, and try everything I can think, before I post here, it is just that sometimes you need the 10% of someone's else brain. My question maybe is dumb but your answer is far from constructive dear JohnOne. Cheers!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0