获取程序自身大小的函数
摘要:function GetExeSize: Int64;var SearchRec: TSearchRec;begin Result := -1; if FindFirst(Application.ExeName, faAnyFile, SearchRec) = 0 then Result := SearchRec.Size;end;
阅读全文
posted @
2011-11-10 14:44
万一
阅读(3124)
推荐(0) 编辑
获取打印页号列表
摘要:procedure SplitCommaCross(aList: TStrings); procedure SPlitCross(aList: TStrings); var LList: TStrings; a,b: Integer; i: Integer; begin if Pos('-', aList.Text)
阅读全文
posted @
2011-06-28 11:18
万一
阅读(1695)
推荐(0) 编辑
解析 png 图片的十六进制字符流的函数 - 回复 "黑人" 的问题
摘要:问题来源:http://www.cnblogs.com/del/archive/2010/04/24/1719631.html#2079634使用下面的 Hex2Png() 函数解析黑人给的数据,结果是一个 93396 的验证码图片。uses pngimage;{从 png 图片到十六进制字符串}function Png2Hex(png: TPngImage): string;var stream: TMemoryStream;begin stream := TMemoryStream.Create; png.SaveToStream(stream); SetLength(Result, st
阅读全文
posted @
2011-04-26 22:53
万一
阅读(4637)
推荐(0) 编辑
使用 BinToHex() 把 TBytes 转换为十六进制字符串 - 回复 "梧桐栖凤" 的问题
摘要:{函数}function BytestoHexString(ABytes: TBytes; len: Integer): AnsiString;begin SetLength(Result, len*2); BinToHex(@ABytes[0], PAnsiChar(Result), len);end;{测试}procedure TForm1.FormCreate(Sender: TObje...
阅读全文
posted @
2011-01-27 18:17
万一
阅读(8037)
推荐(0) 编辑
输出用空格对齐字符串的函数 - 回复 "老A123" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2007/12/18/1005161.html#1786227
阅读全文
posted @
2010-03-24 16:47
万一
阅读(2928)
推荐(0) 编辑
反转内存的函数
摘要://按单字节反转内存的函数procedure ReverseMemory(P: PByte; Len: Integer); overload;var B: Byte; P2: PByte;begin P2 := P; Inc(P2, Len - 1); while Integer(P)
阅读全文
posted @
2009-11-12 16:49
万一
阅读(3127)
推荐(0) 编辑
将字符串转换成 UTF8 编码的函数
摘要:这种转换一般用于网页地址; 我不知道 Delphi 是不是有现成的函数, 用到了就写了一个.为 "小月124" 写了个反向函数:
阅读全文
posted @
2009-10-27 22:32
万一
阅读(15908)
推荐(0) 编辑
简体中文与繁体中文的转换函数
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TOb...
阅读全文
posted @
2009-10-13 13:54
万一
阅读(4154)
推荐(0) 编辑
极快的正整数排序函数
摘要:实现原理: 对比二进制位. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; M...
阅读全文
posted @
2009-05-01 01:22
万一
阅读(4743)
推荐(0) 编辑
把 Integer 数组保存到文件、并读取
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton...
阅读全文
posted @
2009-04-14 20:40
万一
阅读(4562)
推荐(0) 编辑
从字符串中提取单词、从字符串中提取汉字的函数
摘要:{从字符串中提取单词的函数} procedure StrToWordList(str: string; var List: TStringList); var p: PChar; i: Integer; begin if List = nil then List := TStringList.Create; List.Clear; {去除重复} List.Sorted ...
阅读全文
posted @
2009-04-14 15:55
万一
阅读(6864)
推荐(0) 编辑
读十六进制文本到 Btye 数组的函数 - 回复 "峰哥!!!" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2009/03/10/1407220.html#1472741 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, St...
阅读全文
posted @
2009-03-10 13:09
万一
阅读(3699)
推荐(0) 编辑
最大公约数与最小公倍数
摘要:本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; E...
阅读全文
posted @
2009-03-10 10:26
万一
阅读(3276)
推荐(0) 编辑
读文件到十六进制的函数(Delphi 7 下可用) - 回复 "峰哥!!!" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2009/03/09/1284244.html#1472084 {函数} function ReadFileToHex(FileName: string): string; var b: Byte; begin Result := ''; if not FileExists(FileName) the...
阅读全文
posted @
2009-03-09 18:18
万一
阅读(4168)
推荐(1) 编辑
非官方的 TWaitableTimer 类
摘要:unit WTimer;interfaceuses Windows, SysUtils, SyncObjs;type TWaitableTimer = class(TSynchroObject) protected FHandle: THandle; FPeriod: LongInt; FDueTime: TDateTime; FLastError: Integer; FLongTime: ...
阅读全文
posted @
2009-02-19 15:27
万一
阅读(4793)
推荐(0) 编辑
从 EXE 或 DLL 中获取图标的函数 - 回复 "小李子子" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/12/25/1070115.html#1413353 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, St...
阅读全文
posted @
2008-12-26 11:52
万一
阅读(2994)
推荐(0) 编辑
获取一个窗口的所有子窗口(包括嵌套) - 回复 "asian" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/12/10/1345752.html#1397451 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls...
阅读全文
posted @
2008-12-11 09:42
万一
阅读(6436)
推荐(0) 编辑
重写一个字符串分割函数 - 回复 "tomzw" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/11/27/967440.html#1384363 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;...
阅读全文
posted @
2008-11-27 21:11
万一
阅读(6193)
推荐(0) 编辑
设置屏幕分辨率的函数 - 回复 "董勇" 的问题
摘要:{函数} function SetScreen(x,y: Word): Boolean; var DevMode: TDeviceMode; begin Result := EnumDisplaySettings(nil, 0, DevMode); if Result then begin DevMode.dmFields := DM_PELSWIDTH or DM_P...
阅读全文
posted @
2008-11-19 17:14
万一
阅读(2989)
推荐(0) 编辑