• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

delphi常用函数三

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

TList

TList stores an array of pointers.

Unit

Classes

Description

TList, which stores an array of pointers, is often used to maintain lists of objects. TList introduces properties and methods to

Add or delete the objects in the list.

Rearrange the objects in the list.

Locate and access objects in the list.

Sort the objects in the list.

TStringList

TStringList maintains a list of strings.

Unit

Classes

Description

Use a string list object to store and manipulate a list of strings. TStringList implements the abstract properties and methods introduced by TStrings, and introduces new properties, events, and methods to

Sort the strings in the list.

Prohibit duplicate strings in sorted lists.

Respond to changes in the contents of the list.

Control whether strings are located, sorted, and identified as duplicates in a case-sensitive or case-insensitive manner.

Calling conventions

When you declare a procedure or function, you can specify a calling convention using one of the directives register, pascal, cdecl, stdcall, and safecall. For example,

function MyFunction(X, Y: Real): Real; cdecl;

...

Calling conventions determine the order in which parameters are passed to the routine. They also affect the removal of parameters from the stack, the use of registers for passing parameters, and error and exception handling. The default calling convention is register.

The register and pascal conventions pass parameters from left to right; that is, the leftmost parameter is evaluated and passed first and the rightmost parameter is evaluated and passed last. The cdecl, stdcall, and safecall conventions pass parameters from right to left.

For all conventions except cdecl, the procedure or function removes parameters from the stack upon returning. With the cdecl convention, the caller removes parameters from the stack when the call returns.

The register convention uses up to three CPU registers to pass parameters, while the other conventions pass all parameters on the stack.

The safecall convention implements exception “firewalls.” On Windows, this implements interprocess COM error notification.

The table below summarizes calling conventions.

Directive Parameter order Clean-up Passes parameters in registers?

register Left-to-right Routine Yes

pascal Left-to-right Routine No

cdecl Right-to-left Caller No

stdcall Right-to-left Routine No

safecall Right-to-left Routine No

The default register convention is the most efficient, since it usually avoids creation of a stack frame. (Access methods for published properties must use register.) The cdecl convention is useful when you call functions from shared libraries written in C or C++, while stdcall and safecall are recommended, in general, for calls to external code. On Windows, the operating system APIs are stdcall and safecall. Other operating systems generally use cdecl. (Note that stdcall is more efficient than cdecl.)

The safecall convention must be used for declaring dual-interface methods. The pascal convention is maintained for backward compatibility. For more information on calling conventions, see Program control.

The directives near, far, and export refer to calling conventions in 16-bit Windows programming. They have no effect in 32-bit applications and are maintained for backward compatibility only.

Character pointers

The fundamental types PAnsiChar and PWideChar represent pointers to AnsiChar and WideChar values, respectively. The generic PChar represents a pointer to a Char (that is, in its current implementation, to an AnsiChar). These character pointers are used to manipulate null-terminated strings. (See Working with null-terminated strings.)

TResourceStream

TResourceStream is a memory stream that provides access to the compiled resources in aWindows application.

Unit

Classes

Description

Use TResourceStream to read the resources of aWindows application. An instance of TResourceStream holds the value of a single resource in a memory buffer where it is accessible to the application.

The global ReadComponentRes function uses TResourceStream to access the compiled resources used by the application.

MkDir procedure

Creates a new subdirectory.

Unit

System

Category

I/O routines

procedure MkDir(const S: string); overload;

procedure MkDir(P: PChar); overload;

Description

MkDir creates a new subdirectory with the path specified by string S or P. The last item in the path cannot be an existing file name.

Note: {$I+} handles run-time errors using exceptions. When using {$I-}, use IOResult to check for an I/O error.

Example

uses Dialogs;

begin

{$I-}

{ Get directory name from TEdit control }

MkDir(Edit1.Text);

if IOResult <> 0 then

MessageDlg('Cannot create directory', mtWarning, [mbOk], 0)

else

MessageDlg('New directory created', mtInformation, [mbOk], 0);

end;

TSysCharSet type

Represents a set of characters that are used as separators when parsing a string.

Unit

SysUtils

type TSysCharSet = set of Char;

Description

TSysCharSet is a set containing special characters that can be used to parse a string. The elements of the set vary, depending on the type of parsing performed.


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab无法使用发布时间:2022-07-18
下一篇:
Matlab将RGB图像转换成YCrCb图像发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap