问个图片处理的问题
我想获得一个被其他窗口覆盖的flash的某点颜色信息。代码是这样写的。
134170是flash的句柄。
在getpixel(DestDC, pos.x, pos.y)提示我“无效属性”
应该如何获得呢?
另外getpixel这么操作是不是会比较慢,有没有更快的方法?
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongPrivate Declare Function getpixel Lib "gdi32" Alias "GetPixel" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As LongPrivate Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As LongPrivate Declare Function PrintWindow Lib "user32" (ByVal SrcHwnd As Long, ByVal DesHDC As Long, ByVal uFlag As Long) As LongPrivate Type POINTAPIx As Longy As LongEnd TypeDim myhDC As LongDim pos As POINTAPIPrivate Sub Form_Load()Timer1.Enabled = TrueTimer1.Interval = 50End SubPrivate Sub Timer1_Timer()GetCursorPos posText1.Text = "(" & pos.x & "," & pos.y & ")"sourceDc = GetDC(134170)DestDC = CreateCompatibleDC(sourceDc)PrintWindow Text1.Text, DestDC, 0'Text2.Text = getpixel(myhDC, pos.x, pos.y)Picture1.BackColor = getpixel(DestDC, pos.x, pos.y)End Sub