_Screen.Visible = .F. oForm = Createobject('MyForm') oForm.Show Read Events _Screen.Visible = .T. Define Class myForm As Form Top = 0 Left = 0 Height = 148 Width = 233 ShowWindow = 2 DoCreate = .T. BorderStyle = 0 Caption = "Color Discovery" posx = 0 posy = 0 pixelcolor = 0 rgbcolor = '' HexColor = '' Name = "Form1" Add Object lblxpos As Label With ; Caption = "XPos", ; Height = 17, ; Left = 13, ; Top = 15, ; Width = 31, ; Name = "lblXpos" Add Object lblypos As Label With ; Caption = "Ypos", ; Height = 17, ; Left = 14, ; Top = 45, ; Width = 30, ; Name = "lblYpos" Add Object lblcolor As Label With ; Caption = "Color", ; Height = 17, ; Left = 12, ; Top = 75, ; Width = 32, ; Name = "lblColor" Add Object lblrgbcolor As Label With ; Caption = "RGB", ; Height = 17, ; Left = 12, ; Top = 101, ; Width = 32, ; Name = "lblrgbColor" Add Object lblhexcolor As Label With ; Caption = "Hex", ; Height = 17, ; Left = 12, ; Top = 126, ; Width = 32, ; Name = "lblhexColor" Add Object txtxpos As TextBox With ; FontBold = .T., ; ControlSource = "thisform.PosX", ; Height = 23, ; Left = 52, ; ReadOnly = .T., ; Top = 12, ; Width = 100, ; Name = "txtXpos" Add Object txtypos As TextBox With ; FontBold = .T., ; ControlSource = "Thisform.PosY", ; Height = 23, ; Left = 52, ; ReadOnly = .T., ; Top = 42, ; Width = 100, ; Name = "txtYpos" Add Object txtcolor As TextBox With ; FontBold = .T., ; ControlSource = "Thisform.PixelColor", ; Height = 23, ; Left = 52, ; ReadOnly = .T., ; Top = 72, ; Width = 100, ; Name = "txtColor" Add Object txtrgbcolor As TextBox With ; FontBold = .T., ; ControlSource = "Thisform.RGBColor", ; Height = 23, ; Left = 52, ; ReadOnly = .T., ; Top = 98, ; Width = 100, ; Name = "txtrgbColor" Add Object txthexcolor As TextBox With ; FontBold = .T., ; ControlSource = "Thisform.HexColor", ; Height = 23, ; Left = 52, ; ReadOnly = .T., ; Top = 123, ; Width = 100, ; Name = "txthexColor" Add Object timer1 As Timer With ; Top = 0, ; Left = 156, ; Height = 23, ; Width = 23, ; Interval = 100, ; Name = "Timer1" Add Object colorshower As Container With ; Top = 33, ; Left = 167, ; Width = 49, ; Height = 49, ; Name = "ColorShower" Procedure Load Declare Sleep In Win32API Integer Declare short GetCursorPos In win32api String @ lpPoint Declare Integer GetWindowDC In Win32API Integer HWnd Declare Integer GetPixel In win32API ; integer hdc, Integer nXPos, Integer nYPos Endproc Procedure QueryUnload Clear Events Endproc Procedure Color2RGB lparameters tnColor local lnRed,lnGreen,lnBlue lnRed = bitrshift(bitand(tnColor, 0x0000FF),0) lnGreen = bitrshift(bitand(tnColor, 0x00FF00),8) lnBlue = bitrshift(bitand(tnColor, 0xFF0000),16) return trans(lnRed)+","+trans(lnGreen)+","+trans(lnBlue) EndProc Procedure timer1.Timer lpPoint = Space(8) With Thisform If GetCursorPos(@lpPoint)#0 .posx = Asc(Substr(lpPoint,1))*256^0+; asc(Substr(lpPoint,2))*256^1+; asc(Substr(lpPoint,3))*256^2+; asc(Substr(lpPoint,4))*256^3 .posy = Asc(Substr(lpPoint,5))*256^0+; asc(Substr(lpPoint,6))*256^1+; asc(Substr(lpPoint,7))*256^2+; asc(Substr(lpPoint,8))*256^3 .pixelcolor = GetPixel(GetWindowDC(0), .posx, .posy) .RGBColor = .Color2RGB(.PixelColor) .HexColor = STUFF(TRANSFORM(.PixelColor,'@0'),3,2,'') .colorshower.BackColor = .pixelcolor .Refresh() Endif Endwith Endproc EnddefineCetin