|
-
January 8th, 2000, 12:30 PM
#1
Color ID utility?
Is there a VB utility anywhere that allows the user to point at anything on the screen and have its RGB value displayed? Thought I saw an API utility somewhere that does this but don't remember where I found it.
-
January 10th, 2000, 02:05 PM
#2
Re: Color ID utility?
Add a Timer Control to a Form, then use this code and point to anywhere on your screen to have the RGB value appear in the Forms Caption.
private Type POINTAPI
x as Long
y as Long
End Type
private Declare Function GetPixel Lib "gdi32" (byval hdc as Long, byval x as Long, byval y as Long) as Long
private Declare Function GetCursorPos Lib "user32" (lpPoint as POINTAPI) as Long
private Declare Function GetWindowDC Lib "user32" (byval hwnd as Long) as Long
private Sub Form_Load()
Timer1.Interval = 100
End Sub
private Sub Timer1_Timer()
Dim tPOS as POINTAPI
Dim sTmp as string
Dim lColor as Long
Dim lDC as Long
lDC = GetWindowDC(0)
Call GetCursorPos(tPOS)
lColor = GetPixel(lDC, tPOS.x, tPOS.y)
sTmp = Right$("000000" & Hex(lColor), 6)
Caption = "R:" & Right$(sTmp, 2) & " G:" & mid$(sTmp, 3, 2) & " B:" & Left$(sTmp, 2)
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
January 10th, 2000, 03:29 PM
#3
Re: Color ID utility?
Thanks a lot. Also refound the code - it was "getpixel.zip" from http://matthart.com/vbhelp/vbapi.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|