delphi参考手册(4read.pudn.com/downloads73/ebook/13289/delphi参考手册.doc · web...

Download Delphi参考手册(4read.pudn.com/downloads73/ebook/13289/Delphi参考手册.doc · Web viewDelphi参考手册(4.0) 第一部分 关于Delphi 4.0 第一章 Delphi 4 新 特 性 Delphi

If you can't read please download the document

Upload: hoangdung

Post on 09-Mar-2018

485 views

Category:

Documents


226 download

TRANSCRIPT

Delphi(4

Delphi(4.0)

Delphi 4.0

Delphi 4

Delphi 4

---- Delphi 4 Borland Inprise Delphi 4

Advanced Debugging

---- Delph 4 DLL DLL Delphi 4 Windows Delphi 4

CodeInsight

---- CodeInsight Delphi 3 CodeInsight Delphi 4

---- Delphi 4 (Class) Delphi Pascal

---- Delphi 4

---- if ... then ... else for ... do Delphi 4 Delphi 4

---- Delphi 4

---- Delphi 4

BusinessInsight

---- BusinessInsight

---- DecisionCube TDecisionCube TDecisionQuery

---- TeeCharts

---- QuickReport

ActiveInsight

---- Delphi 4 ActiveX ActiveX ActiveForm OLE DAX

---- Delphi 4 COM COM Delphi 4 Visual BasicJavaC Client/Server COM Delphi 4 VCL Internet/Intranet Delphi 4

Internet

---- Delphi 4 Internet WinSock HTTPUDPFTPSMTPPOP3 NNTP Delphi 4 Web WebBridge NSAPI ISAPI WebModules Web WebDispatcher HTTP HTTP ActiveForm Remote DataBroker Client/Server Internet/Intranet

---- Delphi 4 Delphi 4 TDBGridTDBEdit

---- Delphi 4 Oracle BLOB(Binary Large Object) Delphi 4 Oracle 8 (ADT) (Business Objects) Oracle Form

MIDAS

---- Delphi 4 Client/Server Inprise MIDAS(Multi Tiered Distributed Application Services)

---- Business Broker

---- OLEnterprise Client/Server

---- Remote Data Broker Client/Server ( ) Remote Data Broker

---- MIDAS Master/Detail ( ) Delphi 4

---- Delphi 4 Delphi 4 Deferred BLOB BLOB BLOB BLOB

---- Delphi 4 TMIDASConnection TMIDASConnection TCP/IPCORBA DCOM Delphi 3 TremoteServer

---- Delphi 4 Microsoft Transaction Server(MTS)MTS Microsoft ActiveXMTS MTS X/Open XA MTS

---- Delphi 4 Delphi 4 Delphi 4 Delphi 4

Delphi4

Borland Delphi 4.0

Borland MIDAS

Delphi1.0

1.1 Delphi 4.0

1.1.1

1.1.2 BDE

1.1.3 VCL

1.1.3.1

1.1.3.2

1.1.3

1. 2

1 Tools|Evironment Options

2 Preferences

Desktop Contents

Desktop only

Desktop and symbolsDesktop only

Auto save

Form Designer(Grid)

Debugging

1.3

1.3.1

1.3.2

Delphi Object Pascal

2.1 Object Pascal

Delphi(Form)DelphiFormsFormDelphi(Form)

unit Unit1; { }

interface { }

uses

SysUtils,WinTypes,WinProcs,Messages,Classes,Graphics,Controls,Forms,Dialogs;

type { }

Tform1=class(TForm)

private

{}

putlic

{}

end;

var{ }

Form1:TForm1;

implementation{ }

{$R*DFM}

end.

DelphiDelphiDelphiUSESDelphi

2.2 Object Pascal

2.2.1 Integer types

An integer type represents a subset of the whole numbers. The generic integer types are Integer and Cardinal; use these whenever possible, since they result in the best performance for the underlying CPU and operating system. The table below gives their ranges and storage formats for the current 32-bit Object Pascal compiler.

Type

Range

Format

Integer

*2147483648..2147483647

signed 32-bit

Cardinal

0..4294967295

unsigned 32-bit

Fundamental integer types include Shortint, Smallint, Longint, Int64, Byte, Word, and Longword.

Type

Range

Format

Shortint

*128..127

signed 8-bit

Smallint

*32768..32767

signed 16-bit

Longint

*2147483648..2147483647

signed 32-bit

Int64

*2^63..2^63*1

signed 64-bit

Byte

0..255

unsigned 8-bit

Word

0..65535

unsigned 16-bit

Longword

0..4294967295

unsigned 32-bit

In general, arithmetic operations on integers return a value of type Integerhich, in its current implementation, is equivalent to the 32-bit Longint. Operations return a value of type Int64 only when performed on an Int64 operand. Hence the following code produces incorrect results.

var

I: Integer;

J: Int64;

...

I := High(Integer);

J := I + 1;

To get an Int64 return value in this situation, cast I as Int64:

...

J := Int64(I) + 1;

For more information, see Arithmetic operators.

Note:Most standard routines that take integer arguments truncate Int64 values to 32 bits. However, the High, Low, Succ, Pred, Inc, Dec, IntToStr, and IntToHex routines fully support Int64 arguments. Also, the Round, Trunc, StrToInt64, and StrToInt64Def functions return Int64 values. A few routinesncluding Ordannot take Int64 values at all.

When you increment the last value or decrement the first value of an integer type, the result wraps around the beginning or end of the range. For example, the Shortint type has the range *128..127; hence, after execution of the code

var I: Shortint;

...

I := High(Shortint);

I := I + 1;

the value of I is *128. If compiler range-checking is enabled, however, this code generates a runtime error.

2.2.2 Character types

Topic groupSee also

The fundamental character types are AnsiChar and WideChar. AnsiChar values are byte-sized (8-bit) characters ordered according to the extended ANSI character set. WideChar values are word-sized (16-bit) characters ordered according to the Unicode character set. The first 256 Unicode characters correspond to the ANSI characters.

The generic character type is Char, which is equivalent to AnsiChar. Because the implementation of Char is subject to change, it a good idea to use the standard function

SizeOf rather than a hard-coded constant when writing programs that may need to handle characters of different sizes.

A string constant of length 1, such as 'A', can denote a character value. The predefined function Chr returns the character value for any integer in the range of AnsiChar or

WideChar; for example, Chr(65) returns the letter A.

Character values, like integers, wrap around when decremented or incremented past the beginning or end of their range (unless range-checking is enabled). For example, after execution of the code

var

Letter: Char;

I: Integer;

begin

Letter := High(Letter);

for I := 1 to 66 do

Inc(Letter);

end;

Letter has the value A (ASCII 65).

2.2.3 Character types

Topic group

Delphi has three character types: Char, AnsiChar, and WideChar.

TheChar character type came from Standard Pascal, and was used in Turbo Pascal and then in Object Pascal. Later Object Pascal added AnsiChar and WideChar as specific character types that were used to support standards for character representation on the Windows operating system. AnsiChar was introduced to support an 8-bit character ANSI standard, and WideChar was introduced to support a 16-bit Unicode standard. The name WideChar is used because Unicode characters are also known as wide characters. Wide characters are two bytes instead of one, so that the character set can represent many more different characters. When AnsiChar and WideChar were implemented, Char became the default character type representing the currently recommended implementation. If you use Char in your application, remember that its implementation is subject to change in future versions of Delphi.

The following table summarizes these character types:

Type

Bytes

Contents

Purpose

Char

1

Holds a single ANSI character.

Default character type.

AnsiChar

1

Holds a single ANSI character.

8-bit Ansi character standard on Windows.

WideChar

2

Holds a single Unicode character.

16-bit Unicode standard on Windows.

For more information about using these character types, see "Character types*. For more information about Unicode characters, see "About extended character sets*.

2.2.4 Real types

Topic groupSee also

A real type defines a set of numbers that can be represented with floating-point notation. The table below gives the ranges and storage formats for the fundamental real types.

Type

Range

Significant digits

Size in bytes

Real48

2.9 x 10^*39 .. 1.7 x 10^38

11*12

6

Single

1.5 x 10^*45 .. 3.4 x 10^38

7*8

4

Double

5.0 x 10^*324 .. 1.7 x 10^308

15*16

8

Extended

3.6 x 10^*4951 .. 1.1 x 10^4932

19*20

10

Comp

*2^63+1 .. 2^63 *1

19*20

8

Currency

*922337203685477.5808.. 922337203685477.5807

19*20

8

The generic type Real, in its current implementation, is equivalent to Double.

Type

Range

Significant digits

Size in bytes

Real

5.0 x 10^*324 .. 1.7 x 10^308

15*16

8

Note:The six-byte Real48 type was called Real in earlier versions of Object Pascal. If you are recompiling code that uses the older, six-byte Real type, you may want to change it to Real48. You can also use the {$REALCOMPATIBILITY ON} compiler directive to turn Real back into the six-byte type.

The following remarks apply to fundamental real types.

Real48 is maintained for backward compatibility. Since its storage format is not native to the Intel CPU family, it results in slower performance than other floating-point types.

Extended offers greater precision than other real types but is less portable. Be careful using Extended if you are creating data files to share across platforms.

The Comp (computational) type is native to the Intel CPU and represents a 64-bit integer. It is classified as a real, however, because it does not behave like an ordinal type. (For example, you cannot increment or decrement a Comp value.) Comp is maintained for backward compatibility only. Use the Int64 type for better performance.

Currency is a fixed-point data type that minimizes rounding errors in monetary calculations. It is stored as a scaled 64-bit integer with the four least-significant digits implicitly representing decimal places. When mixed with other real types in assignments and expressions, Currency values are automatically divided or multiplied by 10000.

2.2.5 Boolean types

Topic groupSee also

The four predefined Boolean types are Boolean, ByteBool, WordBool, and LongBool. Boolean is the preferred type. The others exist to provide compatibility with different languages and the Windows environment.

A Boolean variable occupies one byte of memory, a ByteBool variable also occupies one byte, a WordBool variable occupies two bytes (one word), and a LongBool variable occupies four bytes (two words).

Boolean values are denoted by the predefined constants True and False. The following relationships hold.

Boolean

ByteBool, WordBool, LongBool

False < True

False True

Ord(False) = 0

Ord(False) = 0

Ord(True) = 1

Ord(True) 0

Succ(False) = True

Succ(False) = True

Pred(True) = False

Pred(False) = True

A value of type ByteBool, LongBool, or WordBool is considered True when its ordinality is nonzero. If such a value appears in a context where a Boolean is expected, the compiler automatically converts any value of nonzero ordinality to True.

The remarks above refer to the ordinality of Boolean valuesot to the values themselves. In Object Pascal, Boolean expressions cannot be equated with integers or reals. Hence, if X is an integer variable, the statement

if X then ...;

generates a compilation error. Casting the variable to a Boolean type is unreliable, but each of the following alternatives will work.

if X 0 then ...; { use longer expression that returns Boolean value }

var OK: Boolean { use Boolean variable }

...

if X 0 then OK := True;

if OK then ...;

2.2.6 String types

Topic groupSee also

A string represents a sequence of characters. Object Pascal supports the following predefined string types.

TypeMaximum lengthMemory requiredUsed for

ShortString255 characters2 to 256 bytesbackward compatibility

AnsiString~2^31 characters4 bytes to 2GB8-bit (ANSI) characters

WideString~2^30 characters4 bytes to 2GBUnicode characters;

COM servers and interfaces

AnsiString, sometimes called the long string, is the preferred type for most purposes.

String types can be mixed in assignments and expressions; the compiler automatically performs required conversions. But strings passed by reference to a function or procedure (as var and out parameters) must be of the appropriate type. Strings can be explicitly cast to a different string type (see Typecasts).

The reserved word string functions like a generic type identifier. For example,

var S: string;

creates a variable S that holds a string. In the default {$H+} state, the compiler interprets string (when it appears without a bracketed number after it) as AnsiString. Use the {$H directive to turn string into ShortString.

The standard function Length returns the number of characters in a string. The SetLength procedure adjusts the length of a string.

Comparison of strings is defined by the ordering of the characters in corresponding positions. Between strings of unequal length, each character in the longer string without a corresponding character in the shorter string takes on a greater-than value. For example, B* is greater than *; that is, 'AB' > 'A' returns True. Zero-length strings hold the lowest values.

You can index a string variable just as you would an array. If S is a string variable and i an integer expression, S[i] represents the ith character in S. For a ShortString or

AnsiString, S[i] is of type AnsiChar; for a WideString, S[i] is of type WideChar. The statement MyString[2] := 'A'; assigns the value A to the second character of MyString. The following code uses the standard UpCase function to convert MyString to upper-case.

var I: Integer;

begin

I := Length(MyString);

while I > 0 do

begin

MyString[I] := UpCase(MyString[I]);

I := I - 1;

end;

end;

Be careful indexing strings in this way, since overwriting the end of a string can cause access violations. Also, avoid passing long-string indexes as var parameters, because this results in inefficient code.

You can assign the value of a string constantr any other expression that returns a stringo a variable. The length of the string changes dynamically when the assignment is made. Examples:

MyString := 'Hello world!';

MyString := 'Hello ' + 'world';

MyString := MyString + '!';

MyString := ' '; { space }

MyString := ''; { empty string }

1.(TOKEN)

1.1 (Symbols)

(Letters) : A..Z , a..z

(Digits) : 0..9

(Hex Digits) : 0..9,A..F(OR a..f)

(Blank) : ASCII 32

:+-*/=[].,():;^@{}$#

:=,:=,..,(*,*),(.,.)

1.2 (Identifiers)

:,,,,,,,....

:63,

:,_

, : Unit1.IdentName

1.3 (Label) : 0..9999 or

1.4

'ATTN' ----------- ATTN

'You''ll see' ---- Yoy'll see

'' ---------------

' ' --------------

'Line 1'#13#10'Line 2' ------ Line 1

Line 2

1.5

{ xxxxxxx }

{ xxxxxxxx

xxxxxx

xxxxx }

// xxxxxxxx

2. ( = )

2.1

CONST

Min = 0;

Max = 100;

Center = ( Max - Min ) Div 2;

Blank = Chr(32);

NumChr = Ord('Z') - Ord('A') + 1;

ErrMsg = 'Out Of Rang';

ErrDtl = 'Out Of Rang' + ':Item 10';

Numeric = [ '0'..'9' ];

Alpha = [ 'A'..'Z','a'..'z'];

AlphNum = Alpha + Numeric;

2.1(Typed constant)

CONST

MaxInt : Integer = 9999;

FixReal : Real = -0.12;

ListStr : String[4] = 'This';

AA : Pchar = 'abcedf';

Dim : Array[0..1,0..1,0..1] of Integer = (((0,1),(2,3)),((4,5),(6,7)));

{ Dim(0,0,0) = 0 Dim(0,0,1) = 1

Dim(0,1,0) = 2 Dim(0,1,1) = 3

Dim(1,0,0) = 4 Dim(1,0,1) = 5

Dim(1,1,0) = 6 Dim(1,1,1) = 7 }

--------------------------------

TYPE

Trec = record

fl1,fl2 : Integer;

end;

CONST

IntRec : Trec = ( fl1:1;fl2:2);

------------------------------------------

3. ( = ) : ,

3.1 (1)

TYPE

Trang = Integer;

TNumber = Integer;

TColor = ( Red , Green , Blue );

TCharVal = Ord('A')..Ord('Z');

TtestIndex = 1..100;

TtestValue = -99..99;

TtestList = Array[TtestIndex] of Ttestvalue;

ptestList = ^TtestList; =>

Tdate = Class

Year : Integer;

Month : 1..12;

Day : 1..31;

Procedure SetDate(D,M,Y:Integer);

Function ShowDate : String;

end;

TMeasureList = Array[1..50] of TMeasuredate;

Tname = String[80]; =>

Tsex = (Male , Female); =>0 1

PpersonData = record

Name , FirstName : Tname;

Age : Integer;

Married : Boolean;

TFather,TChild,TSibling : PPersonData;

Case s: Tsex of =>01

Maie : ( Bearded : Boolean );

Female : (Pregnant : Boolean );

End;

TPersonBuf = Array[0..Size(TPsersonData) - 1 ] of Byte;

TPeople = File Of TPersonData; =>type

3.2

3.2.1

(1):

(Fundmental)

Shortint -128..127 8-bit

Smallint -32768..32767 16-bit

Longint -2147483648..2147483647 32-bit

Byte 0..255 8-bit

Word 0.65535 16-bit

(Generic)

Integer -2147483648..2147483647 32-bit

Cardinal 0..2147483647 32-bit

16bit

Integer -32768..32767 16-bit

Cardinal 0.65535 16-bit

(2)

(Fundmental)

AnsiChar ASCII 1-Byt

WideChar Unicode 2-Byt

(Generic)

Char ASCII 1-Byt

(3)(Enumerated Type)

==============================================

TColor = ( Red , Green , Blue );

==============================================

(4)(Boolean Type)

(Fundmental)

ByteBool 0..1 1-Byt

WordBool 0..1 2-Byt

LongBool 0..1 4-Byt

(Generic)

Boolean 1-Byt

==============================================

Married : Boolean;

False < True

Ord(False) = 0

Ord(True) = 1

Succ(False)=True

Pred(True)=False

==============================================

(5)(Subrang type)

==============================================

TtestIndex = 1..100;

==============================================

3.2.2

Real 11-12 6

Single 7-8 4

Douible 15-16 8

ExTended 10-20 10

Comp 19-20 8

Currency 19-20 8

===================================================

Real 6byt 48 bit

1-1 2-40 41-48

s f e

v

if ( e > 0 ) and ( e arrey

Var

V1,V2,V3,V4,V5 : Variant;

I : Integer;

D:Double;

S:String;

Begin

V1 := 1;

V2 := 1234.5678;

V3 := 'This is test';

V4 := '1000';

V5 := V1 + V2 + V4; { 2235.5678}

I := V1; {I = 1 }

D := V2; {D = 1234.5678}

S := V3; {S = 'This is test'}

I := V4; {I = 1000}

S := V5; {S = '2235.5678'}

end;

,,

(2)

var

A : Variant; =>

I : Integer;

Begin

A := VarArrayCreate([0,4],VarOleStr);

For I := 0 to 4 Do A[I] := 'AAAA';

VarArrayRedim( A , 9 ); =>

For I := 5 to 9 Do A[I] := 'BBBB';

end;

4. ( : ) : ,

4.1

X,Y,Z : Double;

I,J,K : Integer;

Dig :0..9;

C : Color;

Done,Error : Boolean; =>byts

Operater : ( Plus , Munus , Times );

H1,H2 : Set Of Color;

Today : Date;

MyDim : Array[1..10,1..5] Of Double;

4.2 :

4.3 :

4.3 : MyInt : Integer = 123; {}

4.4 :

4.4.1 : MyDim[I][J] MyDim[I,J]

4.4.2 : MyRec.MyField {with

4.4.3 : form1.Button1.Caption

4.4.4: p1^,@p1

4.5

{-1}

TYPE

TbyteRec = record

Fl1 , Fl2: Byte;

end;

VAR

W : Word;

B : Byte;

Begin

W := 256 * 10 + 128;

B := TbyteRec(W).Fl1; { B = 10}

*** word >byte

B := TbyteRec(W).Fl2; { B = 128}

end;

{-2}

With Sender as Mdbedit do =>

Text := 'This is test';

{-3}

Mdbedit( Sender ).Text := 'This is test';

5.

5.1

(1)@,not =>@

(2)*,/,div,mod,and,shl,shr,as

(3)+,-,or,xor

(4)=,,,=,in,is

5.2 () ,

5.3 ,

5.4 (short-Circuit)

while (I in

In :

type

Month = ( Jan , Feb , Mar , Apr , May , Jun , Jul , Aug , Sep , Oct , Nov , Dec );

Spring = set of Feb..Apr..Mar;

Mstr = array[ 0 .. 11 ] of string[ 3 ];

const

CMstr : Mstr = ( 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov' , 'Dec' );

var

M : Month;

SSpring : Spring;

begin

SSpring := [ Feb..Apr ];

writeln( 'The Spring Month is : ' );

for M := Jan to Dec do

if M in SSpring then

writeln( CMstr[ Ord( M ) ] );

end;

5.5.6 :is , As

if ( Sender is Mbutten ) and

( Mbutten( Sender ).tag 0 ) then ...;

with Sender As Mdbedit do

text := 'aaaaaa';

5.5.7 :@

5.5.8 :^

var

M , N : integer;

P1 , P2 : ^integer; =>

begin

M := 6;

P1 := @M; =>@

Label1.Caption := 'P1^ = ' + IntToStr( P1^ );

P2 := P1;

N := P2^;

Label2.Caption := 'N = ' + IntToStr( N );

end;

6.

6.1 goto

label aa;

var i : integer;

begin

.

.

if (i = 0) then goto aa;

aa:begin

.

.

end;

end;

6.2 if

if ( x > 10 ) and {()}

( y > 5 ) then

z := x + y { ;}

else z := 2 * ( x + y );

6.3 case

var

s : string;

r : integer;

begin

if s '' then

begin

case s[1] of =>SBYTE

'1' : r := 1; =>

'2' : r := 2;

'3' : r := 3;

else r := 4;

end;

end;

6.4 while

While ( i > 0 ) do

begin

x = X + I;

I = I - 1;

end;

while True do

begin

if ( i = 0 ) then break; =>break

x = X + I;

I = I - 1;

end;

6.5 Repeat =>

repeat

k:= i mod j;

i := j;

j := k;

until j = 0;

6.6 for

for i := 1 to 10 do

begin

if i = 5 then continue;

x := X + I;

end;

7.

7.1

unit

interface {}

uses < list of units>;

{public declarations}

Implementation {}

uses < list of units>;

{Private declarations}

{implementation of procedure and function}

end.

7.2

uses < unitname list>;

unitname .dcu

, include source file

,

unit.IdName

7.3

program prog;

uses unit1;

const a = b;

begin

end.

unit unit1;

interface

uses unit2;

const b = c;

implementation

end.

unit unit2;

interface

const c = 1;

implementation

const d = 2;

end.

7.4

,(Circular unit references),

uses implementation

program prog;

uses unit1;

const a = b;

begin

end.

unit unit1;

interface

uses unit2;

const b = c;

implementation

end.

unit unit2;

interface

const c = 1;

implementation

uses unit1; {}

const d = b;

end.

8.

8.1 : procedure ( ;..);

label {}

type {}

var {}

procedure

function

begin

{exit;}

end;

: Procedure print( pStr : String );

begin

writeln( Pstr );

end;

8.2 : function ( ;..):;

label {}

const {}

type {}

var {}

procedure

function

begin

{exit;}

end;

function add( n1 , n2 : Integer ) : Integer;

begin

add := n1 + n2;

{ result := N1 + N2; }

end;

8.3

procedure Add( Var sum : Integer ; n1 , n2 : integer );

begin ---{}

sum := n1 + n2;

n1 := 0;

n2 := 0;

end;

procedure test;

var

sum , a , b : integer;

begin

a := 100;

b := 200;

add( sum , a , b ); {sum = 300 , a = 100 , b = 200 }

end;

8.3 forward ()

interface !,forword

procedure add( Var sum : integer ;n1 , n2 : integer ); forward;

procedure base;

var sum : integer;

begin

add(sum,4,5);

end;

procedure add ( Var sum : integer ;n1 , n2 : integer );

begin

sum := n1 + n2;

end;

8.4 External ()

Function MessageBox( Hwnd : Integer ;

text , caption : Pchar;

Flags : Integer ) : Integer ; Stdcall;

external 'User32.dll' Name 'MessageBoxa';

8.5

register pascal

pascal pascal or c

cdecl pascal or c

stdcall Windows Api

9.

9.1 raise( )

-1 : raise ,, Create

:SysUtils Execption

constructor Exception.Create(const Msg: string);

begin

FMessage := Msg;

end;

constructor Exception.CreateFmt(const Msg: string;

const Args: array of const);

begin

FMessage := Format(Msg, Args);

end;

--------------------------------------------------

Function StrToIntRange( Var s:string;Min,Max:Longint):Longint;

begin

Result := StrToInt(s);

If ( Result < Min ) or

( result > Max ) then

raise ERangeError.CreateFmt( %d is not within the valid range of %d..%d',

end; [result,Min,Max]);

-2 :raise ,

,

9.2 Try ... Except

try

.

.

except

on Errorclass1 do ..;

on Errorclass2 do ..;

on Errorclass3 do ..;

else

{othes handle...};

end;

on ... do

try

.

.

except

{exception handle}

end;

-1

try

result := sum div num;

except

on EZeroDivide do result := 0;

on EOverFlow do result := 0;

on EMatherror do result := 0;

{,}

else

result := 0;

end;

9.3 Try ... Finally

:

reset(F);

try

processFile(F);

finally

closeFile(F);

end;

9.4 exit , break , continue try .. finally

:

procedure TForm1.MButton1Click(Sender: TObject);

var

I : integer;

s : string;

begin

I := 10;

s := '!';

try

while I 0 do

begin

I := I - 1;

if I = 5 then

begin

s := 'exit ';

exit;

end;

end;

finally

Showmessage(s); {exit }

end;

end;

10.DLL (}

10.1 DLL

project (Statically Linked),DLLs

(Dynamically Linked),Projectl DDLs

DLLs windows DLL ,

10.2 DLL

(1) ()

Procedure ImportByName; External 'TestLib.dll';

(2)

Procedure ImportByNewName;

External 'TestLib.dll' name 'ImportByName';

(3) ()

Procedure ImportByOrdName;

External 'TestLib.dll' Index 1;

(4) Windows Api

Function MessageBox( Hwnd: Integer ; Text,Caption:Pchr

Flags:Integer):Integer;Stdcall;

External 'User32.dll' Name 'MessageBox';

(5)

(-1):Delphi uses windows

(-2):

unit DateTime;{}

interface

type

TTimeRec = Record

ss : integer;

mi : Integer;

hh : Integer;

end;

type

TDateRec = Record

yy:Integer;

mm:Integer;

dd:Integer;

end;

Procedure SetTime(Var Time:TTimeRec);

Procedure GetTime(Var Time:TTimeRec);

Procedure SetDate(Var Date:TDateRec);

Procedure GetDate(Var Date:TDateRec);

Implementation

Procedure SetTime; External 'DATETIME' index 1;

Procedure GetTime; External 'DATETIME' index 2;

Procedure SetDate; External 'DATETIME' index 3;

Procedure GetDate; External 'DATETIME' index 4;

end;

------------------------------------------------------

program ShowTime; {}

uses WinCrt , DateTime;

var

Time : TtimeRec;

begin

GetTime(Time);

With Time Do

WriteLn( 'Time is',hh,':',mi,':',ss);

end;

-----------------------------------------------------

(6)DDLs

program ShowTime;

uses WinProcs , WinTypesWinCrt;

type

TTimeRec = Record

ss : integer;

mi : Integer;

hh : Integer;

end;

TGETTime = Procedure( var Time : TTimeRec );

Var

Time : TTimeRec;

Handle : THandle;

GetTime : TGetTime;

Begin

Handle := LoadLibrary('DATETIME.DLL');

if Handle >= 32 then

Begin

@GetTime := GetProcAddress( Handle , 'GETTIME' );

If @GetTime nil Then {or If Assigned(GetTime) then }

Begin

GetTime(Time)

With Time do

WriteLn('Time is ',hh,':',mi,':',ss);

end;

FreeLibrary(handle);

end;

end.

10.3 DDLs

10.3.1

library minmax;

function Min( X , Y : Integer ) : Integer;

StdCall;

{Delphi, register ()}

Begin

If X < Y Then Min := X

else Min := Y;

end;

function Max( X , Y : Integer ) : Integer;StdCall;

Begin

If X > Y Then Max := X

else Max := Y;

end;

exports

Min index 1 name Min Resident;

Max index 2 name Max Resident;

Begin

end.

VCL

3.1 Standard

MainMenu

Caption&&CAltC

Label

Edit

Cut(Ctrl+C)Paste(Ctrl+V)

Memo

Panel

Button

Checkbox and Radiobutton

Group

Listbox and Combobox

Image

BitmapWindowspicture

Tab- and Pagecontrol

Option

SpeedBtn

Panel

3.2 Additional

onActive

onClick

onDbClick

onCreate

onDeactivate

onDragDroponDragOveronMouseDownonMouseUp

onHide

onKeyDownonKeyPressonKeyUp

onPaint

onResize

onShow

API

API

Api

W16

W95

WNT

mmioWrite

WriteFile

ExtractAssociatedIcon

EXE

ExtractIcon

LZRead

GetPrivateProfileString

GetPrivateProfileInt

UnlockFile

UnlockFileEx

LZOpenFile

mmioOpen

SetFileApisToOEM

APIOEM

SetFileSecurity

FindFirstChangeNotification

SetFileTime

64

mmioSetInfo

SetTextColor

SetFilePointer

SetFileAttributes

SetFileApisToOEM

APIOEM

SetFileSecurity

FindFirstChangeNotification

SetFileTime

64

mmioSetInfo

SetTextColor

SetFilePointer

SetFileAttributes

DeleteFile

mmioSeek

MoveFile

MoveFileEx

GetFileTime

64

GetFileTitle

GetVolumeInformation

GetFileVersionInfo

GetFullPathName

GetFileInformationByHandle

GetFileType

GetFileAttributes

GetShortPathName

mmioRead

ReadFile

WriteFileEx

API

Api

W16

W95

WNT

AddPrinterConnection

StartPagePrinter

StartDoc

StartDocPrinter

AddPrintProvidor

AddForm

AddPort

AddMonitor

ShellExecute

ClosePrinter

WritePrinter

AddPrinter

SetAbortProc

SetPrinter

SetPrinterData

SetJob

ResetPrinter

DeletePrinterConnection

DeletePrintProcessor

DeletePrinterDriver

DeletePrinter

DeleteMonitor

DeletePrintProvidor

DeleteForm

AbortPrinter

DeletePort

AddJob

AdvancedDocumentProperties

PrintDlg

EnumPrintProcessors

EnumPrinterDrivers

EnumPorts

EnumPrintProcessorDatatypes

EnumForms

AbortDoc

PrinterProperties

AddPrintProcessor

AddPrinterDriver

PrinterMessageBox

ConnectToPrinterDlg

EndPagePrinter

EndDoc

EndDocPrinter

StartPage

WaitForPrinterChange

GetPrintProcessorDirectory

GetPrinterDriver

GetPrinterDriverDirectory

GetPrinter

GetPrinterData

GetForm

EnumJobs

GetJob

OpenPrinter

ReadPrinter

DocumentProperties

ConfigurePort

API

Api

W16

W95

WNT

DdeImpersonateClient

DDE

timeKillEvent

TerminateProcess

KillTimer

TerminateThread

waveOutBreakLoop

DdeKeepStringHandle

AllocConsole

CreateHalftonePalette

CreateCaret

GetConsoleCP

GetConsoleOutputCP

PolyTextOut

UnpackDDElParam

DDEIPARAM

CreateDIBitmap

DIB spec

CreateDIBPatternBrush

DIB

DeleteService

SC MANAGER

GetProfileSection

WIN.INI

GetProfileString

WIN.INI

GetProfileInt

WIN.INI

DeleteAce

ACLACE

DeleteObject

DialogBoxIndirectParam

CreateDialogIndirectParam

ExtCreateRegion

FindAtom

DlgDirSelectComboBoxEx

DlgDirSelectEx

RegUnLoadKey

GetLocaleInfo

GlobalFindAtom

LineTo

CreatePatternBrush

CreateDIBPatternBrushPt

GlobalDeleteAtom

GetWindowLong

GetWindowWord

GetMessage

UnhookWindowsHookEx

ChangeClipboardChain

ExcludeUpdateRgn

HeapAlloc

HeapReAlloc

LocalAlloc

RegDeleteValue

GetProp

ClearCommError

Escape

ExtEscape

AllocateLocallyUniqueId

LUID

CreatePrivateObjectSecurity

SD

AllocateAndInitializeSid

SID

TlsAlloc

DisconnectNamedPipe

DdeClientTransaction

DDE

midiInStart

MIDI

BeginPath

WNetConnectionDialog

StartService

ResumeThread

LocalUnlock

GlobalUnlock

VirtualUnlock

UnlockServiceDatabase

CompareFileTime

64

DdeCmpStringHandles

DDE

lstrcmp

lstrcmpi

CompareString

EqualRgn

ScrollDC

IntersectRect

AdjustWindowRect

AdjustWindowRectEx

LineDDA

RegFlushKey

waveOutWrite

ReportEvent

WriteConsole

WriteTapemark

EnterCriticalSection

InsertMenu

EscapeCommFunction

COMM

midiOutLongMsg

MIDI

Shell_NotifyIcon

TranslateMDISysAccel

MDI

TranslateAccelerator

joySetCapture

OpenClipboard

CLIPBOARD

midiInOpen

MIDI

midiStreamOpen

MIDI

midiOutOpen

MIDI

OpenDriver

RegOpenKey

RegOpenKeyEx

OpenProcessToken

waveInOpen

waveOutOpen

OpenEvent

OpenEventLog

OpenMutex

MUTEX

OpenFileMapping

OpenSemaphore

OpenBackupEventLog

OpenService

OpenThreadToken

mixerOpen

CreateBitmapIndirect

BITMAP

DdeInitialize

DDEML

CreateFontIndirect

LOGFONT

CreatePenIndirect

LOGPEN

CreateRectRgnIndirect

RECT

EnumMetaFile

WINDOWSGDI

mciGetDeviceIDFromElementID

ID

CheckDlgButton

ExtFloodFill

FloodFill

PaintRgn

FillRgn

CheckRadioButton

FrameRect

FillRect

CreateCursor

OffsetRgn

CreateBrushIndirect

CreateSolidBrush

FlushViewOfFile

OffsetRect

DrawFocusRect

CreateDirectoryEx

EnumEnhMetaFile

GDI

SetWinMetaFileBits

mouse_event

SwapMouseButton

Beep

MessageBeep

PrivilegedServiceAuditAlarm

BackupWrite

BackupSeek

BackupRead

PlgBlt

FindCloseChangeNotification

CloseDriver

DeregisterEventSource

CloseEventLog

CloseFigure

CloseEnhMetaFile

DC

StrokeAndFillPath

midiInClose

MIDI

midiOutClose

MIDI

mmioClose

MM

CloseServiceHandle

Service control manager

ExitWindows

WINDOWS

ExitWindowsEx

WINDOWS

CloseMetaFile

WINDOWSDC

LZClose

midiStreamClose

MIDI

CloseHandle

waveInClose

waveOutClose

InitiateSystemShutdown

FindClose

CloseClipboard

mixerClose

RegCloseKey

UnionRect

WNetOpenEnum

EnumResourceLanguages

EnumResourceNames

EnumResourceTypes

RegEnumKey

RegEnumKeyEx

RegEnumValue

BeginDeferWindowPos

HeapCompact

BuildCommDCB

DCB

DdeAddData

DDE

mmioSendMessage

I/O

mciSendString

MCI

mciSendCommand

MCI

midiInAddBuffer

MIDI

midiInMessage

MIDI

midiOutMessage

MIDI

midiStreamOut

MIDI

midiOutShortMsg

MIDI

SendDriverMessage

SendDlgItemMessage

waveInMessage

waveInAddBuffer

waveOutMessage

WritePrivateProfileString

INI

WritePrivateProfileSection

INI

ControlService

PostThreadMessage

OutputDebugString

FatalExit

WriteConsoleOutputCharacter

WriteConsoleOutputAttribute

GenerateConsoleCtrlEvent

mixerMessage

DispatchMessage

SendMessage

SendMessageCallback

SendMessageTimeout

SendNotifyMessage

auxOutMessage

GdiComment

SetClipboardViewer

CLIPBOARD

FrameRgn

CreateRemoteThread

BeginUpdateResource

EndUpdateResource

DdeQueryNextServer

SetWindowText

TransmitCommChar

BitBlt

InvalidateRect

InvalidateRgn

GlobalAddAtom

ReadProcessMemory

DrawIcon

GrayString

WriteProcessMemory

EndPaint

DrawText

ExtTextOut

GlobalAlloc

AppendMenu

FindResource

FindResourceEx

CallNamedPipe

VerInstallFile

SetTimer

SetWindowsHook

SetWindowsHookEx

ReadFileEx

mciExecute

MCI

SHFileOperation

ExpandEnvironmentStrings

InterlockedExchange

32

StrokePath

SetAclInformation

ACL

EnableWindow

SetSecurityDescriptorDacl

DACL

SetDIBitsToDevice

DIB

midiOutSetVolume

MIDI

SetSecurityDescriptorSacl

SACL

SetSecurityDescriptorGroup

SD

SetSecurityDescriptorOwner

SD

TlsSetValue

TLS

SetKernelObjectSecurity

SetTextAlign

SetEndOfFile

timeSetEvent

timeBeginPeriod

SetWorldTransform

SetTokenInformation

SetErrorMode

SetHandleCount

SetDlgItemText

SetLocalTime

SHAppBarMessage

SetPriorityClass

waveOutSetPlaybackRate

SetPolyFillMode

SetMapperFlags

SetTextCharacterExtra

SetUserObjectSecurity

PulseEvent

SetComputerName

SetBrushOrgEx

SetROP2

SetBkColor

WidenPath

SetLastError

SetLastErrorEx

mciSetYieldProc

SetDIBits

SetStretchBltMode

SetBitmapBits

SetBitmapDimensionEx

SetTimeZoneInformation

SetSystemTime

SetSystemPaletteUse

SetSysColors

SetProcessShutdownParameters

SetClassLong

SetClassWord

SetWindowWord

auxSetVolume

SetEvent

SetVolumeLabel

SetGraphicsMode

SetICMMode

waveOutSetPitch

SetEnvironmentVariable

SetArcDirection

SetThreadLocale

SetViewportExtEx

SetViewportOrgEx

SetMailslotInfo

SetConsoleTextAttribute

SetThreadContext

SetMapMode

SetStdHandle

SetRect

SetBkMode

SetDebugErrorLevel

SetCommState

SetCommMask

SetupComm

SetCommTimeouts

SetClipboardData

SetPaletteEntries

SetConsoleCursorInfo

SetConsoleCursorPosition

SetConsoleCtrlHandler

SetConsoleWindowInfo

SetConsoleTitle

SetConsoleCP

SetConsoleMode

SetConsoleOutputCP

SetMiterLimit

SetCaretBlinkTime

SetCaretPos

RegSetKeySecurity

SetWindowPos

SetWindowLong

SetWindowPlacement

/

SetWindowExtEx

SetMenu

SetWindowOrgEx

SetForm

SetUnhandledExceptionFilter

GdiSetBatchLimit

GDI

SetDeviceGammaRamp

SetPixel

SetPixelV

SetScrollPos

SetScrollRange

waveOutSetVolume

SetKeyboardState

SetFocus

SetDoubleClickTime

SetCursorPos

SetCapture

SetTapeParameters

SetTapePosition

SetNamedPipeHandleState

/

SetICMProfile

SetColorSpace

joySetThreshold

DdeAccessData

DDE

ObjectOpenAuditAlarm

/

GetSystemMenu

SubtractRect

InitializeSid

SID

InitAtomTable

LZInit

InitializeSecurityDescriptor

InitializeCriticalSection

DeleteAtom

ValidateRgn

ObjectCloseAuditAlarm

/

RemoveDirectory

RegDeleteKey

RemoveFontResource

DeleteDC

DeleteCriticalSection

DeleteColorSpace

ValidateRect

DestroyPrivateObjectSecurity

SD

DeleteMenu

RemoveMenu

RemoveProp

UnregisterClass

UnhookWindowsHook

UnloadKeyboardLayout

EraseTape

BroadcastSystemMessage

CascadeWindows

ChangeMenu

CheckMenuRadioItem

ChildWindowFromPointEx

ChoosePixelFormat

CloseDesktop

CloseWindowStation

CommConfigDialog

CommandLineToArgv

CopyImage

CopyLZFile

CreateDIBSection

CreateDesktop

CreateIoCompletionPort

DescribePixelFormat

DisableThreadLibraryCalls

DoEnvironmentSubst

DragDetect

DragObject

DrawAnimatedRects

DrawCaption

DrawEdge

DrawFrameControl

DrawIconEx

DrawState

DrawTextEx

DuplicateIcon

EnumCalendarInfo

EnumDesktopWindows

EnumDesktops

EnumPrinterPropertySheets

EnumPrinters

EnumWindowStations

ExtractIconEx

FindClosePrinterChangeNotification

FindEnvironmentString

FindFirstPrinterChangeNotification

FindNextPrinterChangeNotification

FindWindowEx

FixBrushOrgEx

FreeEnvironmentStrings

FreeLibraryAndExitThread

FreeResource

GetBrushOrgEx

GetCapture

GetCommConfig

GetCompressedFileSize

GetCurrencyFormat

GetDIBColorTable

GetDefaultCommConfig

GetHandleInformation

GetKeyboardLayout

GetKeyboardLayoutList

GetMenuContextHelpId

GetMenuDefaultItem

GetMenuItemInfo

GetMenuItemRect

GetNumberFormat

GetPixelFormat

GetProcessHeaps

GetProcessWorkingSetSize

GetQueuedCompletionStatus

GetScrollInfo

GetStringTypeEx

GetSysColorBrush

GetSystemTimeAdjustment

GetTextCharset

GetUserObjectInformation

GetWindowContextHelpId

GetWindowRgn

GlobalCompact

GlobalFix

GlobalUnWire

GlobalUnfix

GlobalWire

hread

hwrite

ImmAssociateContext

ImmConfigureIME

ImmCreateContext

ImmDestroyContext

ImmEnumRegisterWord

ImmEscape

ImmGetCandidateList

ImmGetCandidateListCount

ImmGetCandidateWindow

ImmGetCompositionFont

ImmGetCompositionString

ImmGetCompositionWindow

ImmGetContext

ImmGetConversionList

ImmGetConversionStatus

ImmGetDefaultIMEWnd

ImmGetDescription

ImmGetGuideLine

ImmGetIMEFileName

ImmGetOpenStatus

ImmGetProperty

ImmGetRegisterWordStyle

ImmGetStatusWindowPos

ImmGetVirtualKey

ImmInstallIME

ImmIsIME

ImmIsUIMessage

ImmNotifyIME

ImmRegisterWord

ImmReleaseContext

ImmSetCandidateWindow

ImmSetCompositionFont

ImmSetCompositionString

ImmSetCompositionWindow

ImmSetConversionStatus

ImmSetOpenStatus

ImmSetStatusWindowPos

ImmSimulateHotKey

ImmUnregisterWord

InsertMenuItem

IsTextUnicode

lclose

lcreat

LZDone

LZStart

llseek

LoadCursorFromFile

LoadImage

LocalCompact

LocalShrink

LookupIconIdFromDirectoryEx

lopen

lread

lstrcat

lstrcpy

lstrcpyn

lwrite

MapVirtualKeyEx

MenuItemFromPoint

MessageBoxIndirect

NotifyChangeEventLog

OpenDesktop

OpenInputDesktop

OpenWindowStation

OutputDebugStr

PaintDesktop

PtInRegion

RegisterClassEx

SHGetNewLinkInfo

SetCommConfig

SetDIBColorTable

SetDefaultCommConfig

SetFileApisToANSI

SetHandleInformation

SetLocaleInfo

SetMenuContextHelpId

SetMenuDefaultItem

SetMenuItemInfo

SetMessageExtraInfo

SetMessageQueue

SetPixelFormat

SetProcessWindowStation

SetProcessWorkingSetSize

SetServiceBits

SetSystemTimeAdjustment

SetThreadAffinityMask

SetThreadDesktop

SetThreadPriority

SetThreadToken

SetUserObjectInformation

SetWindowContextHelpId

SetWindowRgn

ShowWindowAsync

SwapBuffers

SwitchDesktop

SystemTimeToTzSpecificLocalTime

TileWindows

ToAsciiEx

TrackPopupMenuEx

VkKeyScanEx

WNetGetUniversalName

WinExecError

HELP

LookupAccountSid

SID

CharToOem

OEM

CharToOemBuff

OEM

LookupAccountName

SID

SetParent

ModifyWorldTransform

SetCurrentDirectory

SetConsoleScreenBufferSize

SetConsoleActiveScreenBuffer

InflateRect

ExcludeClipRect

ModifyMenu

MoveWindow

SetCursor

RegReplaceKey

ResetDC

SetServiceStatus

RedrawWindow

UpdateResource

DeferWindowPos

EndDeferWindowPos

UpdateWindow

UpdateColors

PlayMetaFileRecord

WINDOWS

PlayMetaFile

WINDOWSDC

Netbios

NCB

WinExec

PlayEnhMetaFile

PlayEnhMetaFileRecord

EnumClipboardFormats

CLIPBOARD

GetCommState

COMM

GetCommProperties

COMM

GetCommTimeouts

COMM

GetCommMask

COMM

GetSidIdentifierAuthority

ID

mciGetErrorString

MCI

midiInGetErrorText

MIDI

midiInGetID

MIDIID

midiInGetNumDevs

MIDI

midiOutGetErrorText

MIDI

midiOutGetID

MIDIID

midiOutGetVolume

MIDI

midiOutGetDevCaps

MIDI

mmioGetInfo

MM

mmsystemGetVersion

MM

GetSecurityDescriptorGroup

SD

GetSecurityDescriptorLength

SD

GetSecurityDescriptorSacl

SDACL

GetSecurityDescriptorOwner

SD

GetSecurityDescriptorDacl

SDACL

GetLengthSid

SID

TlsGetValue

TLS

GetOutlineTextMetrics

TRUETYPE

GetSystemDirectory

WINDOWS

GetTickCount

WINDOWS

timeGetSystemTime

WINDOWS

timeGetTime

WINDOWS

GetVersion

WINDOWS

GetWinMetaFileBits

WINDOWS

FindWindow

GetDlgCtrlID

ID

GetTextExtentExPoint

GetKernelObjectSecurity

SD

GetRgnBox

GetRegionData

GetTextAlign

GetTextCharacterExtra

GetParent

timeGetDevCaps

QueryPerformanceFrequency

GetKeyNameText

CommDlgExtendedError

WindowFromPoint

LookupPrivilegeDisplayName

GetFileVersionInfoSize

FindExecutable

LookupPrivilegeName

GetDlgItemText

GetDlgItem

GetDialogBaseUnits

GetObject

GetObjectType

GetOpenClipboardWindow

CLIPBOARD

LocalSize

LocalFlags

GetLocalTime

LocalHandle

GetAtomName

GetUserName

DdeGetLastError

DDEML

GetConsoleCursorInfo

GlobalSize

GlobalFlags

GlobalGetAtomName

DdeQueryConvInfo

DDE

RegQueryValueEx

mciGetCreatorTask

GetLogicalDriveStrings

GetFontData

GetTextExtentPoint

GetTextExtentPoint32

lstrlen

GetCharABCWidths

GetCharABCWidthsFloat

GetCharWidth

GetCharWidth32

GetAspectRatioFilterEx

ASPECT-RATIO

GetMiterLimit

MITER-JOIN

GetTextColor

GetCurrentObject

GetCurrentDirectory

GetCursor

GetCursorPos

GetPolyFillMode

GetKerningPairs

GetTextCharsetInfo

GetTextMetrics

GetTextFace

GetTimeZoneInformation

GetCurrentProcessId

ID

GetCurrentProcess

GetMetaRgn

GetCurrentThreadId

ID

GetCurrentThread

GetWorldTransform

GetBoundsRect

GetROP2

GetBkColor

GetClipRgn

GetCaretPos

GetFocus

GetTapePosition

DragQueryFile

GetLastError

GetVersionEx

GetSidSubAuthorityCount

GetSidSubAuthority

WNetGetLastError

mciGetDeviceID

ID

GetICMProfile

DeviceCapabilities

GetDeviceCaps

GetDCOrgEx

WindowFromDC

GetAclInformation

GetExitCodeProcess

GetEnvironmentVariable

GetPriorityClass

GetProcessShutdownParameters

GetProcessWindowStation

GetStretchBltMode

GetBitmapDimensionEx

waveInGetNumDevs

LoadLibraryEx

GetPrivateProfileSection

GetRasterizerCaps

TRUETYPE

GetSystemMetrics

GetSystemTime

GetSystemInfo

GetSystemPaletteEntries

auxGetNumDevs

GetDriverModuleHandle

GetProcAddress

GetNamedPipeHandleState

GetNamedPipeInfo

LookupIconIdFromDirectory

ID

GetIconInfo

GetArcDirection

GetSidLengthRequired

SID

GetUserObjectSecurity

SD

GetDiskFreeSpace

GetExitCodeThread

GetThreadTimes

GetThreadDesktop

GetThreadSelectorEntry

EnumThreadWindows

GetViewportOrgEx

GetViewportExtEx

GetClipCursor

GetTempPath

GetPrivateObjectSecurity

SD

GetMailslotInfo

GetNextDlgTabItem

WS_TABSTOP

GetNextDlgGroupItem

GetNextWindow

GetForegroundWindow

GetConsoleScreenBufferInfo

GetAce

ACLACE

GetCommandLine

GetEnvironmentStrings

FindFirstFreeAce

ACL

GetFileSize

GetTokenInformation

RegQueryValue

GetDriveType

GetThreadPriority

GetThreadContext

EnumFontFamilies

EnumFontFamiliesEx

GetMenuState

GetWindow

GetTopWindow

GetMenu

GetPixel

RGB

GetModuleHandle

GetModuleFileName

GetMapMode

GetSysColor

GetDCEx

GetStdHandle

I/O

GetActiveWindow

GetKeyboardLayoutName

GetBkMode

GetDesktopWindow

LookupPrivilegeValue

LUID

GetMenuCheckMarkDimensions

GetPaletteEntries

GetCommModemStatus

SizeofResource

LoadResource

LockResource

GetCharWidthFloat

GetClipboardOwner

CountClipboardFormats

GetClipboardData

HeapSize

GetStockObject

GetSubMenu

GetNumberOfConsoleInputEvents

GetConsoleTitle

GetConsoleMode

mixerGetLineControls

GetPriorityClipboardFormat

CLIPBOARD

GetClipboardViewer

GetCaretBlinkTime

GetMenuItemID

GetMenuItemCount

VirtualQueryEx

VirtualQuery

GetKeyState

GetKeyboardState

GetCurrentPositionEx

GetOverlappedResult

GetMessagePos

GetMessageTime

GetOldestEventLogRecord

GetNearestPaletteIndex

GetNearestColor

GetScrollPos

GetScrollRange

RegisterEventSource

RegQueryInfoKey

GetClipboardFormatName

GetMessageExtraInfo

GetWindowsDirectory

WINDOWS

GetWindowTextLength

GetLargestConsoleWindowSize

GetWindowDC

GetWindowRect

GetUpdateRect

GetUpdateRgn

GetWindowThreadProcessId

ID

GetClientRect

GetWindowPlacement

/

GetClassWord

GetClassName

GetClassInfo

GetClassLong

GetWindowExtEx

EnumProps

EnumPropsEx

GetDC

GetWindowOrgEx

GdiGetBatchLimit

GDI

CreateFileMapping

CreateEvent

GetPath

GetKeyboardType

GetDoubleClickTime

DragQueryPoint

GetNumberOfConsoleMouseButtons

GetTapeStatus

GetTapeParameters

GetEnhMetaFileHeader

GetEnhMetaFileDescription

GetEnhMetaFilePaletteEntries

joyGetPos

joyGetPosEx

joyGetThreshold

joyGetNumDevs

ObjectPrivilegeAuditAlarm

/

midiConnect

MIDI

RegConnectRegistry

OpenSCManager

StartServiceCtrlDispatcher

DebugActiveProcess

IsValidSid

SID

IsValidSecurityDescriptor

GdiFlush

GDI

IsValidAcl

EnableMenuItem

EnableScrollBar

AdjustTokenGroups

/

AdjustTokenPrivileges

/

DdeEnableCallback

DDE

ContinueDebugEvent

FlashWindow

GetExpandedName

GetSecurityDescriptorControl

SD

GetComputerName

GetGlyphOutline

GetGraphicsMode

DC

DestroyCursor

CREATECURSOR

DdeDisconnectList

DDE

DeleteMetaFile

WINDOWS

DestroyAcceleratorTable

DestroyIcon

CREATEICON

DdeAbandonTransaction

DestroyCaret

CancelDC

DC

HeapDestroy

DestroyMenu

DestroyWindow

DeleteEnhMetaFile

GetClipBox

DefineDosDevice

DOS

DefDriverProc

RegisterWindowMessage

DrawEscape

GDI

OpenFile

CreateFile

BuildCommDCBAndTimeouts

COMMDCB

DdeCreateStringHandle

DDE

DdeCreateDataHandle

DDE

CreateMailslot

Mailsolt

mmioCreateChunk

RIFF

CreateMetaFile

WINDOWSDC

GetMetaFile

WINDOWS

SetMetaFileBitsEx

WINDOWS

ChooseFont

ChooseColor

CreateDirectory

CreateCompatibleBitmap

DC

DdeConnect

CreateCompatibleDC

DCDC

PathToRegion

ReplaceText

GetOpenFileName

GetSaveFileName

CreateAcceleratorTable

CreateDiscardableBitmap

CreatePolyPolygonRgn

RegCreateKey

RegCreateKeyEx

DdeConnectList

DDE

CreatePolygonRgn

PageSetupDlg

RaiseException

CreateIcon

MakeSelfRelativeSD

SD

CreateDC

PatBlt

CreateNamedPipe

CreateIconFromResource

CreateIconIndirect

CreateService

SetRectEmpty

CreateDialogParam

GetTempFileName

CreateIC

CreateScalableFontResource

CreateProcessAsUser

FindText

MakeAbsoluteSD

SD

CreateBitmap

CreateRectRgn

CreatePipe

CreateRoundRectRgn

MessageBox

MessageBoxEx

IntersectClipRect

HeapCreate

CreatePopupMenu

DebugBreak

CreateMenu

CreateFont

CreatePalette

CreateColorSpace

CreatePen

ExtCreatePen

CreateEllipticRgn

CreateEllipticRgnIndirect

CreateWindowEx

CreateMDIWindow

MDI

InitializeAcl

CreateProcess

CreateThread

CreateTapePartition

GetEnhMetaFile

SetEnhMetaFileBits

CreateEnhMetaFile

DC

CreateHatchBrush

mixerSetControlDetails

EnumServicesStatus

SC

EnumSystemCodePages

EnumSystemLocales

EnumICMProfiles

EnumMonitors

EnumTimeFormats

EnumObjects

EnumDateFormats

EnumDependentServices

EnumFonts

PolyBezier

BEZIER

PolyBezierTo

BEZIER

Rectangle

Chord

PolylineTo

PolyPolygon

PolyDraw

BEZIER

Polygon

Arc

Polyline

PolyPolyline

RoundRect

Ellipse

ArcTo

mmioAdvance

I/O

DeviceIoControl

WriteConsoleOutput

DdeDisconnect

DDE

AbortPath

DC

CharPrev

CharNext

OemToChar

OEM

OemToCharBuff

OEM

MaskBlt

SystemTimeToFileTime

64

TranslateCharsetInfo

ToUnicode

ANSI

ToAscii

WINDOWS

MapVirtualKey

TranslateMessage

SaveDC

LeaveCriticalSection

VirtualAlloc

SetPrivateObjectSecurity

SD

SetRectRgn

LocalReAlloc

GlobalReAlloc

/

SetServiceObjectSecurity

ChangeServiceConfig

HiliteMenuItem

CheckMenuItem

VirtualProtect

VirtualProtectEx

ResizePalette

FreeLibrary

FoldString

ReplyMessage

SENDMESSAGE

ResetEvent

UnrealizeObject

CopyMetaFile

Windows

CopyAcceleratorTable

CopyCursor

CopyFile

LZCopy

DuplicateHandle

DuplicateToken

StretchBlt

CopyIcon

CopyRect

CopyEnhMetaFile

FileTimeToSystemTime

64

AddAccessAllowedAce

ACCESS_ALLOWED_ACEACL

AddAccessDeniedAce

ACCESS_DENIED_ACEACL

AddAce

ACEACL

StretchDIBits

DIB

GetDIBits

DIB

mmioFlush

MM I/O

DosDateTimeToFileTime

MS-DOS64

OemKeyScan

OEM ASCII

CopySid

SID

AddAuditAccessAce

SYSTEM_AUDIT_ACEACL

FileTimeToLocalFileTime

UTC

GetMetaFileBitsEx

WINDOWS

AddAtom

ZeroMemory

AddFontResource

EnumChildWindows

RegSetValue

RegSetValueEx

FileTimeToDosDateTime

MS-DOS

CreateMutex

MUTEX

OpenProcess

CreateSemaphore

CreateConsoleScreenBuffer

GetDlgItemInt

MapDialogRect

LocalFileTimeToFileTime

UTC

DdeSetUserHandle

ClipCursor

GlobalHandle

MultiByteToWideChar

FillConsoleOutputCharacter

WriteProfileString

WIN.INI

DdeQueryString

CharLowerBuff

CharUpperBuff

mmioStringToFOURCC

CharUpper

CharLower

VkKeyScan

DPtoLP

CombineRgn

CombineTransform

MulDiv

GetBitmapBits

BackupEventLog

FlattenPath

AttachThreadInput

MapViewOfFile

MapViewOfFileEx

SetMenuItemBitmaps

ClientToScreen

ScreenToClient

WriteProfileSection

WIN.INI

MapWindowPoints

VerLanguageName

ID

PostMessage

CallMsgFilter

CallWindowProc

ConvertDefaultLocale

WideCharToMultiByte

SetMetaRgn

GetMenuString

LPtoDP

RealizePalette

FillConsoleOutputAttribute

RegSaveKey

GetWindowText

SetForegroundWindow

DdeGetData

DDE

PackDDElParam

DDEIPARAM

GetEnhMetaFileBits

SetDlgItemInt

ClearCommBreak

RestoreDC

BringWindowToTop

SetCommBreak

SuspendThread

GetLogicalDrives

DdeSetQualityOfService

DDE

AngleArc

MapGenericMask

/

LCMapString

LoadLibrary

SetScrollInfo

SetSystemCursor

ShellAbout

SHELL ABOUT

ShowCursor

ShowOwnedPopups

TrackPopupMenu

ShowCaret

RegNotifyChangeKeyValue

ShowWindow

ShowScrollBar

SystemParametersInfo

FindNextFile

SearchPath

FindFirstFile

PtVisible

RectInRegion

RectVisible

AnyPopup

midiInStop

MIDI

midiInReset

MIDI

midiOutReset

MIDI

FatalAppExit

EndPage

WNetCloseEnum

EndPath

Pie

ExitProcess

ExitThread

SelectObject

SelectClipPath

SelectPalette

SelectClipRgn

ExtSelectClipRgn

waveOutRestart

ReuseDDElParam

DDEIPARAM

midiStreamRestart

MIDI

mmioRename

WNetAddConnection

WNetAddConnection2

LZSeek

DdeReconnect

DDE

DrawMenuBar

midiInPrepareHeader

MIDI

midiOutPrepareHeader

MIDI

BeginPaint

PrepareTape

HeapValidate

wsprintf

FormatMessage

midiOutUnprepareHeader

MIDI

ClearEventLog

PurgeComm

WaitCommEvent

WaitForSingleObject

WaitForSingleObjectEx

I/O

WaitForMultipleObjects

WaitForMultipleObjectsEx

I/O

WaitForInputIdle

WaitNamedPipe

WNetEnumResource

DefMDIChildProc

MDI

DefFrameProc

MDI

GetStringTypeA

ANSI

GetACP

ANSI

QueryDosDevice

DOS

midiStreamPosition

MIDI

midiStreamProperty

MIDI

midiOutGetNumDevs

MIDI

GetKBCodePage

OEM

GetOEMCP

OEM

GetStringTypeW

UNICODE

SHGetFileInfo

GetFileSecurity

QueryPerformanceCounter

GetCPInfo

GetDateFormat

GetTimeFormat

GetUserDefaultLCID

ID

GetUserDefaultLangID

ID

GetProcessAffinityMask

GetFontLanguageInfo

GetCharacterPlacement

WNetGetUser

GetStartupInfo

auxGetVolume

mixerGetNumDevs

WNetGetConnection

GetColorAdjustment

GetProcessTimes

mciGetYieldProc

waveOutGetErrorText

waveInGetErrorText

waveOutGetPosition

waveOutGetPlaybackRate

waveInGetPosition

waveOutGetVolume

waveInGetID

ID

waveInGetDevCaps

waveOutGetID

ID

waveOutGetDevCaps

waveOutGetNumDevs

waveOutGetPitch

GetSystemPowerStatus

ACDC

GetSystemDefaultLCID

ID

GetSystemDefaultLangID

ID

auxGetDevCaps

GetNumberOfEventLogRecords

QueryServiceObjectSecurity

QueryServiceStatus

GetServiceDisplayName

QueryServiceConfig

GetServiceKeyName

QueryServiceLockStatus

GetThreadLocale

GetColorSpace

mixerGetControlDetails

GetDeviceGammaRamp

ImpersonateSelf

GetProcessHeap

VerQueryValue

mixerGetID

ID

mixerGetDevCaps

mixerGetLineInfo

LoadMenuIndirect

GetLogColorSpace

RegGetKeySecurity

DrvGetModuleHandle

FindNextChangeNotification

TransactNamedPipe

ReadEventLog

ReadConsoleOutputCharacter

ReadConsoleOutput

ReadConsoleOutputAttribute

ReadConsole

CallNextHookEx

DefWindowProc

ScheduleJob

SetTextJustification

ScaleViewportExtEx

ScaleWindowExtEx

SetColorAdjustment

PostQuitMessage

WINDOWS

NotifyBootConfigStatus

waveOutPrepareHeader

waveInPrepareHeader

PeekNamedPipe

midiOutCachePatches

MIDI

midiOutCacheDrumPatches

MIDI

UnmapViewOfFile

waveOutReset

waveInStop

waveInReset

waveInStart

AbortSystemShutdowna

RevertToSelf

midiStreamStop

MIDI

InterlockedDecrement

LONG

mmioDescend

RIFF

ArrangeIconicWindows

ColorMatchToTarget

mmioSetBuffer

I/O

SetBoundsRect

midiDisconnect

MIDI

WNetDisconnectDialog

WNetCancelConnection

WNetCancelConnection2

GlobalMemoryStatus

AreAnyAccessesGranted

CheckColorsInGamut

EqualSid

SLDID

EqualPrefixSid

SLD

AreAllAccessesGranted

PeekMessage

PrivilegeCheck

AccessCheckAndAuditAlarm

AccessCheck

EmptyClipboard

FlushFileBuffers

timeEndPeriod

midiInUnprepareHeader

waveOutUnprepareHeader

waveInUnprepareHeader

FlushConsoleInputBuffer

MoveToEx

OffsetViewportOrgEx

OffsetClipRgn

OffsetWindowOrgEx

ScrollWindow

ScrollWindowEx

keybd_event

EndDialog

HideCaret

DdePostAdvise

DefDlgProc

WinHelp

WINDOWS

midiStreamPause

MIDI

waveOutPause

WaitMessage

SetSystemPowerState

Sleep

SleepEx

I/O

AnimatePalette

CloseWindow

RegLoadKey

DdeNameService

RegisterServiceCtrlHandler

RegisterHotKey

DragAcceptFiles

RegisterClass

RegisterClipboardFormat

CLIPBOARD

LogonUser

RegRestoreKey

midiInGetDevCaps

MIDI

GetBinaryType

VerFindFile

IsValidCodePage

IsBadWritePtr

ChildWindowFromPoint

IsMenu

IsValidLocale

IsBadStringPtr

IsCharUpper

IsCharLower

IsCharAlpha

IsCharAlphaNumeric

IsDBCSLeadByte

DBCS

EqualRect

IsBadHugeWritePtr

IsBadReadPtr

GetSystemPaletteUse

GetTabbedTextExtent

IsDlgButtonChecked

PtInRect

IsRectEmpty

IsClipboardFormatAvailable

GetQueueStatus

IsDialogMessage

IsBadCodePtr

IsBadHugeReadPtr

GetLastActivePopup

IsWindow

IsWindowVisible

InSendMessage

SENDMESSAGE

IsWindowUnicode

UNICODE

IsChild

IsIconic

IsWindowEnabled

IsZoomed

GetAsyncKeyState

GetInputState

joyGetDevCaps

MsgWaitForMultipleObjects

ConnectNamedPipe

UnhandledExceptionFilter

mmioInstallIOProcA

I/O

LoadAccelerators

LoadCursor

LoadString

LoadModule

LoadBitmap

LoadIcon

LoadMenu

mmioAscend

RIFF

DdeFreeStringHandle

DDE

FreeDDElParam

DDEIPARAM

DdeFreeDataHandle

DDE

DdeUnaccessData

DDE

FreeSid

SID

HeapFree

ReleaseMutex

DragFinish

SHFreeNameMappings

LocalFree

GlobalFree

ReleaseDC

DdeUninitialize

DDEML

TlsFree

ReleaseSemaphore

UnregisterHotKey

HeapUnlock

FreeConsole

VirtualFree

ReleaseCapture

joyReleaseCapture

LockFile

LockFileEx

GlobalLock

LocalLock

LockServiceDatabase

SC

HeapLock

VirtualLock

DlgDirList

DlgDirListComboBox

FillPath

FlushInstructionCache

ScrollConsoleScreenBuffer

LockWindowUpdate

TabbedTextOut

TextOut

LoadKeyboardLayout

ImpersonateDdeClientWindow

DDE

ImpersonateLoggedOnUser

ImpersonateNamedPipeClient

InterlockedIncrement

LONG

SetProp

PlaySound

sndPlaySound

ActivateKeyboardLayout

SetActiveWindow

OpenIcon

InvertRgn

InvertRect

8.1 Form

6.1.1MDI

MDI,MDIMDI

MDIOnPaintTImageMDI

Delphi(Delphi 1,2,3)

Form1FormStylefsMDIFormMDI

Form1ImageImagePicture

Form1Private

FClientInstance,

FPrevClientProc : TFarProc;

PROCEDURE ClientWndProc(VAR Message: TMessage);

(implementation)

PROCEDURE TForm1.ClientWndProc(VAR Message: TMessage);

VAR

MyDC : hDC;

Ro, Co : Word;

begin

with Message do

case Msg of

WM_ERASEBKGND:

begin

MyDC := TWMEraseBkGnd(Message).DC;

FOR Ro := 0 TO ClientHeight DIV Image1.Picture.Height DO

FOR Co := 0 TO ClientWIDTH DIV Image1.Picture.Width DO

BitBlt(MyDC, Co*Image1.Picture.Width, Ro*Image1.Picture.Height,

Image1.Picture.Width, Image1.Picture.Height,

Image1.Picture.Bitmap.Canvas.Handle, 0, 0, SRCCOPY);

Result := 1;

end;

else

Result := CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam,

lParam);

end;

end;

Form1

FClientInstance := MakeObjectInstance(ClientWndProc);

FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));

SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));

MDIMDIChildMDI

FormFormStylefsMDIChild

ImageFormFormImage

6.1.2FORM

DELPHIDELPHI

1)FORM

procedure WMGetMinMaxInfo( var Message:TWMGetMinMaxInfo ); message WM_GETMINMAXINFO;

2):

procedure TForm1.WMGetMinMaxInfo( var Message :TWMGetMinMaxInfo );

begin

with Message.MinMaxInfo^ do

begin

ptMaxSize.X := 200; {}

ptMaxSize.Y := 200; {}

ptMaxPosition.X := 99; {}

ptMaxPosition.Y := 99; {}

end;

Message.Result := 0; {Windows minmaxinfo}

inherited;

end;

6.1.3

:

APIGetWindow()GetWindowText()

1. File | New Project

2. Form1 Button Memo

3. Button1 OnClick :

procedure TForm1.Button1Click(Sender: TObject);

var

hCurrentWindow: HWnd;

szText: array[0..254] of char;

begin

hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);

