摘要: 1 procedure RgbToHsv(R, G, B: Byte; var H, S, V: Single); 2 var 3 mx, mn: Byte; 4 tmp: Single; 5 begin 6 mx := R; 7 mn := R; 8 if mx G then mn := G; 11 if mn > B then mn := B; 12... 阅读全文
posted @ 2017-11-25 15:28 伯通心智 阅读(380) 评论(0) 推荐(0) 编辑
摘要: //AValue 为图片文件流头两个字节 function GetImageExt(AValue: Cardinal): String; begin case AValue of $4D42, $424D: Result := '.bmp'; $D8FF, $FFD8: Result := '.jpg'; $4947, $4749: Result := '.gif';... 阅读全文
posted @ 2016-12-10 13:14 伯通心智 阅读(954) 评论(0) 推荐(0) 编辑
摘要: unit UCallHwnd; interface uses Classes, Messages, Windows; const WM_USER_MSG = WM_USER + 1; type TCallHwnd = class(TObject) private FHwnd: THandle; protected procedure DoUserMes... 阅读全文
posted @ 2016-11-26 09:25 伯通心智 阅读(1421) 评论(0) 推荐(0) 编辑
摘要: ///遍历文件 ///AList: 遍历所得文件列表,全路径 ///APath: 遍历目录 ///AExt: 遍历文件扩展名 procedure gFileList(AList: TStringList; const APath, AExt: String); var str: String; sch:TSearchrec; begin if AList = nil then Exi... 阅读全文
posted @ 2016-11-25 23:36 伯通心智 阅读(916) 评论(0) 推荐(0) 编辑
摘要: uses Tlhelp32; function KillTask(ATask: string): Boolean; var Loop: Boolean; hd: THandle; pe: TProcessEntry32; begin Result := False; hd := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0)... 阅读全文
posted @ 2016-11-25 23:30 伯通心智 阅读(725) 评论(0) 推荐(0) 编辑
摘要: windows下多屏支持一个简单的思路就是找到显示器的区域(EnumDisplayMonitors),并把相应的窗口移动到目标区域(windows API: MoveWindow)。下面是一个简单的查找显示区域方法,gRects为查找到的显示区域,gMCount为查找到的个数。 1 unit Enu 阅读全文
posted @ 2015-01-06 20:58 伯通心智 阅读(845) 评论(0) 推荐(0) 编辑
摘要: 做远程控制相关软件(远程办公、远程教育、远程协助等)时,鼠标、按键模拟必不可少。在windows环境下,windows API提供的两个方法可以很方便的完成鼠标、按键的模拟:mouse_event、keybd_event。模拟鼠标按键单击时,首先要计算鼠标位置X、Y(使用ClientToScreen 阅读全文
posted @ 2015-01-04 20:04 伯通心智 阅读(2859) 评论(0) 推荐(0) 编辑
摘要: 这篇文章记录了我刚接触IOCP模型时的理解,对于初学者,应该算不错的调试程序,仅有一个400多行代码的dpr文件,可以直接用WriteLn输出信息,前提是会用delphi建立Console Application,当然你也可以很容易的就改成了C控制台程序或是其它语言。附加代码中有详细的注释,如果你已 阅读全文
posted @ 2015-01-01 23:34 伯通心智 阅读(2457) 评论(0) 推荐(0) 编辑