这代码在VS2012下,不太行啊,怎么改改呀?
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 Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI '确定坐标
X As Long
y As Long
End Type
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long '确定坐标
Dim P As POINTAPI '确定坐标
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Sub Command1_Click()
X = 200
y = 300
h = WindowFromPoint(X, y)
hD = GetDC(h)
ScreenToClient h, P
c = GetPixel(hD, X, y)
R = c Mod 256
G = (c \ 256) Mod 256
B = c \ 256 \ 256
Print R
Print G
Print B
End Sub