>_Screen.visible = .f. >oForm = createobject('MyForm') >oForm.Show >Read events >_Screen.visible = .t. > >Define CLASS myForm AS form > Top = 0 > Left = 0 > Height = 97 > Width = 233 > ShowWindow = 2 > DoCreate = .T. > BorderStyle = 0 > Caption = "Mouse Pos and Color" > posx = 0 > posy = 0 > pixelcolor = 0 > 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 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 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 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) > .colorshower.Backcolor = .pixelcolor > .Refresh() > Endif > Endwith >Endproc >Enddefine >Cetin