H huiboy Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-15 #1 我需要做一个后台运行的程序,能够判断当前鼠标位置(当然不是本程序窗口)的屏幕颜色 变化情况. 如何实现呢?
T tan_jian Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-15 #2 只有定时器用上了 var DC: HDC; T: TPoint; x,y: integer; DC:=GetDC(0); GetCursorPos(T); x:=T.x; y:=T.y; color:=getPixel[DC,x,y];
只有定时器用上了 var DC: HDC; T: TPoint; x,y: integer; DC:=GetDC(0); GetCursorPos(T); x:=T.x; y:=T.y; color:=getPixel[DC,x,y];
F free_knight Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-15 #3 注:抄袭自 卷起千堆雪tyn function Point_Color: String; var p: TPoint; col: DWOrd; MDC: HDC; begin MDC := GetDC(0); GetCursorPos(p); col := GetPixel(MDC, p.x, p.y); Result:=IntToStr(ColorToRGB(col)); end;
注:抄袭自 卷起千堆雪tyn function Point_Color: String; var p: TPoint; col: DWOrd; MDC: HDC; begin MDC := GetDC(0); GetCursorPos(p); col := GetPixel(MDC, p.x, p.y); Result:=IntToStr(ColorToRGB(col)); end;
T tan_jian Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-15 #4 如果认为是抄袭 var T:TCanvas; T:=TCanvas.Create; T.Handle:=GetDC(0); mycolor:=T.Pixels[mouse.x,Mouse.y); T.Free; 这些代码大富翁上N个人都会,并非抄袭!!!!!!
如果认为是抄袭 var T:TCanvas; T:=TCanvas.Create; T.Handle:=GetDC(0); mycolor:=T.Pixels[mouse.x,Mouse.y); T.Free; 这些代码大富翁上N个人都会,并非抄袭!!!!!!
S southwood Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-27 #6 要取得一个窗口中某一点的颜色,首先需要知道该窗口的handle: HWND hWnd = HWND_DESKTOP; // HWND_DESKTOP 可能就等于 0 然后得到相应的hdc: hdc = GetDC( hWnd ); 接下来通过调用GetPixel函数来得到颜色值. COLORREF GetPixel( HDC hdc, // handle of device context int XPos, // x-coordinate of pixel int nYPos // y-coordinate of pixel ); 最后记住要释放dc: ReleaseDC(HWND_DESKTOP, hdc);
要取得一个窗口中某一点的颜色,首先需要知道该窗口的handle: HWND hWnd = HWND_DESKTOP; // HWND_DESKTOP 可能就等于 0 然后得到相应的hdc: hdc = GetDC( hWnd ); 接下来通过调用GetPixel函数来得到颜色值. COLORREF GetPixel( HDC hdc, // handle of device context int XPos, // x-coordinate of pixel int nYPos // y-coordinate of pixel ); 最后记住要释放dc: ReleaseDC(HWND_DESKTOP, hdc);