while hCurrentWindow 0 do

begin

if GetWindowText(hCurrentWindow, @szText, 255)>0 then

Memo1.Lines.Add(StrPas(@szText));

hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);

end;

end;

6.1.4Windows?(Delphi 3 and 2.0)

Windows?.

procedure hideTaskbar; //

var

wndHandle : THandle;

wndClass : array[0..50] of Char;

begin

StrPCopy(@wndClass[0], 'Shell_TrayWnd');

wndHandle := FindWindow(@wndClass[0], nil);

ShowWindow(wndHandle, SW_HIDE);

End;

procedure showTaskbar;

var

wndHandle : THandle;

wndClass : array[0..50] of Char;

begin

StrPCopy(@wndClass[0], 'Shell_TrayWnd');

wndHandle := FindWindow(@wndClass[0], nil);

ShowWindow(wndHandle, SW_RESTORE);

end;

6.1.5

Delphi Form ///1 Form BorderIcons False;2 Form BorderStyle bsSingle ;3, WM_NCHITTEST , Client ,

Win32API Help CreateWindow() WM_NCHITTEST

,

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

procedure WMNCHitTest(var Msg: TMessage); message WM_NCHITTEST;

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);

begin

Close; // ,

end;

procedure TForm1.WMNCHitTest(var Msg: TMessage);

