API getpixel 的用法问题
各位精英,小弟最近用API中的getpixel 想获取屏幕上某一点像素,结果是据点有结果全-1,心情十分沉重,万望知道的指点一二,十分感谢,原代码如下:Private Declare Function getpixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Integer, ByVal y As Integer) As Integer
Public Shared Function gaincolor(ByVal p As Point, ByVal aaa As IntPtr) As Long
'Dim bbb As Color
Dim ccc As Long
Dim ddd As Long
ddd = GetWindowDC(aaa)
ccc = getpixel(ddd, p.X, p.Y),此处ccc总是返回-1
SetPixel(ddd, p.X, p.Y, 300),此处好像没有执行结果
Return ccc
End Function
上述函数返回值总是-1