随笔 - 2146  文章 - 19 评论 - 11846 阅读 - 1267万

随笔分类 -  常用自定义函数、单元

上一页 1 2 3
关于 Delphi 中流的使用(9) 分割与合并文件的函数
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-01-02 16:31 万一 阅读(8062) 评论(1) 推荐(0) 编辑
关于 Delphi 中流的使用(8) 压缩与解压缩的函数
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-01-02 14:26 万一 阅读(6989) 评论(4) 推荐(2) 编辑
文件 Copy
摘要:procedure FileCopy(const FileFrom, FileTo: string); var FromF,ToF: file; NumRead,NumWritten: Integer; Buffer: array[1..2048] of Byte; begin AssignFile(FromF, FileFrom); Reset(FromF, 1); A... 阅读全文
posted @ 2007-12-19 17:49 万一 阅读(2145) 评论(0) 推荐(0) 编辑
获取本机IP地址
摘要:uses WinSock; function LocalIP: String; type TaPInAddr = Array[0..10] of PInAddr; PaPInAddr = ^TaPInAddr; var phe: PHostEnt; pptr: PaPInAddr; Buffer: Array[0..63] of AnsiChar; i: Integ... 阅读全文
posted @ 2007-12-13 02:19 万一 阅读(4643) 评论(2) 推荐(0) 编辑
TColorToHex 与 HexToTColor
摘要:function TColorToHex(Color: TColor): string; begin Result := IntToHex(GetRValue(Color), 2) + IntToHex(GetGValue(Color), 2) + IntToHex(GetBValue(Color), 2); end; function HexToTColor(sC... 阅读全文
posted @ 2007-12-12 02:43 万一 阅读(3211) 评论(7) 推荐(1) 编辑
RGBToHSB
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button... 阅读全文
posted @ 2007-12-12 02:22 万一 阅读(3686) 评论(2) 推荐(0) 编辑
汉字与 Unicode 转换
摘要:{感谢 robin(xuebin418@163.com)提供} //转换 function Str_Gb2UniCode(text: string): String; var i,len: Integer; cur: Integer; t: String; ws: WideString; begin Result := ''; ws := text; len :... 阅读全文
posted @ 2007-12-09 21:46 万一 阅读(6247) 评论(4) 推荐(0) 编辑
获取当前系统版本号
摘要:unit WinVerUtils;{#===============================================================================# Name: WinVerUtils.pas# Author: Aleksander Oven# Created: 2007-02-25# Last Change: 2007-02-25# Versio... 阅读全文
posted @ 2007-12-07 18:23 万一 阅读(4710) 评论(3) 推荐(0) 编辑
批量删除同类文件的函数
摘要:procedure DelFiles(f: string); var SearchRec: TSearchRec; begin ChDir(ExtractFilePath(f)); //进入文件路径 FindFirst(f, faAnyFile, SearchRec); repeat if FileExists(SearchRec.Name) then begi... 阅读全文
posted @ 2007-11-24 23:43 万一 阅读(3187) 评论(2) 推荐(0) 编辑
将汉字翻译成拼音缩写的函数
摘要:function GetPyChar(const HZ: AnsiString): string; const HZCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077), (2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593)... 阅读全文
posted @ 2007-11-22 16:53 万一 阅读(5239) 评论(10) 推荐(0) 编辑
10 进制转 2 进制、16 进制
摘要:function IntToBin(Value: LongInt; Size: Integer): String; var i: Integer; begin Result:=''; for i:=Size-1 downto 0 do begin if Value and (1 shl i)0 then Result:=Result+'1' else ... 阅读全文
posted @ 2007-11-22 16:18 万一 阅读(10578) 评论(4) 推荐(0) 编辑
TColor 与 RGB 的转换函数
摘要:function RGB2TColor(const R, G, B: Byte): Integer; begin // convert hexa-decimal values to RGB Result := R + G shl 8 + B shl 16; end; procedure TColor2RGB(const Color: TColor; var R, G, B: Byte... 阅读全文
posted @ 2007-11-22 15:38 万一 阅读(8899) 评论(3) 推荐(1) 编辑
字符串分割函数
摘要:推荐使用 Classes.ExtractStrings 函数. function Split(ss,s:string): TStringList; begin Result := TStringList.Create; while Pos(s,ss)>0 do begin Result.Add(Copy(ss,1,Pos(s,ss)-1)); Delete(ss,... 阅读全文
posted @ 2007-11-21 16:35 万一 阅读(5653) 评论(11) 推荐(0) 编辑
判断文件大小的函数
摘要:function GetFileSize(const FileName: String): LongInt; var SearchRec: TSearchRec; begin if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then Result := SearchRec.Size else R... 阅读全文
posted @ 2007-11-21 16:28 万一 阅读(4972) 评论(5) 推荐(0) 编辑
遍历指定目录下指定类型文件的函数
摘要:// ================================================================ // 遍历某个文件夹下某种文件, // 使用说明 //  _GetFileList(ListBox1.Items,'c:\*.doc'); // _GetFileList(MyTStringList,'c:\*.exe'); /... 阅读全文
posted @ 2007-11-21 13:42 万一 阅读(6109) 评论(13) 推荐(1) 编辑
防止程序重复执行的单元
摘要://工程引用此单元就能防止同时出现多个实例unit MultInst;interfaceuses Windows ,Messages, SysUtils, Classes, Forms;implementationconst STR_UNIQUE = '{2BE6D96E-827F-4BF9-B33E-8740412CDE96}'; MI_ACTIVEAPP = 1; {激活应用程序} MI_... 阅读全文
posted @ 2007-11-21 13:38 万一 阅读(7188) 评论(15) 推荐(1) 编辑

上一页 1 2 3


点击右上角即可分享
微信分享提示