728x90











GetPixel API는 마우스포인터에 위치해 있는 픽셀을 가져오는 API입니다.

Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetWindowDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
Private Type POINTAPI
    x As Long
    y As Long
End Type

Private Sub Timer1_Timer() 'Timer1.Interval = 1
Static MP As POINTAPI
GetCursorPos MP
Form1.Cls
Print Hex(GetPixel(GetWindowDC(GetDesktopWindow), MP.x, MP.y))
End Sub

예제파일없음

+ Recent posts