Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
extracting pixel color Posted by jessamp on 24 Apr 2005 at 7:22 PM
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.
Report
Re: extracting pixel color Posted by BitByBit_Thor on 25 Apr 2005 at 8:57 AM
: 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

Report
Re: extracting pixel color Posted by HackmanC on 25 Apr 2005 at 10:55 AM
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
:
:

Good luck!
Hackman

Report
Re: extracting pixel color Posted by jessamp on 26 Apr 2005 at 5:58 PM
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.