begin

inherited; // ,...

Msg.Result := HTCLIENT;

end;

end.

6.1.6

""

Form2BorderIconsBorderStyleFormStylePositionProjectOptionsForm2Auto-create formsAvailable formsCtrl+F12Project1

...

Application.CreateForm(TForm1, Form1);

Application.Run;

..

Application.CreateForm(TForm1, Form1);

form2:=tform2.create(application);

form2.Show;

form2.Update;

Application.Run;

form2.hide;

form2.free;

8.1.7 FormClient

Delphi12

procedure WMNCHitTest(var M: TWMNCHitTest); message

wm_NCHitTest;

procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);

begin

inherited; { }

if M.Result = htClient then M.Result := htCaption; {

ClientWindowsCaption }

end;

Form

TForm , form , , form . Form , Show ShowModal,'', , , Form Show ShowModal ,

Form

Form WindowState :

wsMaximized:

wsMinimized:

wsNormal:

:

procedure TForm1.Button1Click(Sender: TObject);

begin

WindowState := wsMaximized;

end;

8.1.1 form

:formcontrol menuform,

control menuevent ? form

.

Mainform OnClose , :

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

begin

WinExec('Notepad.exe', sw_Normal);

end;

8.1.1 Form

: MDI FORMMDI Form

Form2.ShowModal

