屏幕取色DELPHI源码
http://www.csdn.net/cnshare/soft/openfile.asp?kind=1&id=5441
http://www.csdn.net/cnshare/soft/openfile.asp?kind=1&id=5441
解决方案 »
- 第4个100啰
- 如何对网页进行监控,发现有“色情”二字马上关闭网页
- 在DelPhi6.0下如何使用TMemoryTable控件?
- 请教P2P打洞的生存周期?
- 我用delphi如何取得自己的上网时间??
- 请教!急!在线等待!初学者的问题!如何在uses语句中声明DLL函数!请给予代码!谢谢!
- 如何录制屏幕为ASF文件
- 我要找:Hank(星星农场)
- FastReport4 单元格无法对齐问题!
- 哪有支持flash6.0或5.0的控件下载?(我不需要delphi提供的active 控件)
- 如何去掉Treeview的"+"和"-"? 有没有一种XP风格的控件能使所有的控件呈现XP风格?
- 局域网内如何调用应用程序和如何杀掉应用程序
var mousepos:tpoint;
var handle:hwnd;
var color:tcolor;
var dc:hdc;
begin
getcursorpos(mousepos);
handle:=getdesktopwindow;
dc:=getwindowdc(handle);
color:=getpixel(dc,mousepos.x,mousepos.y);
label1.color:=rgb(getrvalue(color),getgvalue(color),getbvalue(color));
releasedc(handle,dc);
end;
把timer控件的interval值改小一些,效果就可以了
TColor MouseColor;
TRect WinRect;
COLORREF CurPixel;
int RV,GV,BV;
HWND WindowHandle; GetCursorPos(&CurPos);
WindowHandle=WindowFromPoint(CurPos); // Get Position
GetWindowRect(WindowHandle,&WinRect);
WinCurPos.x=CurPos.x - WinRect.Left;
WinCurPos.y=CurPos.y - WinRect.Top; // Get Color
CurPixel=GetPixel(GetWindowDC(WindowHandle),WinCurPos.x,WinCurPos.y); MouseColor=(TColor)CurPixel; RV=GetRValue(CurPixel);
GV=GetGValue(CurPixel);
BV=GetBValue(CurPixel);
G := (Color and $ff00) shr 8;
B := (Color and $ff0000) shr 16;
取出RGB的值
鼠标在程序窗口上,你怎么办??? 所以我用WindowFromPoint函数得到鼠标底下的窗口,不知对否???