;string; Default:Longint): Longint; Uppercase 将字串转成大写。function UpperCase(const S: string): string; SysUtils var S: string; begin S:= UpperCase( ''''???????? Intel''''); { S := ''''???????? INTEL''''} end; val 将字串内容转为数值描述。procedure Val(S; var V; var Code: Integer); System { $R+ } { $R- } var I, Code: Integer; begin Val( Edit1.Text, I, Code); { ??????????????? ????? ????????? ? ???? Edit1.Text ? ???????? ????? } if Code<>0 then { ????????? ??????? ?????? ? ????????? ????? MessageDlg( ''''?????? ???????? ? ???????: ''''+ IntToStr(Code), mtWarning,[mbOk], 0) else { ??????? ??????? ?????} Canvas.TextOut( 20, 20, IntToStr(Sqr(I))); end; ======================================== 字串处理函数 (String-handling Routines : Null-terminated) Unit: SysUtils ======================================== StrAlloc 配置一个最大长度为Size-1 的缓冲区给null 结尾字串 function StrAlloc(Size: Word): PChar; StrBufSize 传回由StrAlloc 配置的字串缓冲区内可以储存的最大字元数。 StrBufSize( S: PChar ): Cardinal; SysUtils
function StrBufSize(Str: PChar): Wrd;StrCat 连结两个字串并传回该字串。 function StrCat(Dest, Source: PCar): PChar; StrComp 比照两个字串。function StrComp(Str1, Str2 : Pchar): Integer; StrCopy 拷贝Source 字串到Dest 上。function StrCopy(Dest, Source: PChar): PChar StrDispose 释回一个字串空间。function StrDispose(Str:PChar); StrCopy 拷贝Source 字串到Dest 上并传回指向该字串结尾的指标。 function StrECopy(Dest, Surce: Pchar): Pchar; StrEnd 传回一指标指向字串的结尾function StrEnd(Str: Pchar): Pchar; StrLCat 将Source 字串连结到Dest 字串後,并传回连结的字串。 function StrLCat(Dest, Source:PCar; MaxLen: Word): PChar; StrIComp 比较两个字串具无大小写区别 function StrIComp(Str1, Str2:Pchar): Integer; StrLComp 比较两个字串到所指定的最大长度 function StrLComp(Str1, Str2:Pchar; MaxLen: Word): Integer; StrLCopy 从一字串拷贝指定字元数到另一字串 Function StrLCopy(Dest,Source:PChar;MaxLen: Cardinal): PChar; StrLen 传回字串的长度。function StrLen(Str: PChar):Cardinal; StrLIComp 比较两个字串到所指定的最大长度具无大小写区别。 function StrLIComp(Str1, Str2:PChar; MaxLen: Word):Integer; StrLower 将字串转成小写。 function StrLower(Str: PChar):PChar; StrMove 拷贝Count 字元数,从Source 到Dest字串。 function StrMove(Dest, Source:PChar; Count: Cardinal): PChar StrNew 从堆积配置一个字串。function StrNew(Str: PChar):PChar; StrPas 将null 结尾字中转成一个Pascal 格式字串。 function StrPas(Str: Pchar):String; StrPCopy 拷贝一个Pascal 格式字串到一个null结尾字串。 Function StrPCopy(Dest:PChar;Source: String): PChar; StrPLCopy 拷贝MaxLen 所指字元数,从Pascal格式字串到null 结尾字串。 Function StrPLCopy(Dest:Pchar;cost Source: string;MaxLen: Word): PChar; StrPos 传回一指标指向在Str1 内最先出现 Str2 字串的位置。 function StrPos(Str1, Str2: Pchar): Pchar; StrScan 传回一指标指向在Str 字串中第一个出现chr 字元的位置。 function StrScan(Str: PChar; Chr: Char): PChar; StrRScan 传回一指标指向在Str 子串中最後出现chr 字元的位置。 function StrRScan(Str: Pchar; Chr: Char): PChar; StrUpper 将字串转成大写。function StrUpper(Str: PChar):PChar; ======================================== 文字档案函数 (Text-file Routines) Unit: System ======================================== Append 开启一个存在的档案供增加。procedure Append(var f: Text); Eoln 判别一文字档是否在行尾。function Eoln [(var F: Text) ]:Boolean; Flush 清除文字输出档的缓冲区。procedure Flush(var F: Text); Read 从档案读入资料到所列变数。Typed files: Procedure Read(F , V1[, V2,… ,Vn ] ); Text files: procedure Read( [ var F: Text; ] V1 [,V2,… ,Vn]); Readln 从档案读入资料到所列变数并跳至下一行。 procedure Readln( [ var F:Text; ]V1 [, V2,… ,Vn ]); SeekEof 判别是否已到档尾。function SeekEof [ ( var F:Text) ]: Boolean; SeekEoln 判别一档案是否在行尾。function SeekEoln [(var F: Text) ]: Boolean; SetTextBuf 指定一个I/O 缓冲区给一文字档。procedure SetTextBuf(var F: Text; var Buf [ ; Size:Word ] ); Write 将变数内的资料写到档案。Text files: procedure Write( [ var F:Text; ] P1 [,P2,… ,Pn ] ); Typed files: procedure Write(F, V1[V2,… Vn]); writeln 执行Write 程序并输出一个跳行到档案。 procedure Writeln([ var F: Text; ] P1 [, P2,… ,Pn ] ); ======================================== 转换函数(Transfer Routines) Unit: System ======================================== Chr 传回ASCII 码所对应的字元。function Chr(X: Byte): Char; Delphi 源码任务 ( http://home.kimo.com.tw/bruce0211/ ) 打字整理15 High 传回叁数在范围内的最高值。function High(X); Low 传回叁数在范围内的最低值。function Low(X); Ord 传回一个有序型态所对应的顺序值。function Ord(X): Longint; Round 将一个实数值四舍五入而传回整数值。function Round(X: Real):Longint; Trunc 将一个实数值去尾而传回整数值。function Trunc(X: Real):Longint; ======================================== 未定型态档案函数(Untyped-file Routines) Unit: System ======================================== BlockRead 从档案读入一个或数个记录到Buf 变数。 procedure BlockRead(var F: File; var Buf;Count: Word [; var Result:Word]); BlockWrite 从一变数写入一个或数个记录。 procedure BlockWrite(var f: File; var Buf;Count: Word [; var Result:Word]); ====================================================== WinAPI 控件与消息函数 ---------------- AdjustWindowRect AdjustWindowRectEx 给定一种窗囗样式,计算获得目标客户区矩形所需的窗囗大小 ====================================================== VB声明 Declare Function AdjustWindowRect Lib "user32" Alias "AdjustWindowRect" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long Declare Function AdjustWindowRectEx Lib "user32" Alias "AdjustWindowRectEx" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long 说明 在给定一种窗囗样式的前提下,计算获得目标客户区矩形所需的窗囗大小 返回值 Long,如执行成功,则返回非零值;如失败,返回零值。会设置GetLastError
叁数表 叁数 类型及说明 lpRect RECT,最初包含要求的客户区。由函数设为目标窗囗矩形大小 dwStyle Long,窗囗样式 bMenu Long,如窗囗有菜单,则设为TRUE(非零) dwEsStyle Long,扩展窗囗样式(只适用於AdjustWindowRectEx) 注解 在调用本函数前,先用GetWindowLong取得一个窗体的样式。如菜单占用两行以上的空间,则函数不能正确计算大小。如程序使用了多行标题,则应使用GetSystemMetrics ====================================================== AnyPopup 判断屏幕上是否存在任何弹出式窗囗 ----------------------------------------- VB声明 Declare Function AnyPopup Lib "user32" Alias "AnyPopup" () As Long 说明 判断屏幕上是否存在任何弹出式窗囗 返回值 Long,如存在弹出式菜单,则返回TRUE(非零) 注解 对该函数来说,弹出式菜单包含所有可见的包容顶级窗囗,无论弹出式还是重叠窗囗 ===================================================== ArrangeIconicWindows 排列一个父窗囗的最小化子窗囗 VB声明 Declare Function ArrangeIconicWindows Lib "user32" Alias "ArrangeIconicWindows" (ByVal hwnd As Long) As Long 说明 排列一个父窗囗的最小化子窗囗(在vb里使用:用於在桌面排列图标,用GetDesktopWindow 函数获得桌面窗囗的一个句柄) 返回值 Long,图标行的高度;如失败,则返回零。会设置GetLastError 叁数表 叁数 类型及说明 hwnd Long,父窗囗的句柄 注解
也可将该函数用於包含了图标化子窗囗的的定制控件 ======================================================= AttachThreadInput 连接线程输入函数 BeginDeferWindowPos 启动构建一系列新窗囗位置的过程 BringWindowToTop 将指定的窗囗带至窗囗列表顶部 CascadeWindows 以层叠方式排列窗囗 ChildWindowFromPoint 返回父窗囗中包含了指定点的第一个子窗囗的句柄
ClientToScreen 判断窗囗内以客户区坐标表示的一个点的屏幕坐标 CloseWindow 最小化指定的窗囗 CopyRect 矩形内容复制 DeferWindowPos 该函数为特定的窗囗指定一个新窗囗位置 DestroyWindow 清除指定的窗囗以及它的所有子窗囗 DrawAnimatedRects 描绘一系列动态矩形 EnableWindow 指定的窗囗里允许或禁止所有鼠标及键盘输入 EndDeferWindowPos 同时更新DeferWindowPos调用时指定的所有窗囗的位置及状态 EnumChildWindows << 上一页 [31] [32] [33] [34] [35] 下一页 |