OnActivate OnShow MDI Form

, Form "", . SDI Form, :

OnCreate

OnShow

OnActivate

OnPaint

MDI , MdiChild , MdiForm,

,

OnCreate

OnCreate

OnShow

OnActivate

OnShow

OnPaint

ok, ? OnShow , OnActivate ,, ' OnActivate OnShow ....',

''

, , OnPaint , ,OnPain, private ,.

, :

1. Options | Project , Auto-Create forms Available forms, Delphi MdiChild

2. , MDI , MDI , OnActivate

3. , Application.CreateForm ,File | New Click ,

, , Form OnCreate .

FormAutoCreateAvailable

Delphi Form Edit and Button Button show From form Edit Form , Form uses

UNIT1

uses unit2;

procedure button1_click()

begin

form2.show;

end;

UNIT2

uses unit1;

procedure form2_onCreate()

begin

edit1.text:=Form1.edit1.text;

end;

??

Form form Form OnCreate

Event

Form MDIChild ,

unit interface uses ,,

unitA interfaceuses unitB, unitB implementation uses unitA

, , Delphi

Create

Form , View | Project Source,

project1.dpr

, Application.Run , Create Form2 ?

"" Option | Project, Form2 Auto-create forms

Available

forms, Button1OnClick :

Application.CreateForm(TForm2, Form2);

