Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

extracting pixel color

jessampjessamp Posts: 2Member
im writing a program where i need to pick a color from a pixel anywhere on the screen. i found a dll which will let me do it by clicking on the screen only.
i need to know how to pick it via pixel coordinates.
could anyone point me in the right direction to some source or reading material on the net??

btw i am running VB6.

any help would be greatly appreciated.

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : im writing a program where i need to pick a color from a pixel anywhere on the screen. i found a dll which will let me do it by clicking on the screen only.
    : i need to know how to pick it via pixel coordinates.
    : could anyone point me in the right direction to some source or reading material on the net??
    :
    : btw i am running VB6.
    :
    : any help would be greatly appreciated.
    :

    Probably at some point the Mouse Click is converted to cordinates. Instead of converting mouse cordinates, enter your own.

    Greets...
    Richard

  • HackmanCHackmanC Posts: 441Member
    Use the API... C++...

    GetPixel
    The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.

    COLORREF GetPixel(
    HDC hdc, // handle to DC
    int nXPos, // x-coordinate of pixel
    int nYPos // y-coordinate of pixel
    );

    Look in the API Viewer that comes with VB6 to find the correct translation to VB from C.

    To get the hdc of the Screen ... use Screen.hdc


    -------
    : : im writing a program where i need to pick a color from a pixel anywhere on the screen. i found a dll which will let me do it by clicking on the screen only.
    : : i need to know how to pick it via pixel coordinates.
    : : could anyone point me in the right direction to some source or reading material on the net??
    : :
    : : btw i am running VB6.
    : :
    : : any help would be greatly appreciated.
    : :
    :
    : Probably at some point the Mouse Click is converted to cordinates. Instead of converting mouse cordinates, enter your own.
    :
    : Greets...
    : Richard
    :
    :

    [red]Good luck![/red]
    [blue]Hackman[/blue]

  • jessampjessamp Posts: 2Member
    no the DLL doens't allow me to enter my own co-ordinates
    it has only one function in it and it has code which directly takes the mouse from the screen.

    i will check out the API as soon as i get a chance, thanks for the idea
Sign In or Register to comment.