mortalino
Messages postés6786Date d'inscriptionvendredi 16 décembre 2005StatutMembreDernière intervention21 décembre 201118 23 nov. 2006 à 00:43
Salut,
ouvre un nouveau projet, insère un Timer, et 3 labels (nommés respectivement Label1, Label2, Label3), puis colle ce code :
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Type Couleur
red As Integer
green As Integer
blue As Integer
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Dim PosCur As POINTAPI
Private Function CouleurPixel(ByVal x As Long, ByVal y As Long) As Couleur
Dim pixel As Couleur, RGBPx As Long
RGBPx = GetPixel(GetDC(0&), x, y)
pixel.red = &HFF& And RGBPx
pixel.green = (&HFF00& And RGBPx) \ 256
pixel.blue = (&HFF0000 And RGBPx) \ 65536
CouleurPixel = pixel
End Function
Private Sub Form_Load()
Timer1.Interval = 100
End Sub