Form2.Show;

Form2 Create

, :

unit Unit1;

interface

uses

...., Unit2;

.

.

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);

begin

Form2.Edit1.Text := Form1.Edit1.Text;

Form2.Show;

end;

end.

8.1.1 MDIChildForm

Delphi MDI Child Window Close ? ,

Property ?

MDI Child OnClose()

Action := caFree;

:

procedure TFrom2.FormClose(Sender: TObject;

var Action: TCloseAction);

begin

Action := caFree;

end;

8.1.1FORM

DELPHIDELPHI

1)FORM

procedureMessage :TWMGetMinMaxInfo ); message WM_GETMINMAXINFO;

WMGetMinMaxInfo( var

2):

procedure TForm1.WMGetMinMaxInfo( var Message :TWMGetMinMaxInfo );

begin

with Message.MinMaxInfo^ do

begin

ptMaxSize.X := 200; {}

ptMaxSize.Y := 200; {}

ptMaxPosition.X := 99; {}

ptMaxPosition.Y := 99; {}

end;

Message.Result := 0; {Windows minmaxinfo}

inherited;

end;

8.1.1(DELPHI 1.0)

DELPHIFORM, EXEFormCreateCmdShow

procedure TForm1.FormCreate(Sender: TObject);

begin

case CmdShow of

SW_SHOWMINNOACTIVE, SW_MINIMIZE, SW_SHOWMINIMIZED:

WindowState := wsMinimized;

SW_SHOWMAXIMIZED:

WindowState := wsMaximized;

else

WindowState := wsNormal;

end;

{}

end;

ShowWindowAPI

:

procedure TForm1.FormCreate(Sender: TObject);

begin

ShowWindow(Handle, CmdShow);

{}

end;

8.1.1LOGO

DPR:

begin

logoform := TLogoform.Create(nil);

try

logoform.Show;{ NOTE! show! NOT showmodal }

logoform.Update;

Application.CreateForm()

finally

logoform.Hide;

logoform.Release;

logoform.free;

end;

Application.Run;

end;

8.1.1

FORM ONKEYDOWN:

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if (ssCtrl in Shift) and (chr(Key) in ['A', 'a']) then

ShowMessage('Ctrl-A');

end;

8.1.1

"",

unit Dragmain;

interface

uses

SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,

Forms, Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;

end;

var

Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);

begin

inherited; { call the inherited message handler }

if M.Result = htClient then { is the click in the client area? }

M.Result := htCaption; { if so, make Windows think it's }

{ on the caption bar. }

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

Close;

end;

end.

{ }

object Form1: TForm1

Left = 203

Top = 94

BorderIcons = []

BorderStyle = bsNone

ClientHeight = 273

ClientWidth = 427

Font.Color = clWindowText

Font.Height = -13

Font.Name = 'System'

Font.Style = []

PixelsPerInch = 96

TextHeight = 16

object Button1: TButton

Left = 160

Top = 104

Width = 89

Height = 33

Caption = 'Close'

TabOrder = 0

OnClick = Button1Click

end

end

8.1.1PD/PU

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

const

PageDelta = 10;

begin

With VertScrollbar do

if Key = VK_NEXT then

Position := Position + PageDelta

else if Key = VK_PRIOR then

Position := Position - PageDelta;

end;

8.1.1Delphi

Windows,MFCOWL

;Delphi

:,

:

1

PWIN95Delphi 2.0

1.AdditionalScrollBox,Form

2.Standard,PanelScrollBox

PanelScrollBox,ScrollBox

//,ScrollBoxPanel

3.Panel,imageBitBtn

,ScrollBox6Panel,Panel

imageBitBtn

4.FormPanel,""

5.FormBorderStylebsNone

:("",

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Contro

ls, Forms, Dialogs

ExtCtrls, StdCtrls, Buttons;

type

TForm1 = class(TForm)

ScrollBox1: TScrollBox;

Panel1: TPanel;

Panel2: TPanel;

Panel3: TPanel;

Panel4: TPanel;

Panel5: TPanel;

Image1: TImage;

Image2: TImage;

Image3: TImage;

Image4: TImage;

Image5: TImage;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

BitBtn3: TBitBtn;

BitBtn4: TBitBtn;

BitBtn5: TBitBtn;

Panel6: TPanel;

Image6: TImage;

BitBtn6: TBitBtn;

Panel7: TPanel;

Panel8: TPanel;

procedure BitBtn6Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.BitBtn6Click(Sender: TObject);{

}

begin

Close;

end;

end.

:686(16MB RAM,1.2GB)PWin95

;Delpli 2.0

Top of Form 1

Bottom of Form 1

6.2

8.1.1 Do I need a form in the application server?

A:Yes. It doesn't need to be visible, but you do need one. To make the form not visible, set Application.ShowMainForm := False in the project file.

Q:After using the right-click to create the provider function, how can I re-execute the context menu option to "Export from Table"?

A:Once you have exported a provider interface, the context menu option is no longer visible. To re-display the context menu option you must delete the associated property in the Type Library Editor and press the Type Library Editors Refresh button. You should also delete the "Get_XXX" entry in the RemoteDataModule source.

Q:What is the difference between single and multiple instance application servers in a multi-tier application?

A: This can best be thought of from the point of view of the application server and how many clients can it support. One multi-instance server can support multiple clients.A single instance server can only support one client. Multi-instance servers create multiple data modules in one instance of the server. Single instance servers are launched for each client.

8.1.1 How do I locate the application servers available in the registry of the machine?

A: Read the registry key under HKEY_CLASSES_ROOT\CLSID\* looking for keys that have a subkey "Borland DataBroker". These entries are application servers. Here's an example that loads application server names to a Listbox.

procedure TForm1.FormCreate(Sender: TObject);

var

uses Registry;

I: integer;

TempList: TStringList;

begin

TempList := TStringList.Create;

try

with TRegistry.Create do

try

RootKey := HKEY_CLASSES_ROOT;

if OpenKey('CLSID', False) then

GetKeyNames(TempList);

CloseKey;

for I := 1 to TempList.Count - 1 do

if KeyExists('CLSID\' + TempList[I] + '\Borland DataBroker') then