Turbo Pascal Help Index

Assembler, inline

Command-line compiler options

Compiler Directives

Parameter directives

Switch directives

Constants

Turbo Pascal

ObjectWindows

Windows API

Dialog boxes

Turbo Pascal IDE

ObjectWindows

Windows API

Directives

Compiler Directives

Standard directives

Dynamically-Linked Libraries (DLLs)

Editor commands

Block commands (CUA and Alternate)

Block commands (Borland-style)

Cursor movement

Insert and Delete

Miscellaneous

Error messages

Compile-time

Run-time

Functions

Standard

ObjectWindows

Windows API

Graphics Device Interface (GDI)

Menus

Turbo Pascal IDE

Methods

Defined

ObjectWindows

ObjectWindows

Constants

Fields

Functions

Hierarchy

Methods

Objects

Procedures

Records

Types

Variables

WObjects.TPU

Operators

Options

Command line (TPCW.EXE)

Compiler

Linker

Search & replace

Procedures

Standard

ObjectWindows

Windows API

Reserved Words

Resources

Strings

Null-terminated

Strings.TPU

Turbo Pascal

Turbo Pascal Language

Types

Standard Turbo Pascal

ObjectWindows

Windows API

Units

Strings.TPU

System.TPU

WinCrt.TPU

WinDos.TPU

WinProcs.TPU

WinTypes.TPU

WObjects.TPU

Variables

Window Objects

Windows API

Constants

Functions

Messages

Procedures

Records

Types

WinProcs.TPU

WinTypes.TPU


Turbo Pascal IDE dialog boxes

The Turbo Pascal IDE includes these dialog boxes:

Compiler Options

Configuration Save As

Directories

File Open

File Save As

Find Text

Linker Options

Open Configuration File

Parameters

Preferences

Primary File

Replace Text

Select Printer

Set Up

Task List


Turbo Pascal's Menu commands
Turbo Pascal IDE Menu commands

Control menu (Turbo Pascal desktop)

Restore

Move

Size

Minimize

Maximize

Close

Switch to

Control menu (Edit window)

Restore

Move

Size

Minimize

Maximize

Close

Next

File menu

New

Open

Save

Save As

Save All

Print

Printer Setup

Exit

List of closed files

Edit menu

Undo

Redo

Cut

Copy

Paste

Clear

Search menu

Find

Replace

Search Again

Go to Line Number

Show Last Compile Error

Find Error

Run menu

Run

Debugger

Parameters

Compile menu

Compile

Make

Build

Primary File

Clear Primary File

Information

Options menu

Compiler

Linker

Directories

Preferences

Open

Save

Save As

Window menu

Tile

Cascade

Arrange Icons

Close All

Help menu

Index

Topic Search

Using Help

Compiler Directives

ObjectWindows

Procedures and Functions

Reserved Words

Standard Units

Turbo Pascal Language

Windows API

About Turbo Pascal


Index of Turbo Pascal constants

Categories of constants

Flag constants

File-attribute constants

File-mode constants

File-name component string lengths

FileSplit return flags

Alphabetical list of constants

faAnyFile

faArchive

faDirectory

faHidden

faReadOnly

faSysFile

fAuxiliary

faVolumeID

fCarry

fcDirectory

fcExtension

fcFileName

fcWildcards

fmClosed

fmInOut

fmInput

fmOutput

fOverflow

fParity

fsDirectory

fsExtension

fsFileName

fSign

fsPathName

fZero


Index of Turbo Pascal Variables

AutoTracking	WinCrt.TPU

CheckBreak	WinCrt.TPU

CheckEOF	WinCrt.TPU

CmdLine	System.TPU

CmdShow	System.TPU

Cursor	WinCrt.TPU

DosError	WinDos.TPU

ErrorAddr	System.TPU

ExitCode	System.TPU

ExitProc	System.TPU

FileMode	System.TPU

HeapBlock	System.TPU

HeapError	System.TPU

HeapLimit	System.TPU

HeapList	System.TPU

HInstance	System.TPU

HPrevInst	System.TPU

InactiveTitle	WinCrt.TPU

InOutRes	System.TPU

Input	System.TPU

Origin	WinCrt.TPU

Output	System.TPU

PrefixSeg	System.TPU

RandSeed	System.TPU

ScreenSize	WinCrt.TPU

WindowOrg	WinCrt.TPU

WindowSize	WinCrt.TPU

WindowTitle	WinCrt.TPU


Index of Reserved Words
Index of Turbo Pascal Reserved Words

Reserved words are words that have fixed meanings within Turbo Pascal: You can't redefine them.

In the Turbo Pascal manuals and in this Help system, the reserved words appear in boldface type.

Turbo Pascal is not case sensitive, so you can use upper or lowercase letters to write these reserved words.

and

asm

array

begin

case

const

constructor

destructor

div

do

downto

else

end

exports

file

for

function

goto

if

implementation

in

inline

interface

label

library

mod

nil

not

object

of

or

packed

pointer

procedure

program

record

repeat

set

shl

shr

string

then

to

type

unit

until

uses

var

while

with

xor

See Also

Standard directives


Standard Directives
Standard Directives and Procedure Directives

These are Turbo Pascal's standard directives; some of these are also known as procedure directives.

Unlike reserved words, these words can be redefined. However, this is not advised.

absolute

assembler (procedure directive)

export (procedure directive)

external (procedure directive)

far (procedure directive)

forward (procedure directive)

index

interrupt (procedure directive)

name

near (procedure directive)

private

resident

virtual (procedure directive)


absolute address
absolute (standard directive)

You use the reserved word absolute to declare an absolute variable (one that resides at specific--i.e. absolute--memory address).

Syntax

var Ident: type absolute Seg:Ofs;

OR

var Ident: type absolute Variable;

Remarks

The first form directly specifies the address (segment and offset) of the variable.

The second form declares a new variable on top of an existing variable (at the same address).

Note: The variable declaration's identifier list can only specify one identifier when an absolute clause is present.

Example

type

  VectorTable = array[0..255] of pointer;

var

  IntVectors: VectorTable absolute 0:0;

  CrtMode: Byte absolute $0040:$0049;

  Str: string;

  StrLen: Byte absolute Str;


array
array (reserved word)

Used to define an array type.

Syntax

array [index-type] of element-type

Remarks

Several index types are allowed if separated by commas.

The element type can be any type, but the index type must be an ordinal type.

Example

type

  IntList  = array[1..100]     of Integer;

  CharData = array['A'..'Z']   of Byte;

  Matrix   = array[0..9, 0..9] of real;

See Also

array-type constants


asm
asm (reserved word)

Accesses the inline assembler.

Syntax

  asm

    AssemblerStmt <Separator AssemblerStmt>

  end

where

-	AssemblerStmt is an assembler statement

-	Separator is a semicolon, a new-line, or a Pascal comment

Remarks

To place multiple assembler statements on one line, separate them with semicolons. Two assembler statements on separate lines don't require a semicolon.

In an asm statement, a semicolon does not indicate that the rest of the line is a comment. Comments must be Pascal style, using { and } or (* and *).

Register Use

The rules of register use in an asm statement are the same as those of an external procedure or function.

An asm statement must preserve these registers:

BP	SP

SS	DS

An asm statement can freely modify these registers:

AX	BX

CX	DX

SI	DI

ES	Flags

On entry to the asm statement, the inline assembler knows only the BP, SP, SS, and DS registers. It can assume nothing else about register contents.


assembler directive
assembler (procedure directive)

With the assembler directive, you can write complete procedures and functions in inline assembler, without the need for a begin...end statement part.

The assembler directive causes the Turbo Pascal compiler to perform these code-generation optimizations:

-	Value Parameters: The compiler does not generate code to copy value parameters into local variables.

-	Function Result Variable: The compiler does not allocate a function result variable, and a reference to the @Result symbol is an error.

-	Stack Frame: The compiler generates no stack frame for procedures and functions that have no parameters and no local variables.

The value-parameters optimization affects all string-type value parameters, and other value parameters whose size is not 1, 2, or 4 bytes.

Within the procedure or function, such parameters must be treated as if they were var parameters.

String functions are an exception to the function-result optimization--they always have an @Result pointer that gets allocated by the caller.

See Also

Inline Assembler Entry and Exit Code


assignment operator
assignment operator ( := )

Assigns the value of an expression to a variable.

Syntax

variable := expression

Remarks

The variable must be assignment-compatible with the result type of the expression.

Example

X    := Y;

Done := (I > 0) and (I < 100)

A[I] := A[I] + 1;

See Also

expression

statement

variable


begin...end construct
begin...end construct (reserved words)

This construct is a compound statement. The begin and end reserved words serve as statement brackets.

Syntax

begin

  statement;

  statement;

  ...

  statement

end;

Remarks

When bracketed in this way, any number of consecutive statements can be treated as a single statement.

Example

(* Compound statement used within an "if" statement *)

if First < Last then

begin

  Temp := First;

  First := Last;

  Last := Temp;

end;


Boolean type
Boolean types

There are three predefined boolean types: Boolean, WordBool, and LongBool.

Syntax

type

  Boolean = (False, True);

  WordBool = (False, True);

  LongBool = (False, True);

Remarks

These types are the following sizes:

 -	type Boolean is Byte-sized (8 bits)

 -	type WordBool is Word-sized (16 bits)

 -	type LongBool is Longint-sized (32 bits)

Because booleans are enumerated ordinal types, these relationships hold:

False < True

Ord(False) = 0

Ord(True) = 1

Succ(False) = True

Pred(True) = False

Boolean is the preferred type and uses the least memory. WordBool and LongBool primarily exist to provide compatibility with the Windows environment.

In an expression, these relational operatorsRelationalOperators produce results of type Boolean.

   =   <>   >   <   >=   <=   IN

For Windows compatibility, booleans can assume ordinal values other than 0 and 1.

A boolean expression is considered False when its ordinal value is 0, and True when its ordinal value is non-zero.

The not, and, or, and xor boolean operatorsBooleanOperators work by testing for 0 (False) or non-zero (True), but always return a result with an ordinal value of 0 or 1.


case
case (reserved word)

The case statement consists of an expression (the selector) and a list of statements, each prefixed with a case.

Syntax

case expression of

  case: statement;

  ...

  case: statement;

end

OR

case expression of

  case: statement;

 ...

  case: statement;

else

  statement

end

Remarks

A case consists of one or more constants or ranges, separated with commas.

The else part is optional.

Example

case Ch of

  'A'..'Z', 'a'..'z':  WriteLn('Letter');

  '0'..'9':            WriteLn('Digit');

  '+', '-', '*', '/':  WriteLn('Operator');

else

  WriteLn('Special character');

end;


char
Char type

Variables of the ordinal type Char are used to store ASCII characters.

Character constants are written between single quotes, like this:

  'A', '3', or '*'

The single quote character is written as two quotes within quotes, like this:

  ''''

The Chr function converts an Integer value into a character with the corresponding ASCII value.

The Ord function returns a character's ASCII value.


const
Constant declarations (const: reserved word)

A constant declaration (const) defines an identifier that denotes a constant value within the block containing the declaration. A constant identifier can't be included in its own declaration.

Syntax

const

  identifier = expression;

  ...

  identifier = expression;

Remarks

Expressions used in constant declarations must be written such that the compiler can evaluate them at compile time.

As an extension to standard Pascal, Turbo Pascal allows constant expressions.

Typed constant declarations are used to declare initialized variables.

Examples

(* Constant Declarations *)

const

  MaxData  = 1024 * 64 - 16;

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

  Message  = 'Hello world...';

const

  identifier: type = value;

  ...

  identifier: type = value;


Constant expressions

A constant expression is an expression that can be evaluated by the compiler without actually executing the program.

Because the compiler must be able to completely evaluate a constant expression at compile time, these constructs are not allowed in constant expressions:

-	references to variables and typed constants (except in constant address expressions.

-	the @ operator (except in constant address expressions)

-	function calls (except the following)

These standard functions can be used in constant expressions:

Abs	Chr

Hi	Length

Lo	Odd

Ord	Pred

Ptr	Round

SizeOf	Succ

Swap	Trunc


constructor
constructor (reserved word)

A constructor is a special method that initializes an object containing virtual methods.

Syntax

constructor Method (<parameter list>);

Remarks

A constructor must be declared with the reserved word constructor.

The constructor initializes an object by setting the link between the object and the virtual method table with addresses of the code for its virtual methods.

A constructor can also be used to initialize the object data fields.

See Also

destructor

object

virtual


destructor
destructor (reserved word)

A destructor is a special method that disposes dynamic objects from the heap.

Syntax

destructor method

Remarks

A destructor must be declared with the reserved word destructor.

See Also

constructor

object

virtual


do
do (reserved word)

The reserved word do is used in while, for, and with statements.

Example

while Ch = ' ' do Ch := GetChar;

for Ch := 1 to 100 do Ch := GetChar;

with Date[I] do month := 1;


else
else (reserved word)

The reserved word else is used in if and case statements.

Example

(* using "if" statement *)

if (I < Min) or (I > Max) then I := 0;

if ParamCount <> 2 then

begin

  WriteLn('Bad command line');

  Halt(1);

end

else

begin

  ReadFile(ParamStr(1));

  WriteFile(ParamStr(2));

end;

(* using "case" statement *)

case Ch of

  'A'..'Z', 'a'..'z':  WriteLn('Letter');

  '0'..'9':            WriteLn('Digit');

  '+', '-', '*', '/':  WriteLn('Operator');

else

  WriteLn('Special character');

end;


end
end (reserved word)

The reserved word end is used with:

-	begin to form compound statements

-	case to form case statements

-	record to declare record types

-	object to declare object types

-	asm to call the inline assembler

Examples

(* with "begin" to form compound statement *)

if First < Last then

begin

  Temp := First;

  First := Last;

  Last := Temp;

end;

(* with "case" statement *)

case Ch of

  'A'..'Z', 'a'..'z':  WriteLn('Letter');

  '0'..'9':            WriteLn('Digit');

  '+', '-', '*', '/':  WriteLn('Operator');

else

  WriteLn('Special character');

end;

(* with record type definitions *)

type

  Class  = (Num, Dat, Str);

  Date   = record

    D, M, Y: Integer;

  end;

  Facts = record

    Name: string[10];

    case Kind: Class of

      Num: (N: real);

      Dat: (D: Date);

      Str: (S: string);

  end;

(* with object type definitions *)

type

  LocationPtr = ^Location;

  Location = object

    X, Y: Integer;

    procedure Init(PX, PY: Integer);

    function GetX: Integer;

    function GetY: Integer;

  end;

(* with asm *)

asm

  mov ax,1

  mov cx, 100

end;


export directive
export (procedure directive)

The export directive belongs to the same family of procedure directives as the near, far, inline, and interrupt directives.

The export directive makes a procedure or function exportable by:

-	forcing the routine to use the far call model

-	generating special procedure entry and exit code

If procedures and functions are to be exported by a DLL, they must be compiled with the export procedure directive.

This means that an export directive, if present, must be specified on the first introduction of a procedure or function. It can't be supplied in the defining declaration of a forward declaration.

The actual exporting of the procedure or function doesn't occur until the procedure or function is listed in a library's exports clause.

See Also

Dynamically-Linked Libraries

Using DLLs

Writing DLLs


exports
exports (reserved word)

A library's exports clause lists the procedures or functions exported by that DLL.

You can use an exports clause anywhere and any number of times in a program's or library's declaration part.

Each entry in an exports clause specifies the identifier of a procedure or function to be exported.

 -	The identifier must denote a procedure or function that was compiled with the export directive.

 -	The identifier can be fully qualified if necessary.

An exports clause can also include:

-	an index clause

-	a name clause

-	the resident directive


enumerated type
Enumerated types

Enumerated types define ordered sets of values by enumerating the identifiers that denote these values. Their ordering follows the sequence in which the identifiers are enumerated.

Syntax

type

  name = (identifier,

    identifier, ...,

    identifier );

Remarks

The identifiers in the type definition become constants of the enumerated type.

The first constant has an ordinality of 0, the second has an ordinality of 1, the third an ordinality of 2, and so on.

Enumerated types are a subclass of the ordinal types.

Example

type

  Suit = (Club, Diamond, Heart, Spade);

Given this declaration, Heart is a constant of type Suit.

The Ord standard function returns the ordinality of an enumerated constant. In this example,

  Ord(Club)     =  0

  Ord(Diamond)  =  1

  Ord(Heart)    =  2

and so on.


Expressions

Expressions are made up of operators and operands. These are the operands:

constants

variables

function calls

set constructors

Subexpressions can be enclosed in parentheses to change the order of precedence.

See Also

Precedence of operators


far
far (reserved word)

The far directive specifies the far call method, which calls instructions in another code segment.

Syntax

procedure Name; far;

Remarks

Procedures declared in the interface section of a unit are far so they can be called from other units.

The $F compiler directive can override the compiler's automatic call model selection. All procedures and functions declared in the {$F+} state are always far.

See Also

near


Object types
Object types     (object: reserved word)

An object type is a data structure that contains a fixed number of components.

Syntax

object

  Field;

  Field;

  ...

  Method;

  Method;

end;

Remarks

Each component is either a field (which contains data of a particular type) or a method, which performs an operation on the object.

The declaration of a field specifies an identifier that names the field, and its data type.

The declaration of a method specifies a procedure, function, constructor, or destructor heading.

Field 	= FieldName(s): type;

Method 	= procedure MethodName(<parameter(s)>:type);

      or	= function MethodName(<parameter(s)>:type):type;

      or	= constructor MethodName(<parameter(s)>: type [;<parameter(s)>: type]); [virtual];

      or	= destructor MethodName[(<parameters>: type)];[virtual];

An object type can inherit components from another object type. The inheriting object is a descendant and the object inherited from is an ancestor.

The domain of an object type consists of itself and all its descendants.

See Also

object-type constants


private
private (standard directive)

Private is a reserved word only within objects.


external
external (procedure directive)

External declarations allow you to interface with separately compiled procedures and functions written in assembly language.

The external code is linked with the Pascal unit or program through $L filename compiler directives.

In procedures and functions imported from DLLs, the external directive takes the place of the declaration and statement parts that would otherwise be present.

Examples

function GetMode: Word; external;

procedure SetMode(Mode: Word); external; $L CURSOR.OBJ

function GlobalAlloc(Flags: Word; Bytes: Longint): THandle; far; external 'KERNEL' index 15;


file type
file (reserved word)

A file type consists of a linear sequence of components of the component type, which can be any type except a file type.

Syntax

file of type

OR

file

Remarks

If the word of and the component type are omitted, the type denotes an untyped file.

The predefined file type Text signifies a file containing characters organized into lines.

Example

(* File type declarations *)

type

  Person = record

    FirstName: string[15];

    LastName : string[25];

    Address  : string[35];

  end;

  PersonFile = file of Person;

  NumberFile = file of Integer;

  SwapFile = file;


for...to, for...downto
for...to, for...downto (reserved words)

The for statement causes the statement after do to be executed once for each value in the range first to last.

Syntax

for var := first to last do

  statement

OR

for var := first downto last do

  statement

Remarks

The control variable and the initial and final values must be of an ordinal type.

to

With to, the value of the control variable is incremented by 1 for each loop.

downto

With downto, the value of the control variable is decremented by 1 for each loop.

Example

(* for ... to, for ... downto *)

for I := 1 to ParamCount do

  WriteLn(ParamStr(I);

for I := 1 to 10 do

  for J := 1 to 10 do

  begin

    X := 0;

    for K := 1 to 10 do

      X := X + Mat1[I, K] * Mat2[K, J];

    Mat[I, J] := X;

  end;


forward
forward (procedure directive)

With a forward declaration, you can make a procedure or function known without actually specifying its statement part.

From the point of the forward declaration, other procedures and functions can call the forwarded routine, making mutual recursion possible.

Somewhere after a forward declaration, the procedure or function must be defined by a defining declaration that specifies the statement part of the routine.

The defining declaration can omit the parameter list from the procedure or function header.

Example

(* Forwarded procedure *)

procedure Flip(N: Integer); forward;

procedure Flop(N: Integer);

begin

  WriteLn('Flop');

  if N > 0 then Flip(N - 1);

end;

procedure Flip;

begin

  WriteLn('Flip');

  if N > 0 then Flop(N - 1);

end;


function
function (reserved word)

A function is a program part that computes and returns a value.

Syntax

function ident : type;

OR

function ident (parameters) : type;

Remarks

The function heading specifies the identifier for the function, the formal parameters (if any), and the function result type.

Valid result types are ordinal, real, string, and pointer types.

A function is activated by the evaluation of a function call in an expression.

The function heading is followed by:

-	a declaration part that declares local objects

-	the statement part, which specifies the statements to be executed when the function is called

The statement part should contain at least one statement that assigns a value to the function identifier; the result of the function is the last value assigned.

Instead of the declaration and statement parts, a function declaration can specify a forward, external, far, or inline directive.

Example

(* Function declaration *)

function UpCaseStr(S: string): string;

var

  I: Integer;

begin

  for I := 1 to Length(S) do

  if (S[I] >= 'a') and (S[I] <= 'z') then

  Dec(S[I], 32);

  UpCaseStr := S;

end;


goto
goto (reserved word)

A goto statement transfers program execution to the statement prefixed by the label referenced in the statement.

Syntax

goto Label

Remarks

The label must be in the same block as the goto statement; it is not possible to jump out of a procedure or a function.

Example

label 1, 2;

goto 1

   .

   .

   .

1: WriteLn ('Abnormal program termination');

2: WriteLn ('Normal program termination');


identifier
Identifiers

Identifiers denote the following:

constants

fields in records

functions

labels

procedures

programs

types

units

variables

Identifiers can be of any length, but only the first 63 characters are significant.

-	The first character of an identifier must be a letter.

-	The characters that follow the first one must be letters, digits, or underscores (no spaces).

Like reserved words, identifiers are not case-sensitive.

Qualified identifiers

When several instances of the same identifier exist, you might need to qualify the identifier by a unit identifier in order to select a specific instance.

The combined identifier is called a qualified identifier.

Examples

(* Identifiers *)

WriteLn

Exit

Real2String

(* Qualified identifiers *)

System.MemAvail  (* unit = System, identifier = MemAvail *)

Dos.Exec         (* unit = Dos, identifier = Exec *)

Crt.Window       (* unit = Crt, identifier = Window *)


if...then...else
if...then...else (reserved words)

If, then, and else specify the conditions under which a statement will be executed.

Syntax

if expr then statement

OR

if expr then statement else statement

Remarks

If the Boolean expression after if is True, the statement after then is executed.

Otherwise, if the else part is present, the statement after else is executed.

Example

(* "if" statements *)

if (I < Min) or (I > Max) then I := 0;

if ParamCount <> 2 then

begin

  WriteLn('Bad command line');

  Halt(1);

end

else

begin

  ReadFile(ParamStr(1));

  WriteFile(ParamStr(2));

end;


implementation
implementation (reserved word)

The implementation part of the unit is where you find the bodies of the procedures and functions that are declared in the  interface part of the unit.

The implementation part of the unit is the private part. Declarations made here can be used only within this section of the unit.

All constants, types, variables, procedures, and functions in the interface portion are visible in the implementation.

The implementation can have additional declarations of its own that are not visible to any programs using the unit.

A uses clause can appear in the implementation, immediately following the reserved word implementation.

If any procedures have been declared external, one or more $L filename directive(s) should appear anywhere in the source file before the final end of the unit.

The normal (not inline) procedures and functions declared in the interface must reappear in the implementation.

The procedure/function header in the implementation should be either:

-	identical to the declaration in the interface, or

-	in the short form


Short-form headers

For short-form headers, type in the reserved word (procedure or function), followed by the routine's name (identifier).

The routine will then contain all its local declarations (labels, constants, types, variables, and nested procedures and functions), followed by the main body of the routine itself.

Routines local to the implementation (not declared in the interface section) must have a complete procedure/function header.


index clause
index (standard directive)

An index clause consists of the word index followed by an integer constant between 1 and 32767.

An index clause is included in an exports clause.

When an index clause is used, the procedure or function to be exported uses the specified ordinal number. If no index clause is used in an exports clause, an ordinal number is assigned.

Example

  procedure ImportByOrdinal; external 'TESTLIB' index 5;

See Also

Using DLLs


inline
inline (reserved word)

Inline statements and directives allow you to insert machine code instructions directly into the code of a program or a unit.

Syntax

inline ( data / data / ... data )

Remarks

When used as a statement, the inline data elements are inserted directly in the code.

When used as a directive in a procedure or a function declaration, the inline data elements are inserted in the code each time the procedure or function is called.

An inline data element consists of a constant or a variable identifier, optionally prefixed by a size specifier, < or >.

A variable identifier can be followed by + (plus) or - (minus) and a constant to specify an offset from the variable's address.

An inline element generates 1 byte of code if it is a constant within the range 0..255; otherwise, it generates one word.

You use the < and > operators to override the automatic size selection:

<	means always generate a byte

>	means always generate a word.

Example

(* "inline" statement *)

procedure FillWord(var Dest; Count: Word; Data: Word);

begin

  inline(

    $C4/$7E/<Dest/    (* LES   DI,Dest[BP] *)

    $8B/$4E/<Count/   (* MOV   CX,Count[BP]*)

    $8B/$46/<Data/    (* MOV   AX,Data[BP] *)

    $FC/              (* CLD               *)

    $F3/$AB);         (* REP   STOSW       *)

end;

See Also

built-in assembler


Integer types

Turbo Pascal provides five predefined Integer types. Each type denotes a specific subset of the whole numbers, as shown here:

Type	Range	Format

Shortint	-128..127	Signed 8-bit

Integer	-32768..32767	Signed 16-bit

Longint	-2147483648..2147483647	Signed 32-bit

Byte	0..255	Unsigned 8-bit

Word	0..65535	Unsigned 16-bit

All Integer types are ordinal types.


interface
interface (reserved word)

The interface section of a unit is the public part.

It determines what is visible and accessible to any program (or other unit) using that unit.

The interface section starts at the reserved word interface, which appears after the unit header, and ends with the reserved word implementation.

In the unit interface, you declare constants, data types, variables, procedures, and functions.

The "bodies" of the public procedures and functions are in the implementation section.

Forward declarations,are not allowed.

A uses clause can appear in the interface section. (If present, uses must immediately follow the reserved word interface).


interrupt
interrupt (procedure directive)

The interrupt directive allows you to declare interrupt procedures.

Syntax

procedure IntProc(Flags, CS, IP, AX, BX, CX, DX, SI, DI, DS, ES, BP: Word);

interrupt;

Remarks

An interrupt procedure must specify the following procedure header:

The registers are passed as pseudo-parameters so you can use and modify them in the code of the interrupt procedure.


label
label (reserved word)

A label declaration part declares labels that mark statements in the corresponding statement part.

Syntax

label identifier, ... identifier;

Remarks

Each label must mark only one statement.

In addition to an identifier, a digit sequence between 0 and 9999 can also be used as a label.

Control is transferred to a label through a goto statement.

Example

label 1, 2;

goto 1

   .

   .

   .

1:  WriteLn ('Abnormal program termination');

2:  WriteLn ('Normal program termination');


library
library (reserved word)

A DLL starts with a library header.

The library header tells Turbo Pascal to produce an executable file with the extension .DLL instead of .EXE.

See Also

export directive

exports clause

name clause

import units

index clause


Maxint and MaxLongInt
MaxInt and MaxLongInt (constants)

MaxInt and MaxLongInt are predefined constants.

-	MaxInt contains the largest possible Integer (32,767)

-	MaxLongint contains the largest possible Longint (2,147,483,647)


method
Methods

A method is a procedure or function declared inside an object type declaration.

Syntax

procedure Method(<parameter list>);

Remarks

Methods can access the object's data fields without having them passed to it as parameters.

The declaration inside the object type declaration consists of the header only.

The body of the method is defined outside the object type declaration. Its header must contain the name of the object type it is bound to, like this:

  procedure ObjectType.Method(<parameter list>);

  begin

  ...

  end;  (* Method *)

Methods can be static, virtual, or dynamic.

In addition to regular procedures and functions, object-oriented Pascal includes two special method types: constructor and destructor.

See Also

Self


Dynamic Methods

A dynamic method is a method whose call is linked to its code at run time by a process called late binding.

It differs from a virtual method in that its declaration includes a dynamic method index.

Syntax

procedure MethodName (<parameter list>); virtual DynamicMethodIndex

Remarks

DynamicMethodIndex is an integer, an integer constant, or an expression that evaluates to an integer.

Like virtual methods, dynamic methods allow methods with the same name to be implemented in different ways up and down a hierarchy of object types. If you derive types from other types with many virtual methods, using dynamic methods might require less memory.


name clause
name (standard directive)

A name clause is included in an exports clause. A name clause consists of the word name followed by a string constant.

When you use a name clause, the procedure or function to be exported uses the name specified by the string constant.

If no name clause is used, the procedure or function is exported by its identifier and is converted to all uppercase.


near
near (reserved word)

The near directive specifies the near call method. A near call transfers control to another location within the same code segment.

Syntax

procedure Name; near;

Remarks

Procedures declared in a program or in the implementation section of a unit are near.

See Also

far


NIL
nil (reserved word)

The reserved word nil denotes a pointer type constant that doesn't point to anything.

nil is compatible with all pointer types.


of
of (reserved word)

The reserved word of is used in array, set, and file type declarations, and in case statements.

Syntax

identifier = array[X..Y] of type

identifier = set of type

identifier = file of type

case expression of <case statement list>

Examples

(* array declaration *)

type

  IntList  = array[1..100]     of Integer;

  CharData = array['A'..'Z']   of Byte;

  Matrix   = array[0..9, 0..9] of real;

(* Set types *)

type

  Day = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);

  CharSet = set of Char;

  Digits = set of 0..9;

  Days = set of Day;

(* File type declarations *)

type

  Person = record

     FirstName: string[15];

     LastName : string[25];

     Address  : string[35];

  end;

  PersonFile = file of Person;

  NumberFile = file of Integer;

  SwapFile = file;

(* case statement *)

case Ch of

  'A'..'Z', 'a'..'z':  WriteLn('Letter');

  '0'..'9':            WriteLn('Digit');

  '+', '-', '*', '/':  WriteLn('Operator');

else

  WriteLn('Special character');

end;


Ordinal types

Turbo Pascal has nine predefined ordinal types:

Five of these integer types denote a specific subset of the whole numbers, as shown here:

Type	Range	Size

Shortint	128..127	8-bit

Integer	-32768..32767	16-bit

Longint	-2147483648..2147483647	32-bit

Byte	0.255	8-bit

Word	0.65535	16-bit

The other four predefined ordinal types are the booleans (Boolean, WordBool, LongBool), and Char.

Two other classes of user-defined ordinal types are enumerated types and subrange types.

These standard functions can be used with all ordinal types:

Ord

Pred

Succ


packed
packed (reserved word)

The reserved word packed can prefix an array type declaration.

However, it has no effect in Turbo Pascal, since packing occurs automatically.


Parameter list

A procedure or function heading can specify a formal parameter list, like so: ( params; params; ... params )

Each parameter group takes one of the following forms:

  identifier, identifier: type { list of value parameters }

  var identifier, identifier: type { list of variable parameters }

  var identifier, identifier { list of untyped variable parameters }


Pointer types
Pointer types  (pointer: reserved word)

A pointer type variable contains the memory address of a dynamic variable of a specified base type.

You can assign a value to a pointer variable with:

-	the New or GetMem procedures

-	the @ operator

-	the Ptr function

The reserved word nil denotes a pointer constant that doesn't point to anything.

Pointer

The predefined type Pointer denotes an untyped pointer (a pointer that doesn't point to any specific type).

PChar

The predefined type PChar denotes a pointer to a null-terminated string.

PChar is declared as:

  type PChar = ^Char;

Turbo Pascal for Windows supports a set of extended syntax rules (controlled by the $X compiler directive) to facilitate handling of strings using the PChar type.

Example

{ Pointer Type Declaration }

type

  BytePtr  = ^Byte;

  WordPtr  = ^Word;

  IdentPtr = ^IdentRec;

  IdentRec = record

    Ident: string[15];

    RefCount: Word;

    Next: IdentPtr;

  end;

See Also

pointer-type constants


resident
resident (standard directive)

The resident standard directive is included in an exports clause.

When resident is used, the export information stays in memory when the DLL is loaded.

The resident option reduces the time it takes Windows to look up a DLL entry by name.

If client programs that use the DLL are likely to import certain entries by name, they should be exported using the resident standard directive.


procedure
procedure (reserved word)

A procedure is a program part that performs a specific action, often based on a set of parameters.

Syntax

  procedure identifier;

OR

  procedure identifier ( parameters );

Remarks

The procedure heading specifies the identifier for the procedure and the formal parameters (if any).

A procedure is activated by a procedure statement.

The procedure heading is followed by:

-	a declaration part that declares local objects

-	the statements between begin and end, which specify what is to be executed when the procedure is called.

Instead of the declaration and statement parts, a procedure declaration can specify a forward, external, or inline directive.

Example

{ Procedure Declaration }

  procedure WrStr(X, Y: integer; S: string);

  var

    SaveX, SaveY: Integer;

  begin

    SaveX := WhereX;

    SaveY := WhereY;

    GotoXY(X, Y);

    Write(S);

    GotoXY(SaveX, SaveY);

  end;

See Also

procedural-type constants


Program Layout
program (reserved word)

This is the general layout of a Turbo Pascal program:

program	... ;	{ Program heading }

uses	... ;	{ Uses clause }

label	... ;	{ Labels }

const	... ;	{ Constants }

type	... ;	{ Types }

var	... ;	{ Variables}

procedure	... ;	{ Procedures }

function	... ;	{ Functions }

begin

   statement; 	{ Statements }

    ...

end.

-	The program heading specifies the program's name and parameters; it is purely decorative and has no meaning to the program itself.

-	The uses clause lists the units used by the program.

-	The label, constant, variable, procedure, and function declaration parts can be listed in any order, and repeated any number of times.

-	The statement part specifies the statements to be executed when the program runs.


Real types

A real type has a set of values that is a subset of real numbers, which can be represented in floating-point notation with a fixed number of digits.

A value's floating-point notation normally is made up of three values--M, B, and E--such that M x B E = N where B is always 2, and both M and E are integral values within the real type's range.

Turbo Pascal provides five predefined real types. Each type has a specific range and precision:

Type	Range	Digits	Bytes

real	2.9e-39..1.7e38	11-12	     6

single	1.5e-45..3.4e38	7-8	     4

double	5.0e-324..1.7e308	15-16	     8

extended	3.4e-4932..1.1e4932	19-20	   10

comp	-9.2e18..9.2e18	19-20	     8

Note: The comp type is a 64-bit integer. It holds only integral values within the range

(-2 63 + 1) to (2 63 - 1).

Turbo Pascal supports two models of floating-point code generation:

-	Software floating point, {$N-}

-	80x87 floating point, {$N+}

You use the $N compiler directive to switch between the two models.


record
record (reserved word)

A record contains a number of components, or fields, that can be of different types.

Syntax

record

  fields;

  fields;

  ...

  fields

end;

  OR

record

  fields;

  ...

  case tag: type of

  case: ( fields );

  ...

  case: ( fields )

end;

Remarks

Each field list is a comma-separated list of identifiers, followed by a colon and a type.

Example

{ Record Type Definitions }

type

  Class  = (Num, Dat, Str);

  Date   = record

     D, M, Y: Integer;

  end;

  Facts = record

    Name: string[10];

    case Kind: Class of

      Num: (N: real);

      Dat: (D: Date);

      Str: (S: string);

  end;

See Also

record-type constants


repeat...until
repeat...until (reserved words)

The statements between repeat and until are executed in sequence until, at the end of a sequence, the Boolean expression is True.

Syntax

repeat

  statement;

  statement;

  ...

  statement

until expression

Remarks

The sequence is executed at least once.

Example

{ Repeat Statements }

  repeat Ch := GetChar until Ch <> ' ';

  repeat

    Write('Enter value: ');

    ReadLn(I);

  until (I >= 0) and (I <= '9');


self (parameter)
Self (implicit parameter)

Self is an implicit parameter passed whenever a method is called.

Self is a 32-bit pointer to the instance through which the method is being called.

It guarantees, among other things, that the correct virtual methods will be called for that particular object instance.


set
set (reserved word)

Syntax

  set of type

Remarks

The base type of a set must be an ordinal type with no more than 256 possible values.

The ordinal values of the upper and lower bounds of the base type must be within the range 0..255.

A set constructor, which denotes a set type value, is formed by writing expressions within brackets. Each expression denotes a value of the set.

The notation [ ] denotes the empty set, which is compatible with all set types.

Example

{ Set types }

  type

    Day = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);

    CharSet = set of Char;

    Digits = set of 0..9;

    Days = set of Day;

{ Set constructors }

  ['0'..'9', 'A'..'Z', 'a'..'z', '_']

  [1, 5, I + 1 .. J - 1]

  [Mon..Fri]

See Also

Set-type constants


Statements

A statement is one of the following:

assignment (:=)

begin..end

case..of..else..end

for..to/downto..do

goto

if..then..else

inline(...)

procedure call

repeat..until

while..do

with..do


String types
String types     (string: reserved word)

A string type variable is a sequence of characters with a dynamic length, and a constant maximum size between 1 and 255.

Syntax

  string [ constant ]

    OR

  string

Remarks

A string type declared without a maximum size is given the size 255.

String constants are written in quotes; for example:

-	'Turbo'

-	'That''s all'

Notice how two consecutive single quotes are used to indicate a single quote in a string.

These operators can be used with string type values:

  +    =    <>    <    >    <=    >=

The standard function Length returns the dynamic length of a string.

Example

{ String Type Definitions }

  const

    LineLen = 79;

  type

    Name = string[25];

    Line = string[LineLen];

See Also

String-type constants


subrange type
Subrange types

A subrange type is a range of values from an ordinal type called the host type.

Syntax

  Constant1 .. Constant2

Remarks

The definition of a subrange type specifies the least and the largest value in the subrange.

Both constants must be of the same ordinal type, and the first constant must be less than or equal to the second constant.

The $R compiler directive controls range-checking of subrange types.

Examples

{ Subranges }

 0..99

 -128..127


type declaration
type (reserved word)

A type declaration specifies an identifier that denotes a type.

Syntax

  type

    identifier = AnyType;

    ...

    identifier = AnyType;

Where AnyType is a type identifier of any of the following types:

array

file

object

ordinal

pointer

real

record

set

string


unit
unit (reserved word)

Units are the basis of modular programming in Turbo Pascal. You use units to create libraries and to divide large programs into logically related modules.

These are the parts of a unit,:

-	unit heading

-	interface part

-	implementation part

-	initialization part

Unit heading

The unit heading specifies the unit's name, which you use when referring to the unit in a uses clause.

Interface part

The interface part declares constants, types, variables, procedures, and functions that are public (available to the users of the unit).

Procedures and functions are listed only as headings in the interface part. The bodies of the procedures and functions are in the implementation part.

Implementation part

The implementation part defines the bodies of all public procedures and functions.

In addition, it declares constants, types, variables, procedures, and functions that are private and not available to the users of the unit.

Initialization part

The initialization part is the last part of a unit. It consists of either:

-	the reserved word end (no initialization code),or;

-	a statement part to be executed in order to initialize the unit


uses clause
uses (reserved word)

Each identifier in a uses clause names a unit used by the current program or unit.

Syntax

uses identifier, ... identifier;

Remarks

To locate a unit specified in a uses clause, the compiler first checks the resident units loaded from TPW.TPL at startup time.

If the compiler doesn't find the specified unit (UnitName) in the resident units, it searches for that unit on disk. The compiler searches for the unit as UNITNAME.TPU.

The compiler searches in the current directory and in the directories specified in Options|Directories|Unit Directories.

Example

program MyProgram;

uses WinDos, WinCrt;  { program can now use }

                       { routines in WinDos and WinCrt }


var
var (reserved word)

A variable (var) declaration associates an identifier and a type with a location in memory where values of that type can be stored.

Syntax

  var

    identifier, ... identifier: type;

    ...

    identifier, ... identifier: type;

Remarks

An absolute clause can be used to specify an absolute memory address.

The var reserved word is also used to declare variable parameters.

Examples

{ Variable Declarations }

  var

    X, Y, Z: real;

    I, J, K: Integer;

    Done, Error: Boolean;

    Vector: array[1..10] of real;

    Name: string[15];

    InFile, OutFile: Text;

    Letters: set of 'A'..'Z';


virtual
virtual (procedure directive)

A virtual method is a method whose call is linked to its code at run time, by a process called late binding.

Syntax

procedure Method(<parameter list>); virtual;

Remarks

Declaring a method as virtual makes it possible for methods with the same name to be implemented in different ways up and down a hierarchy of object types.

See Also

Dynamic methods

Self


while
while (reserved word)

A while statement contains an expression that controls the repeated execution of a statement (which can be a compound statement).

Syntax

while expression do statement

Remarks

The statement after do is executed repeatedly as long as the Boolean expression is True.

The expression is evaluated before the statement is executed, so if the expression is False at the beginning, the statement is not executed at all.

Example

{ "while" statements }

  while Ch = ' ' do Ch := GetChar;

  while not Eof(InFile) do

  begin

    ReadLn(InFile, Line);

    WriteLn(OutFile, Line);

    Inc(LineCount);

  end;


with
with (reserved word)

The with statement is a shorthand method for referencing the fields of a record.

Syntax:

  with var, var, ... var do statement

Remarks

Within the statement after do, the fields of one or more record variables can be accessed using only their field identifiers.

Example

{ "with" statement }

  with Date[I] do

  begin

    month := 1;

    year  := year + 1;

  end;

This is equivalent to:

  Date[I].month := 1;

  Date[I].year  := Date[I].year + 1;


Precedence of Operators

Operators	Precedence	Category

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

@	not	First (high)	Unary operators

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

*	/	div	mod	Second	Multiplying operators

and	shl	shr

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

+	-	or	xor	Third	Adding operators

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

=	<>	<	>	Fourth (low)	Relational operators

<=	>=	in

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

Rules of precedence

 1)	An operand between two operators of different precedence is bound to the operator with higher precedence.

 2)	An operand between two equal operators is bound to the one on its left.

 3)	Expressions within parentheses are evaluated prior to being treated as a single operand.

Operations with equal precedence are normally performed from left to right, although the compiler might at times rearrange the operands to generate optimum code.

See Also

Binary arithmetic operators

Unary arithmetic operators

Boolean operators

Logical operators

PChar operators

Relational operators

Set operators

String operators

The @ operator


Binary Arithmetic Operators

Operator	Operation	Operand types	Result type

  +	Addition 	integer type	integer type

real type	real type

  -	Subtraction	integer type	integer type

real type	real type

  *	Multiplication	integer type	integer type

real type	real type

  /	Division	integer type	real type

real type	real type

div	Integer division	integer type	integer type

mod	Remainder	integer type	integer type

Note

The + operator is also used as a string operator or set operator,

The +, -, and * operators are also used as set operators,


Unary Arithmetic Operators

Operator	Operation	Operand types	Result type

+	Sign identity	integer type	integer type

real type	real type

-	Sign negation	integer type	integer type

real type	real type

Note

Any operand whose type is a subrange of an ordinal type is treated as if it were of the ordinal type.

If both operands of a +, -, *, div, or mod operator are of an integer type, the result type is of the common type of the two operands.

If one or both operands of a +, -, or * operator are of a real type, the type of the result is Real in the {$N-} state or Extended in the {$N+} state.

If the operand of the sign identity or sign negation operator is of an integer type, the result is of the same integer type. If the operand is of a real type, the type of the result is Real or Extended.

The value of  X/Y  is always of type Real or Extended regardless of the operand types. An error occurs if Y is 0.

The value of  I div J  is the mathematical quotient of I / J, rounded in the direction of 0 to an integer-type value. An error occurs if J is 0.

The mod operator returns the remainder obtained by dividing its two operands:

  I mod J = I - (I div J) * J

The sign of the result of mod is the same as the sign of I. An error occurs if J is 0.


Logical Operators

Operator	Operation	Operand types	Result type

not	Bitwise negation	integer type	integer type

and	Bitwise and	integer type	integer type

or	Bitwise or	integer type	integer type

xor	Bitwise xor	integer type	integer type

shl	Shift left	integer type	integer type

shr	Shift right	integer type	integer type

Note

The not operator is a unary operator.

If the operand of the not operator is of an integer type, the result is of the same integer type.

If both operands of an and, or, or xor operator are of an integer type, the result type is the common type of the two operands.

The operations I shl J and I shr J shift the value of I to the left or to the right by J bits. The type of the result is the same as the type of I.


Boolean Operators

Operator	Operation	Operand types	Result type

not	negation	Boolean	Boolean

and	logical and	Boolean	Boolean

or	logical or	Boolean	Boolean

xor	logical xor	Boolean	Boolean

The not operator is a unary operator.


String operator

Operator	Operation	Operand types	Result type

+	concatenation	string type, Char type,	string type

or packed string type

Turbo Pascal allows you to use the + operator to concatenate two string operands.

The result is compatible with any string type (but not with Char types and packed string types).

If the resulting string is longer than 255 characters, it is truncated after character 255.

See Also

Relational operators (=, <>, <, >, <=, >=)


PChar Operators

The extended syntax (enabled using a {$X+} compiler directive) supports a number of new operations on character pointers.

The plus (+) and minus (-) operators can be used to increment and decrement the offset part of a pointer value.

The minus operator can be used to calculate the distance (difference) between the offset parts of two character pointers.

Assuming that P and Q are values of type PChar and I is a value of type Word, these constructs are allowed:

Construct	Result

P + I	Add I to the offset part of P

I + P	Add I to the offset part of P

P - I	Subtract I from the offset part of P

P - Q	Subtract offset part of Q from offset part of P

P + I, I + P

The operations P + I and I + P add I to the address given by P, producing a pointer that points I characters after P.

P - I

The operation P - I subtracts I from the address given by P, producing a pointer that points I characters before P.

P - Q

The operation P - Q computes the distance between Q (the lower address) and P (the higher address), resulting in a value of type Word that gives the number of characters between Q and P.

This operation assumes that P and Q point within the same character array. If the two character pointers point into different character arrays, the result is undefined.


Set operators

Operator	Operation	Operand types

+	Union	compatible set types

-	Difference	compatible set types

*	Intersection	compatible set types

The results of set operations conform to the rules of set logic:

 -	An ordinal value C is in A  +  B only if C is in A or B.

 -	An ordinal value C is in A  -  B only if C is in A and not in B.

 -	An ordinal value C is in A  *  B only if C is in both A and B.

If the smallest ordinal value that is a member of the result of a set operation is A and the largest is B, the type of the result is set of A..B.


Relational Operators

Operator 	Operation	Result type	Operand types

=	Equal	Boolean	compatible simple, pointer, set, string, or packed string types

<>	Not equal	Boolean	compatible simple, pointer, set, string, or packed string types

<	Less than	Boolean	compatible simple, string, packed string types, or PChar

>	Greater than	Boolean	compatible simple, string, packed string types, or PChar

<=	Less or equal	Boolean	compatible simple, string, packed string types, or PChar

>=	Greater or equal	Boolean	compatible simple, string, or packed string types, or PChar

<=	Subset of	Boolean	compatible set types

>=	Superset of	Boolean	compatible set types

in	Member of	Boolean	left operand: any ordinal type T;

right operand: set  whose base is compatible with T.


The @ ("at") Operator
The @ ("at") operator: Pointer operation

You can create a pointer to a variable with the @ operator.

Operator	Operation	Operand types	Result type

@	Pointer formation	Variable reference,	Pointer (same as nil)

procedure identifier,

or function identifier

@ is a unary operator. Special rules apply to use of the @ operator with a procedural variable.

The type of the value is the same as the type of nil, so it can be assigned to any pointer variable.

@ with a variable

Using @ with an ordinary variable (not a parameter) is uncomplicated. For example, given these declarations:

  type

    TwoChar = array[0..1] of Char;

  var

    Int: Integer;

    TwoCharPtr: ^TwoChar;

this statement causes TwoCharPtr to point to Int:

  TwoCharPtr := @Int;

TwoCharPtr^ becomes a re-interpretation of the value of Int, as though it were an array[0..1] of Char.

@ with a value parameter

Applying @ to a formal value parameter results in a pointer to the stack location containing the actual value.

For example, suppose Fred is a formal value parameter in a procedure and FredPtr is a pointer variable.

If the procedure executes this statement

  FredPtr := @Fred;

FredPtr^ references Fred's value.

However, FredPtr^ does not reference Fred itself. It references the value that was taken from Fred and stored on the stack.

@ with a variable parameter

Applying @ to a formal variable parameter results in a pointer to the actual parameter (the pointer is taken from the stack).

For example, suppose the following:

 -	One is a formal variable parameter of a procedure,

 -	Two is a variable passed to the procedure as One's actual parameter

 -	OnePtr is a pointer variable.

If the procedure executes this statement

  OnePtr := @One;

OnePtr is a pointer to Two, and OnePtr^ is a reference to Two itself.

@ with a procedure or function

You can apply @ to a procedure or a function to produce a pointer to its entry point. Turbo Pascal does not give you a mechanism for using such a pointer.

The only use for a procedure pointer is to pass it to an assembly language routine or to use it in an inline statement.

@ with a method

You can apply @ to a qualified method identifier to produce a pointer to the method's entry point.


Index of ObjectWindows Objects
Index of ObjectWindows Objects (alphabetical)

This index is an alphabetical listing of the ObjectWindows objects.

For an alphabetical listing of the object fields, see the Index of ObjectWindows Fields Help screen. For an alphabetical listing of the object methods, see the Index of ObjectWindows Methods Help screen.

For a different perspective on these objects, see the ObjectWindows Object Hierarchy Help screen.

TApplication

TBufStream

TButton

TCheckBox

TCollection

TComboBox

TControl

TDialog

TDlgWindow

TDosStream

TEdit

TEmsStream

TGroupBox

TListBox

TMDIClient

TMDIWindow

TObject

TRadioButton

TScrollBar

TScroller

TSortedCollection

TStatic

TStrCollection

TStream

TWindow

TWindowsObject


ObjectWindows Object Hierarchy

In this object Hierarchy diagram, "parenthood" proceeds from left-to-right:

TObject is the parent of TApplication and TWindowsObject

TWindowsObject is the parent of TDialog and TWindow

TWindow is the parent of TEditWindow, TMDIWindow,and TControl

TControl is the parent of TMDIClient,, etc.

For an alphabetical listing of the ObjectWindows objects, see the Index of ObjectWindows Objects Help screen.

TObject

TApplication

TWindowsObject

TDialog

TDlgWindow

TWindow

TMDIWindow

TControl

TMDIClient

TButton

TScrollBar

TStatic

TEdit

TListBox

TComboBox

TGroupBox

TCheckBox

TRadioButton

TScroller

TStream

TEMSStream

TDosStream

TBufStream

TCollection

TSortedCollection

TStrCollection


Index of ObjectWindows Fields

This is an alphabetical listing of the ObjectWindows object fields.

For an alphabetical listing of the object methods, see the Index of ObjectWindows Methods Help screen. For an alphabetical listing of the objects, see the Index of ObjectWindows Objects Help screen.

Attr

AutoMode

BufEnd

Buffer

BufPtr

BufSize

ChildList

ChildMenuPos

ClientAttr

ClientWnd

Count

DefaultProc

Delta

DialogProc

Duplicates

ErrorInfo

Flags

FocusChildHandle

Group

HAccTable

Handle

HasHScrollBar

HasVScrollBar

HWindow

Instance

IsModal

Items

KBHandlerWnd

Limit

LineMagnitude

MainWindow

Name

NotifyParent

PageCount

PageMagnitude

Parent

Position

Scroller

Size

Status

TextLen

TrackMode

TransferBuffer

Window

XLine

XPage

XPos

XRange

XUnit

YLine

YPage

YPos

YRange

YUnit


Index of ObjectWindows Methods

This is an alphabetical listing of the ObjectWindows object methods.

For an alphabetical listing of the object fields, see the Index of ObjectWindows Fields Help screen. For an alphabetical listing of the objects, see the Index of ObjectWindows Objects Help screen.

AddString

ArrangeIcons

At

AtDelete

AtFree

AtInsert

AtPut

AutoScroll

BeginView

BNClicked

Cancel

CanClose

CanUndo

CascadeChildren

Check

ChildWithID

Clear

ClearList

ClearModify

CloseChildren

CloseWindow

CMArrangeIcons

CMCascadeChildren

CMCloseChildren

CMCreateChild

CMEditClear

CMEditCopy

CMEditCut

CMEditDelete

CMEditPaste

CMEditUndo

CMTileChildren

Compare

Copy

CopyFrom

Create

CreateChild

CreateChildren

Cut

DefChildProc

DefCommandProc

DefNotificationProc

DefWndProc

Delete

DeleteAll

DeleteLine

DeleteSelection

DeleteString

DeleteSubText

DeltaPos

Destroy

DisableAutoCreate

DisableTransfer

DispatchScroll

Done

EnableAutoCreate

EnableKBHandler

EnableTransfer

EndDlg

EndView

Error

ExecDialog

Execute

FirstThat

Flush

ForEach

Free

FreeAll

FreeItem

Get

GetCheck

GetChildPtr

GetClassName

GetClient

GetCount

GetID

GetItem

GetItemHandle

GetLine

GetLineFromPos

GetLineIndex

GetLineLength

GetMsgID

GetNumLines

GetPos

GetPosition

GetRange

GetSelection

GetSelIndex

GetSelString

GetSiblingPtr

GetSize

GetString

GetStringLen

GetSubText

GetText

GetWindowClass

HideList

HScroll

IndexOf

Init

InitApplication

InitChild

InitClientWindow

InitInstance

InitMainWindow

InitResource

Insert

InsertString

IsFlagSet

IsModified

IsVisibleRect

KeyOf

LastThat

Load

MakeWindow

MessageLoop

Next

Ok

Pack

Paint

Paste

Previous

ProcessAccels

ProcessAppMsg

ProcessDlgMsg

ProcessMDIAccels

Put

PutChildPtr

PutItem

PutSiblingPtr

Read

ReadStr

Register

Reset

Run

SBBottom

SBLineDown

SBLineUp

SBPageDown

SBPageUp

SBThumbPosition

SBThumbTrack

SBTop

Scroll

ScrollBy

ScrollTo

Search

Seek

SelectionChanged

SetSelection

SendDlgItemMsg

SetCheck

SetFlags

SetKBHandler

SetLimit

SetPageSize

SetPosition

SetRange

SetSBarRange

SetSelIndex

SetSelString

SetText

SetUnits

SetupWindow

Show

ShowList

Store

StrRead

StrWrite

TileChildren

Toggle

Transfer

TransferData

Truncate

Uncheck

Undo

ValidWindow

VScroll

WMActivate

WMClose

WMCommand

WMDestroy

WMHScroll

WMInitDialog

WMLButtonDown

WMNCDestroy

WMMove

WMPaint

WMQueryEndSession

WMVScroll

WMSize

Write

WriteStr


Attr fields

TDialog.Attr

TWindow.Attr


Handle fields

TDosStream.Handle

TEmsStream.Handle


Status fields

TApplication.Status

TStream.Status

TWindowsObject.Status


TextLen fields

TStatic.TextLen

TComboBox.TextLen


ArrangeIcons methods

TMDIClient.ArrangeIcons

TMDIWindow.ArrangeIcons


CanClose methods

TApplication.CanClose

TWindowsObject.CanClose


CascadeChildren methods

TMDIClient.CascadeChildren

TMDIWindow.CascadeChildren


CloseWindow (all)

Copy is both an ObjectWindows method and a Windows API function.

Choose the one you want:

CloseWindow (API function)

TWindowsObject.CloseWindow (method)


Compare methods

TSortedCollection.Compare

TStrCollection.Compare


Copy (all)

Copy is both a Turbo Pascal function and an ObjectWindows method.

Choose the one you want:

Copy (function)

TEdit.Copy (method)


Create methods

TDialog.Create

TDlgWindow.Create

TWindow.Create

TWindowsObject.Create


DefWndProc methods

TDialog.DefWndProc

TMDIWindow.DefWndProc

TWindow.DefWndProc

TWindowsObject.DefWndProc


Delete (all)

Delete is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Delete (procedure)

TCollection.Delete


Done methods

TApplication.Done

TBufStream.Done

TCollection.Done

TDialog.Done

TDosStream.Done

TEmsStream.Done

TMDIWindow.Done

TObject.Done

TWindow.Done

TWindowsObject.Done


Error methods

TApplication.Error

TCollection.Error

TStr.Error


FirstThat methods

TCollection.FirstThat

TWindowsObject.FirstThat


Flush (all)

Flush is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Flush (procedure)

TBufStream.Flush method

TStream.Flush method


Flush methods

TBufStream.Flush

TStream.Flush


ForEach methods

TCollection.ForEach

TWindowsObject.ForEach


Free methods

TCollection.Free

TObject.Free


FreeItem methods

TCollection.FreeItem

TStrCollection.FreeItem


GetClassName (all)

GetClassName is both an ObjectWindows method (for several different objects) and a Windows API function.

Choose the one you want:

GetClassName (Windows API function)

TButton.GetClassName (method)

TComboBox.GetClassName (method)

TControl.GetClassName (method)

TEdit.GetClassName (method)

TGroupBox.GetClassName (method)

TListBox.GetClassName (method)

TMDIClient.GetClassName (method)

TMDIWindow.GetClassName (method)

TScrollBar.GetClassName (method)

TStatic.GetClassName (method)

TWindowsObject.GetClassName (method)


GetClient methods

TMDIWindow.GetClient

TWindowsObject.GetClient


GetID methods

TWIndows.GetID

TWIndowsObject.GetID


GetItem methods

TCollection.GetItem

TStrCollection.GetItem


GetPos methods

TBufStream.GetPos

TDosStream.GetPos

TEmsStream.GetPos

TStream.GetPos


GetSize methods

TBufStream.GetSize

TDosStream.GetSize

TEmsStream.GetSize

TStream.GetSize


GetWindowClass methods

TDlgWindow.GetWindowClass

TMDIDlgWindow.GetWindowClass

TWindow.GetWindowClass

TWindowsObject.GetWindowClass


IndexOf methods

TCollection.IndexOf

TSortedCollection.IndexOf


Init methods

TApplication.Init

TBufStream.Init

TButton.Init

TCheckBox.Init

TCollection.Init

TComboBox.Init

TControl.Init

TDialog.Init

TDlgWindow.Init

TDosStream.Init

TEdit.Init

TEmsStream.Init

TGroupBox.Init

TListBox.Init

TMDIClient.Init

TMDIWindow.Init

TOBject.Init

TRadioButton.Init

TScrollBar.Init

TScroller.Init

TStatic.Init

TWindow.Init

TWindowsObjectInit


InitResource methods

TButton.InitResource

TCheckBox.InitResource

TControlInit.InitResource

TComboBox.InitResource

TGroupBox.InitResource

TStatic.InitResource

TWindow.InitResource


Insert (all)

Insert is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Insert (procedure)

TCollection.Insert (method)

TEdit.Insert (method)

TSortedCollection.Insert (method)


Insert methods

TCollection.Insert

TEdit.Insert

TSortedCollection.Insert


Load methods

TCheckBox.Load

TCollection.Load

TComboBox.Load

TDialog.Load

TGroupBox.Load

TMDIClient.Load

TMDIWindow.Load

TScrollBar.Load

TScroller.Load

TSortedCollection.Load

TStatic.Load

TWindow.Load

TWindowsObject.Load


Name (all)

Name is both a Turbo Pascal standard directive and an ObjectWindows method.

Choose the one you want:

Name (standard directive)

TApplication.Name


PutItem methods

TCollection.PutItem

TStrCollection.PutItem


Read (all)

Read is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Read (procedure)

TBufStream.Read (method)

TDosStream.Read (method)

TEmsStream.Read (method)

TStream.Read (method)


Read methods

TBufStream.Read

TDosStream.Read

TEmsStream.Read

TStream.Read


Register methods

TControl.Register

TWindowsObject.Register


Reset (all)

Reset is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Reset (procedure)

TStream.Reset (method)


Search methods

TEdit.Search

TSortedCollection.Search


Seek (all)

Seek is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Seek (procedure)

TBufStream.Seek (method)

TDosStream.Seek (method)

TEmsStream.Seek (method)

TStream.Seek (method)


Seek methods

TBufStream.Seek

TDosStream.Seek

TEmsStream.Seek

TStream.Seek


SetRange methods

TScrollBar.SetRange

TScroller.SetRange


SetupWindow methods

TEdit.SetupWindow

TMDIWindow.SetupWindow

TScrollBar.SetupWindow

TWindow.SetupWindow

TWindowsObject.SetupWindow


ScrollTo (all)

ScrollTo is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

ScrollTo (procedure)

TScroller.ScrollTo (method)


Store methods

TCheckBox.Store

TCollection.Store

TComboBox.Store

TDialog.Store

TGroupBox.Store

TMDIClient.Store

TMDIWindow.Store

TScrollBar.Store

TScroller.Store

TSortedCollection.Store

TWindowsObject.Store

TStatic.Store

TWindow.Store


TileChildren methods

TMDIClient.TileChildren

TMDIWindow.TileChildren


Transfer methods

TCheckBox.Transfer

TComboBox.Transfer

TEdit.Transfer

TListBox.Transfer

TScrollBar.Transfer

TStatic.Transfer

TWindowsObject.Transfer


Truncate (all)

Truncate is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Truncate (procedure)

TBufStream.Truncate (method)

TDosStream.Truncate (method)

TEmsStream.Truncate (method)

TStream.Truncate (method)


Truncate methods

TBufStream.Truncate

TDosStream.Truncate

TEmsStream.Truncate

TStream.Truncate


WMActivate methods

TWindow.WMActivate

TWindowsObject.WMActivate


WMClose methods

TDialog.WMClose

TWindowsObject.WMClose


WMHScroll methods

TWindow.WMHScroll

TWindowsObject.WMHScroll


WMPaint methods

TControl.WMPaint

TWindow.WMPaint


WMVScroll methods

TWindow.WMVScroll

TWindowsObject.WMVScroll


Write (all)

Write is both a Turbo Pascal procedure and an ObjectWindows method.

Choose the one you want:

Write (procedure)

TBufStream.Write (method)

TDosStream.Write (method)

TEmsStream.Write (method)

TStream.Write (method)


Write methods

TBufStream.Write

TDosStream.Write

TEmsStream.Write

TStream.Write


Turbo Pascal functions
Index of Turbo Pascal functions

Abs	Returns the absolute value of the argument.

Addr	Returns the address of a specified object.

ArcTan	Returns the arctangent of the argument.

Chr	Returns a character with a specified ordinal number.

Concat	Concatenates a sequence of strings.

Copy	Returns a substring of a string.

Cos	Returns the cosine of the argument (x is an angle, in radians).

CSeg	Returns the current value of the CS register.

DSeg	Returns the current value of the DS register.

Eof	Returns the end-of-file status.

Eoln	Returns the end-of-line status of a text file.

Exp	Returns the exponential of the argument.

FilePos	Returns the current file position of a file.

FileSize	Returns the current size of a file.

Frac	Returns the fractional part of the argument.

Hi	Returns the high-order byte of the argument.

Int	Returns the Integer part of the argument.

IOResult	Returns the status of the last I/O operation performed.

Length	Returns the dynamic length of a string.

Ln	Returns the natural logarithm of the argument.

Lo	Returns the low-order Byte of the argument.

MaxAvail	Returns the size of the largest contiguous free block in the heap.

MemAvail	Returns the amount of all free memory in the heap.

Odd	Tests if the argument is an odd number.

Ofs	Returns the offset of a specified object.

Ord	Returns the ordinal number of an ordinal-type value.

ParamCount	Returns the number of parameters passed to the program on the command line.

ParamStr	Returns a specified command-line parameter.

Pi	Returns the value of Pi.

Pos	Searches for a substring in a string.

Pred	Returns the predecessor of the argument.

Ptr	Converts a segment base and an offset address to a pointer-type value.

Random	Returns a random number.

Round	Rounds a real-type value to an Integer-type value.

SeekEof	Returns the end-of-file status of a file.

SeekEoln	Returns the end-of-line status of a file.

Seg	Returns the segment of a specified object.

Sin	Returns the sine of the argument.

SizeOf	Returns the number of bytes occupied by the argument.

SPtr	Retruns the current value of the SP register.

Sqr	Returns the square of the argument.

Sqrt	Returns the square root of the argument.

SSeg	Returns the current value of the SS register.

Succ	Returns the successor of the argument.

Swap	Swaps the high- and low-order bytes of the argument.

Trunc	Truncates a real-type value to an Integer-type value.

UpCase	Converts a character to uppercase.


Turbo Pascal procedures
Index of Turbo Pascal procedures

Append	Opens an existing file for appending.

Assign	Assigns the name of an external file to a file variable.

BlockRead	Reads one or more records into a variable.

BlockWrite	Writes one or more records from a variable.

ChDir	Changes the current directory.

Close	Closes an open file.

Dec	Decrements a variable.

Delete	Deletes a substring from a string.

Dispose	Disposes a dynamic variable.

Erase	Erases an external file.

Exit	Exits immediately from the current block.

FillChar	Fills a specified number (count) of contiguous bytes with a specified value (can be type Byte or Char).

Flush	Flushes the buffer of a text file open for output.

FreeMem	Disposes a dynamic variable of a given size.

GetDir	Returns the current directory of specified drive.

GetMem	Creates a dynamic variableof the specified size and puts the address of the block in a pointer variable.

Halt	Stops program execution and returns to the operating system.

Inc	Increments a variable.

Insert	Inserts a substring into a string.

MkDir	Creates a subdirectory.

Move	Copies bytes from source to dest.

New	Creates a new dynamic variable and sets a pointer variable to point to it.

Randomize	Initializes the built-in random number generator with a random value (obtained from the system clock).

Read	For typed files, reads a file component into a variable. For text files, reads one or more values into one or more variables

Readln	Executes the Read procedure, then skips to the next line of the file.

Rename	Renames an external file.

Reset	Opens an existing file.

Rewrite	Creates and opens a new file.

RmDir	Removes an empty subdirectory.

RunError	Stops program execution.

ScrollTo	Scrolls the CRT window to show a screen location.

Seek	Moves the current position of a file to a specified component.

SetTextBuf	Assigns an I/O buffer to a text file.

Str	Converts a numeric value to a string.

Truncate	Truncates the file at the current file position.

Val	Converts a string value to its numeric representation.

Write	For typed files, writes a variable into a file component. For text files, writes one or more values to the file.

Writeln	Executes the Write procedure, then outputs an end-of-line marker to the file.


Abs (function)

Returns the absolute value of the argument.

Declaration

function Abs(X): (Same type as parameter);

Sample Code

Abs.PAS


Abstract (procedure)
Abstract (procedure)     (WObjects unit)

Declaration

procedure Abstract;

Remarks

A call to this procedure terminates the program with a run-time error 211.

When implementing an abstract object type, use calls to Abstract in those virtual methods that must be overridden in descendant types.

This ensures that any attempt to use instances of the abstract object type will fail.


Addr (function)

Returns the address of a specified object.

Declaration

function Addr(X): pointer;

See Also

Ofs

Ptr

Seg

Sample Code

Addr.PAS


AllocMultiSel (function)
AllocMultiSel (function)     (WObjects unit)

Declaration

function AllocMultiSel(Count: Integer): PMultiSelRec;

Remarks

Allocates a TMultiSelRec with the count equal to Count, and enough room in the Selections field to hold Count selections (0..Count-1).

Returns nil if there is not enough memory to allocate the entire record.

See Also

FreeMultiSel (procedure)


Append (procedure)

Opens an existing file for appending.

Declaration

procedure Append(var F: Text);

where:

F is a text-file variable.

See Also

Assign

Close

Reset

Rewrite

Sample Code

Append.PAS


ArcTan (function)

Returns the arctangent of the argument.

Declaration

function ArcTan(X: Real): Real;

Remarks

Turbo Pascal does not have a Tan function, but tangents can be calculated with the expression:

Sin(x) / Cos(x)

Sample Code

Arctan.PAS


Assign (procedure)

Assigns the name of an external file to a file variable.

Declaration

procedure Assign(var F; Name);

Restrictions

Cannot be used on an open file.

See Also

Append

Close

Reset

Rewrite

Sample Code

Assign.PAS


AssignCrt (procedure)
AssignCrt (procedure)     (WinCrt unit)

Associates a text file with the CRT window.

Declaration

procedure procedure AssignCrt(var F: Text);

Sample Code

AssignCr.PAS


BlockRead (procedure)

Reads one or more records into a variable.

Declaration

procedure BlockRead(var F: File; var Buf; Count: Word [; var Result: Word]);

where:

F	untyped file variable

Buf	any variable

Count	an expression of type Word

Result	a variable of type Word

Restrictions

File must be open.

See Also

BlockWrite

Sample Code

Blockrd.PAS


BlockWrite (procedure)

Writes one or more records from a variable.

Declaration

procedure BlockWrite(var f: File; var Buf; Count: Word [; var Result: Word]);

where:

F	untyped file variable

Buf	any variable

Count	an expression of type Word

Result	a variable of type Word

Restrictions

File must be open.

See Also

BlockRead

Sample Code

Blockrd.PAS


ChDir (procedure)

Changes the current directory.

Declaration

procedure ChDir(S: String);

Remarks

With $I-, IOResult returns 0 if the operation was successful; otherwise, it returns a non-zero error code.

See Also

GetDir

MkDir

RmDir

Sample Code

Chdir.PAS


Chr (function)

Returns a character with a specified ordinal number.

Declaration

function Chr(X: Byte): Char;

See Also

Ord

Sample Code

Chr.Pas


Close (procedure)

Closes an open file.

Declaration

procedure Close(var F);

See Also

Append

Assign

Reset

Rewrite

Sample Code

Close.PAS


ClrEol (procedure)
ClrEol (procedure)     (WinCrt unit)

Clears all characters from the cursor position to the end of the line without moving the cursor.

Declaration

procedure ClrEol;

Sample Code

ClrEol.PAS


ClrScr (procedure)
ClrScr (procedure)     (WinCrt unit)

Clears the screen and returns the cursor to the upper left corner.

Declaration

procedure ClrScr;

Sample Code

ClrScr.PAS


Concat (function)

Concatenates a sequence of strings.

Declaration

function Concat(s1 [, s2,..., sn]: String): String;

See Also

Copy

Delete

Insert

Length

Pos

Sample Code

Concat.PAS


Copy (function)

Returns a substring of a string.

Declaration

function Copy(S: String; Index: Integer; Count: Integer): String;

See Also

Concat

Delete

Insert

Length

Pos

Sample Code

Copy.PAS


Cos (function)

Returns the cosine of the argument (X is an angle, in radians).

Declaration

function Cos(X: Real): Real;

See Also

ArcTan

Sin

Sample Code

Cos.PAS


CreateDir (procedure)
CreateDir (procedure)     (WinDos unit)

Creates a new subdirectory.

Declaration

procedure CreateDir(Dir: PChar)

Remarks

Performs the same functions as MkDir, but uses a Pascal-style string rather than a null-terminated string.

See Also

GetCurDir

SetCurDir

RemoveDir

Sample Code

CreateDr.PAS


CSeg (function)

Returns the current value of the CS register.

Declaration

function CSeg: Word;

See Also

DSeg

Sseg

Sample Code

CSeg.Pas


CursorTo (procedure)
CursorTo (procedure)     (WinCrt unit)

Moves the cursor to the given coordinates within the virtual screen.

Declaration

procedure CursorTo(X, Y: Integer);

Remarks

The coordinates of the upper left corner of the CRT window are (0, 0). CursorTo sets the Cursor variable to (X, Y).

Sample Code

CursorTo.PAS


Dec (procedure)

Decrements a variable.

Declaration

procedure Dec(var X[ ; N: Longint]);

See Also

Inc

Pred

Succ

Sample Code

Dec.PAS


Delete (procedure)

Deletes a substring from a string.

Declaration

procedure Delete(var S: String; Index: Integer; Count:Integer);

See Also

Concat

Copy

Insert

Length

Pos

Sample Code

Delete.PAS


DiskFree (function)
DiskFree (function)     (WinDos unit)

Declaration

function DiskFree(Drive: Byte): Longint;

where

0	Default drive

1	Drive A

2	Drive B

3	Drive C

etc.

Return Value

-1 if the drive number is invalid.

See Also

DiskSize

GetDir

Sample Code

Diskfree.PAS


DiskSize (function)
DiskSize (function)     (WinDos unit)

Returns the total size, in bytes, of specified disk drive.

Declaration

function DiskSize(Drive: Byte): Longint;

where :

0	Default drive

1	Drive A

2	Drive B

3	Drive C

etc.

Return Value

-1 if the drive number is invalid.

See Also

DiskFree

GetDir

Sample Code

Disksize.PAS


Dispose (procedure)

Disposes a dynamic variable.

Declaration

procedure Dispose(var P: Pointer [ , Destructor ]);

Remarks

The Declaration of Dispose has been extended so it can also dispose of an object allocated on the heap, if you pass it that object's destructor as a second parameter, like this:

Dispose(P, Done);

See Also

FreeMem

GetMem

New

Sample Code

Dispose.PAS


DoneWinCrt (procedure)
DoneWinCrt (procedure)     (WinCrt unit)

Destroys the CRT window if it hasn't already been destroyed.

Declaration

procedure DoneWinCrt;

Remarks

Call DoneWinCrt just before the program ends to prevent the CRT window from entering the inactive state.

Sample Code

DoneWCrt.PAS


DosVersion (function)
DosVersion (function)     (WinDos unit)

Returns the DOS version number.

Declaration

function DosVersion: Word;

Remarks

The result's low byte is the major version number, and the high byte is the minor version number.

Sample Code

DOSVrsn.PAS


DSeg (function)

Returns the current value of the DS register.

Declaration

function DSeg: Word;

See Also

CSeg

Sseg

Sample Code

CSeg.PAS


Eof (function)

Returns the end-of-file status.

Declaration

Typed or untyped files: function Eof(var F): Boolean;

Text files: function Eof [ (var F: Text) ]: Boolean;

See Also

Eoln

SeekEof

Sample Code

Eof.PAS


Eoln (function)

Returns the end-of-line status of a text file.

Declaration

function Eoln [(var F: Text) ]: Boolean;

See Also

Eof

SeekEoln

Sample Code

Eoln.PAS


Erase (procedure)

Erases an external file.

Declaration

procedure Erase(var F);

See Also

Rename

Sample Code

Erase.PAS


Exit (procedure)

Exits immediately from the current block.

Declaration

procedure Exit;

Remarks

If the current block is the main program, Exit causes the program to terminate.

See Also

Halt

Sample Code

Exit.PAS


Exp (function)

Returns the exponential of the argument.

Declaration

function Exp(X: Real): Real;

Return Value

The value e raised to the power of X, where e is the base of the natural logarithms.

See Also

Ln

Sample Code

Exp.PAS


FileExpand (function)
FileExpand (function)     (WinDos unit)

Expands a file name into a fully qualified file name.

Declaration

function FileExpand(Dest, Name: PChar): PChar;

See Also

File-attribute constants

FindFirst

FindNext

FileSplit

TSearchRec

Sample Code

FileExp.PAS


FilePos (function)

Returns the current file position of a file.

Declaration

function FilePos(var F): Longint;

See Also

FileSize

Seek

Sample Code

FilePos.PAS


FileSearch (function)
FileSearch (function)     (WinDos unit)

Searches for a file.

Declaration

function FileSearch(Dest, Name, List: PChar): PChar;

Remarks

Searches in a list of directories (DirList). The directories in DirList must be separated by semicolons.

See Also

FileExpand

FileSplit

Sample Code

FileSch.PAS


FileSize (function)

Returns the current size of a file.

Declaration

function FileSize(var F): Longint;

See Also

FilePos

Sample Code

FilePos.PAS


FileSplit (function)
FileSplit (function)     (WinDos unit)

Splits a file name into its three components.

Declaration

function FileSplit(Path, Dir, Name, Ext: PChar): Word

See Also

FileExpand

FindFirst

FindNext

Sample Code

FileSplt.PAS


FillChar (procedure)

Fills a specified number (Count) of contiguous bytes with a specified value (can be type Byte or Char).

Declaration

procedure FillChar(var X; Count: Word; value);

Remarks

This function does not perform any range-checking.

See Also

Move

Sample Code

Fillchar.PAS


FindFirst (procedure)
FindFirst (procedure)     (WinDos unit)

Searches the specified directory for the matching file.

Declaration

procedure FindFirst(Path: PChar; Attr: Word; var F: TSearchRec);

Remarks

Searches the specified (or current) directory for the first entry matching the specified file name and set of attributes.

See Also

File-attribute constants

FileExpand

FindNext

TSearchRec

Sample Code

Findfrst.PAS


FindNext (procedure)
FindNext (procedure)     (WinDos unit)

Finds the next entry that matches the name and attributes specified in an earlier call to FindFirst.

Declaration

procedure FindNext(var F: TSearchRec);

Remarks

Errors are reported in DosError. The only possible error code is 18 (no more files).

See Also

File-attribute constants

FileExpand

FindFirst

TSearchRec

Sample Code

Findfrst.PAS


Flush (procedure)

Flushes the buffer of a text file open for output.

Declaration

procedure Flush(var F: Text);

Sample Code

Flush.PAS


Frac (function)

Returns the fractional part of the argument.

Declaration

function Frac(X: Real): Real;

See Also

Int

Sample Code

Frac.PAS


FreeMem (procedure)

Disposes a dynamic variable of a given size.

Declaration

procedure FreeMem(var P: Pointer; Size: Word);

See Also

Dispose

GetMem

New

Sample Code

FreeMem.PAS


FreeMultiSel (procedure)
FreeMultiSel (procedure)     (WObjects unit)

Declaration

procedure FreeMultiSel(P: PMultiSelRec);

Remarks

Frees a TMultiSelRec record allocated by AllocMultiSel.


GetArgCount (function)
GetArgCount (function)     (WinDos unit)

Returns the number of parameters passed to the program on the command line.

Declaration

function GetArgCount: Integer

Sample Code

GetArgCo.PAS


GetArgStr (function)
GetArgStr (function)     (WinDos unit)

Returns the command-line parameter specified by Index.

Declaration

function GetArgStr(Dest: PChar; Index: Integer; MaxLen: Word): PChar;

Return Value

Parameter	Return Value

Index < 0 or > GetArGCount	empty string

Index = 0	filename of current module; Dest = returned value

See Also

GetArgCount

Sample Code

GetArgSt.PAS


GetCBreak (procedure)
GetCBreak (procedure)     (WinDos unit)

Returns the state of Ctrl-Break checking in DOS.

Declaration

procedure GetCBreak(var Break: Boolean);

See Also

SetCBreak

Sample Code

GetCBrk.PAS


GetCurDir (function)
GetCurDir (function)     (WinDos unit)

Returns the current directory of a specified drive.

Declaration

function GetCurDir(Dir: PChar; Drive: Byte): PChar

where Drive=

0	Default drive

1	Drive A

2	Drive B

3	Drive C

etc.

See Also

SetCurDir

CreateDir

RemoveDir

Sample Code

GetCurDr.PAS


GetDate (procedure)
GetDate (procedure)     (WinDos unit)

Returns the current date set in the operating system.

Declaration

procedure GetDate(var Year, Month, Day, DayOfWeek: Word);

See Also

GetTime

SetDate

SetTime

Sample Code

GetDate.PAS


GetDir (procedure)

Returns the current directory of specified drive.

Declaration

procedure GetDir(D: Byte; var S: String);

where D is set to:

0	Default

1	Drive A

2	Drive B

3	Drive C

See Also

ChDir

DiskFree

DiskSize

MkDir

RmDir

Sample Code

GetDir.PAS


GetEnvVar (function)
GetEnvVar (function)     (WinDos unit)

Returns a pointer to the value of a specified environment variable.

Declaration

function GetEnvVar(VarName: PChar): PChar;

Return Value

0	If specified environment variable does not exist

Sample Code

GetEnvVa.PAS


GetFAttr (procedure)
GetFAttr (procedure)     (WinDos unit)

Returns the attributes of a file.

Declaration

procedure GetFAttr(var F; var Attr: Word);

Remarks

F must be a file variable (typed, untyped, or text file) that has been assigned but not opened.

See Also

GetFTime

SetFAttr

SetFTime

Sample Code

Getfattr.PAS


GetFTime (procedure)
GetFTime (procedure)     (WinDos unit)

Returns the date and time a file was last written.

Declaration

procedure GetFTime(var F; var Time: Longint);

Remarks

F must be a file variable (typed, untyped, or text file) that has been assigned and opened.

The time returned in Time can be unpacked through a call to UnpackTime.

See Also

PackTime

SetFAttr

SetFTime

UnpackTime

Sample Code

GetFTime.PAS


GetIntVec (procedure)
GetIntVec (procedure)     (WinDos unit)

Returns the address stored in a specified interrupt vector.

Declaration

procedure GetIntVec(IntNo: Byte; var Vector: Pointer);

See Also

SetIntVec

Sample Code

GetIntVc.PAS


GetMem (procedure)

Creates a dynamic variableof the specified size and puts the address of the block in a pointer variable.

Declaration

procedure GetMem(var P: Pointer; Size: Word);

See Also

Dispose

FreeMem

New

Sample Code

FreeMem.PAS


GetTime (procedure)
GetTime (procedure)     (WinDos unit)

Returns the current time set in the operating system.

Declaration

procedure GetTime(var Hour, Minute, Second, Sec100: Word);

See Also

GetDate

SetDate

SetTime

UnPackTime

Sample Code

GetTime.PAS


GetVerify (procedure)
GetVerify (procedure)     (WinDos unit)

Returns the state of the verify flag in DOS.

Declaration

procedure GetVerify(var Verify: Boolean);

See Also

SetVerify

Sample Code

GetVerify.PAS


GotoXY (procedure)
GotoXY (procedure)     (WinCrt unit)

Moves the cursor to the given coordinates within the virtual screen.

Declaration

procedure GotoXY(X, Y: Integer);

Remarks

The upper left corner of the virtual screen corresponds to (1, 1).

Use CursorTo instead of GotoXY when developing new applications. GotoXY is provided for compatibility with the Crt unit of Turbo Pascal for DOS.

Sample Code

GotoXY.PAS


Halt (procedure)

Stops program execution and returns to the operating system.

Declaration

procedure Halt [ ( Exitcode: Word ) ];

where:

Exitcode is an optional expression that specifies the exit code of your program.

See Also

Exit

RunError

Sample Code

Halt.PAS


Hi (function)

Returns the high-order byte of the argument.

Declaration

function Hi(X): Byte;

See Also

Lo

Swap

Sample Code

Hi.PAS


Inc (procedure)

Increments a variable.

Declaration

procedure Inc(var X [ ; N: Longint ] );

See Also

Dec

Pred

Succ

Sample Code

Inc.PAS


Insert (procedure)

Inserts a substring into a string.

Declaration

procedure Insert(Source: String; var S: String; Index: Integer);

See Also

Concat

Copy

Delete

Length

Pos

Sample Code

Insert.PAS


Int (function)

Returns the Integer part of the argument.

Declaration

function Int(X: Real): Real;

See Also

Frac

Round

Trunc

Sample Code

Int.PAS


InitWinCrt (procedure)
InitWinCrt (procedure)     (WinCrt unit)

Creates the CRT window if it hasn't already been created.

Declaration

procedure InitWinCrt;

Remarks

InitWinCrt is automatically called if you have used Read, Readln, Write, or Writeln in a file that has been assigned to the CRT.

InitWinCrt uses the WindowOrg, WindowSize, and ScreenSize constants, and the WindowTitle variable to determine the characteristics of the CRT window.

Sample Code

InitWCrt.PAS


Intr (procedure)
Intr (procedure)     (WinDos unit)

Executes a specified software interrupt.

Declaration

procedure Intr(IntNo: Byte; var Regs: TRegisters);

where

-	IntNo is the software interrupt number (0...255).

-	TRegisters is a record defined in DOS.

Restrictions

Do not use software interrupts that:

-	depend on specific values in SP or SS on entry.

-	modify SP or SS on exit.

See Also

MsDos

Sample Code

Intr.PAS


IOResult (function)

Returns the status of the last I/O operation performed.

Declaration

function IOResult: Word;

Return Value

0 if successful.

Remarks

A call to IOResult clears its internal error flag.

Sample Code

IOResult.PAS


KeyPressed (function)
KeyPressed (function)     (WinCrt unit)

Determines if a key has been pressed on the keyboard.

Declaration

function KeyPressed: Boolean;

Remarks

The key can be read using the ReadKey function.

Return Value

True	If key has been pressed

False	If key has not been pressed

Sample Code

KeyPress.PAS


Length (function)

Returns the dynamic length of a string.

Declaration

function Length(S: String): Integer;

See Also

Copy

Concat

Delete

Insert

Pos

Sample Code

Length.PAS


Ln (function)

Returns the natural logarithm of the argument.

Declaration

function Ln(X: Real): Real;

See Also

Exp

Sample Code

Ln.PAS


Lo (function)

Returns the low-order Byte of the argument.

Declaration

function Lo(X): Byte;

See Also

Hi

Swap

Sample Code

Lo.PAS


LongDiv (function)
LongDiv (function)     (WObjects unit)

Declaration

function LongDiv(X: Longint; Y: Integer): Integer; inline($59/$58/$5A/$F7/$F9);

Remarks

A fast, inline assembly-coded division routine, returning the integer value X/Y.


LongMul (function)
LongMul (function)     (WObjects unit)

Declaration

function longmul(X, Y: Integer): Longint;

inline($5A/$58/$f7/$EA);

Remarks

A fast, inline assembly-coded multiplication routine, returning the long integer value X * Y.


LowMemory (function)
LowMemory (function)     (WObjects unit)

Declaration

function LowMemory: Boolean;

Remarks

The LowMemory function returns True if a memory allocation has eaten into the safety pool at the end of the heap.

The size of the safety pool is determined by the SafetyPoolSize variable.

LowMemory is checked automatically by TApplication.MakeWindow and TApplication.ExecDialog, which should be used for creating window elements.

Major consumers of memory (such as large, complex dialog boxes) should check LowMemory for themselves periodically to ensure that they don't exceed the available space.

See Also

MemAlloc

TApplication.ValidWindow


MaxAvail (function)

Returns the size of the largest contiguous free block in the heap.

Declaration

function MaxAvail: Longint;

Remarks

Returns the larger of:

-	the largest free blocks within the heap manager's sub-allocation space

-	the Windows global heap

The value corresponds to the size of the largest dynamic variable that can be allocated at that time.

See Also

MemAvail

Sample Code

FreeMem.PAS


MemAlloc (function)
MemAlloc (function)     (WObjects unit)

Declaration

function MemAlloc(Size: Word): Pointer;

Remarks

Allocates Size bytes of memory on the heap and returns a pointer to the   block. If a block of the requested size cannot be allocated, a value of nil is returned.

MemAlloc will not allow the allocation to dip into the safety pool. A block allocated by MemAlloc can be disposed using the FreeMem standard procedure.


MemAvail (function)

Returns the amount of all free memory in the heap.

Declaration

function MemAvail: Longint;

See Also

MaxAvail

Sample Code

Memavail.PAS


MkDir (procedure)

Creates a subdirectory.

Declaration

procedure MkDir(S: String);

See Also

ChDir

GetDir

RmDir

Sample Code

Mkdir.PAS


Move (procedure)

Copies bytes from source to dest.

Declaration

procedure Move(var Source, Dest; Count: Word);

Remarks

Copies a specified number of contiguous bytes (Count) from a source range to a destination  range. No range-checking is performed.

Whenever possible, use SizeOf to determine the count.

See Also

FillChar

Sample Code

Move.PAS


MsDos (procedure)
MsDos (procedure)     (WinDos unit)

Executes a DOS function call.

Declaration

procedure MsDos(var Regs: TRegisters);

Restrictions

Do not use software interrupts that:

-	depend on specific values in SP or SS on entry.

-	modify SP or SS on exit.

See Also

Intr

Sample Code

MsDos.PAS


New (procedure)

Creates a new dynamic variable and sets a pointer variable to point to it.

Declaration

procedure New(var P: Pointer [ , Init: Constructor ]);

Remarks

The Declaration of New has been extended so it can also initialize an object allocated on the heap, if you pass it that object's constructor as a second parameter, like this:

New(P, Init(360, 174));

New has also been extended to allow it to act as a function returning a pointer value.

The parameter passed to New is the type of the pointer to the object, rather than the pointer variable itself.

This function form of New applies to all data types, not just object types.

Like its procedure form, the function form of New can take the object type's constructor as a second parameter.

See Also

Dispose

FreeMem

GetMem

Sample Code

Dispose.PAS


Odd (function)

Tests if the argument is an odd number.

Declaration

function Odd(X: Longint): Boolean;

Sample Code

Odd.PAS


Ofs (function)

Returns the offset of a specified object.

Declaration

function Ofs(X): Word;

See Also

Addr

Seg

Sample Code

CSeg.PAS


Ord (function)

Returns the ordinal number of an ordinal-type value.

Declaration

function Ord(X): Longint;

See Also

Chr

Sample Code

Ord.PAS


PackTime (procedure)
PackTime (procedure)     (WinDos unit)

Converts a TDateTime record.

Declaration

procedure PackTime(var T: DateTime; var Time: Longint);

Remarks

Converts the record into a 4-byte, packed date-and-time Longint used by SetFTime.

See Also

GetFTime

GetTime

SetFTime

SetTime

UnpackTime

Sample Code

GetFTime.PAS


ParamCount (function)

Returns the number of parameters passed to the program on the command line.

Declaration

function ParamCount: Word;

See Also

ParamStr

Sample Code

Parcount.PAS


ParamStr (function)

Returns a specified command-line parameter.

Declaration

function ParamStr(Index): String;

See Also

ParamCount

Sample Code

Parstrng.PAS


Pi (function)

Returns the value of Pi, which is defined as 3.1415926535897932385.

Declaration

function Pi: Real;

Sample Code

Pi.PAS


Pos (function)

Searches for a substring in a string.

Declaration

function Pos(Substr: String; S: String): Byte;

See Also

Delete

Concat

Copy

Insert

Length

Sample Code

Pos.PAS


Pred (function)

Returns the predecessor of the argument.

Declaration

function Pred(X): < Same type as parameter >;

See Also

Dec

Inc

Succ

Sample Code

Pred.PAS


Ptr (function)

Converts a segment base and an offset address to a pointer-type value.

Declaration

function Ptr(Seg, Ofs: Word): Pointer;

Return Value

A pointer that points to the address given by Seg and Ofs.

See Also

Addr

Sample Code

Ptr.PAS


Random (function)

Returns a random number.

Declaration

function Random [ ( Range: Word) ]: < Same type as parameter >;

Remarks

To initialize the Random number generator, call Randomize, or assign a value to RandSeed.

Return Value

A Word random number within the range 0 <= X < Range.

See Also

Randomize

Sample Code

Random.PAS


Randomize (procedure)

Initializes the built-in random number generator with a random value (obtained from the system clock).

Declaration

procedure Randomize;

See Also

Random

Sample Code

Random.PAS


Read (procedure)

-	For typed files, reads a file component into a variable.

-	For text files, reads one or more values into one or more variables

Declaration

Typed files: procedure Read(F , V1 [, V2,...,Vn ] );

Text files: procedure Read( [ var F: Text; ] V1 [, V2,...,Vn ] );

Remarks

With a type string variable, Read reads all characters up to, but not including, the next end-of-line marker or until Eof(F) becomes True; it does not skip to the next line after reading.

After the first Read, each subsequent Read will see the end-of-line marker and return a zero-length string.

Use multiple Readln calls to read successive string values.

When the extended Declaration is enabled, Read can read null-terminated strings into zero-based character arrays.

See Also

Readln

Write

Writeln

Sample Code

Eof.PAS


ReadBuf (function)
ReadBuf (function)     (WinCrt unit)

Inputs a line from the CRT window.

Declaration

function ReadBuf(Buffer: PChar; Count: Word): Word;

Remarks

This function is passed two parameters: Buffer and Count.

Buffer points to a line buffer that has room for up to Count characters. Count contains the number of characters to read.

Up to Count - 2 characters can be input. An end-of-line marker (a #13 followed by a #10) is automatically appended to the line when the user presses Enter.

Return Value

Number of characters read, including the end-of-line or end-of-file marker.

Sample Code

ReadBuf.PAS


Readln (procedure)

Executes the Read procedure, then skips to the next line of the file.

Declaration

procedure Readln([ var F: Text; ] V1 [, V2, ...,Vn ]);

Remarks

After executing Read, Readln skips to the beginning of the next line of the file.

See Also

Read

Sample Code

Readln.PAS


ReadKey (function)
ReadKey (function)     (WinCrt unit)

Reads a character from the keyboard.

Declaration

function ReadKey: Char;

Remarks

The character is not echoed to the screen.

Sample Code

ReadKey.PAS


RegisterType (procedure)
RegisterType (procedure)     (WObjects unit)

Declaration

procedure RegisterType(var S: TStreamRec);

Remarks

An ObjectWindows object type must be registered using this method before it can be used in stream I/O.

The standard object types are preregistered with ObjType values in the reserved range 0..99.

RegisterType creates an entry in a linked list of TStreamRec records.

See Also

TStream.Get

TStream.Put


RemoveDir (procedure)
RemoveDir (procedure)     (WinDos unit)

Removes an empty subdirectory.

Declaration

procedure Remove(Dir: PChar);

See Also

GetCurDir

CreateDir

RmDir

SetCurDir

Sample Code

RemoveDr.PAS


Rename (procedure)

Renames an external file.

Declaration

procedure Rename(var F; Newname);

See Also

Erase

Sample Code

Rename.PAS


Reset (procedure)

Opens an existing file.

Declaration

procedure Reset(var F [: File; Recsize: Word ] );

See Also

Append

Assign

Close

Rewrite

Truncate

Sample Code

Reset.PAS


Rewrite (procedure)

Creates and opens a new file.

Declaration

procedure Rewrite(var F: File [; Recsize: Word ] );

See Also

Append

Assign

Reset

Truncate

Sample Code

Rewrite.PAS


RmDir (procedure)

Removes an empty subdirectory.

Declaration

procedure RmDir(S: String);

See Also

ChDir

GetDir

MkDir

RemoveDir

Sample Code

Rmdir.PAS


Round (function)

Rounds a real-type value to an Integer-type value.

Declaration

function Round(X: Real): Longint;

See Also

Int

Trunc

Sample Code

Round.PAS


RunError (procedure)

Stops program execution.

Declaration

procedure RunError [ ( Errorcode: Byte ) ];

Remarks

Generates a run-time error with the given number at the current statement.

See Also

Exit

Halt

Run-time error messages

Sample Code

Runerror.PAS


ScrollTo (procedure)
ScrollTo (procedure)     (WinCrt unit)

Scrolls the CRT window to show the virtual screen location given by (X,Y) in the upper left corner.

Declaration

procedure ScrollTo(X, Y: Integer);

Remarks

The upper left corner of the virtual screen corresponds to (0,0).

Sample Code

ScrollTo.PAS


Seek (procedure)

Moves the current position of a file to a specified component.

Declaration

procedure Seek(var F; N: Longint);

See Also

FilePos

Sample Code

FilePos.PAS


SeekEof (function)

Returns the end-of-file status of a file.

Declaration

function SeekEof [ (var F: Text) ]: Boolean;

Remarks

Can only be used on text files. File must be open.

See Also

Eof

SeekEoln

Sample Code

SeekEof.PAS


SeekEoln (function)

Returns the end-of-line status of a file.

Declaration

function SeekEoln [ (var F: Text) ]: Boolean;

Remarks

Can only be used on text files. File must be open.

See Also

Eoln

SeekEof

Sample Code

SeekEof.PAS


Seg (function)

Returns the segment of a specified object.

Declaration

function Seg(X): Word;

See Also

Addr

Ofs

Sample Code

CSeg.PAS


SetCBreak (procedure)
SetCBreak (procedure)     (WinDos unit)

Sets the state of Ctrl-Break checking in DOS.

Declaration

procedure SetCBreak(Break: Boolean);

See Also

GetCBreak

Sample Code

GetCBrk.PAS


SetCurDir (procedure)
SetCurDir (procedure)     (WinDos unit)

Changes the current directory to the specified path.

Declaration

procedure SetCurDir(Dir: PChar)

Remarks

If Dir specifies a drive letter, tthe drive is also changed.

See Also

GetCurDir

ChDir

CreateDir

RemoveDir

Sample Code

SetCurDr.PAS


SetDate (procedure)
SetDate (procedure)     (WinDos unit)

Sets the current date in the operating system.

Declaration

procedure SetDate(Year, Month, Day: Word);

See Also

GetDate

GetTime

SetTime

Sample Code

SetDate.PAS


SetFAttr (procedure)
SetFAttr (procedure)     (WinDos unit)

Sets the attributes of a file.

Declaration

procedure SetFAttr(var F; Attr: Word);

Remarks

Errors are reported in DosError. Possible error codes are

- 	3 (Invalid Path)

- 	5 (File Access Denied)

Restrictions

The file cannot be open.

See Also

GetFAttr

GetFTime

SetFTime

Sample Code

Setfattr.PAS


SetFTime (procedure)
SetFTime (procedure)     (WinDos unit)

Sets the date and time a file was last written.

Declaration

procedure SetFTime(var F; Time: Longint);

Remarks

Errors are reported in DosError. The only error code is 6 (Invalid File Handle).

Restrictions

F must be open.

See Also

GetFTime

PackTime

SetFAttr

UnpackTime

Sample Code

GetFTime.PAS


SetIntVec (procedure)
SetIntVec (procedure)     (WinDos unit)

Sets a specified interrupt vector to a specified address.

Declaration

procedure SetIntVec(IntNo: Byte; Vector: Pointer);

See Also

GetIntVec

Sample Code

GetIntVc.PAS


SetTime (procedure)
SetTime (procedure)     (WinDos unit)

Sets the current time in the operating system.

Declaration

procedure SetTime(Hour, Minute, Second, Sec100: Word);

See Also

GetDate

GetTime

PackTime

SetDate

UnPackTime

Sample Code

SetTime.PAS


SetTextBuf (procedure)

Assigns an I/O buffer to a text file.

Declaration

procedure SetTextBuf(var F: Text; var Buf [ ; Size:   Word ] );

Remarks

SetTextBuf should never be applied to an open file, although it can be called immediately after Reset, Rewrite, and Append.

If you call SetTextBuf on an open file once I/O operations have taken place, loss of data can result because of the change of buffer.

Sample Code

Settxtbf.PAS


SetVerify (procedure)
SetVerify (procedure)     (WinDos unit)

Sets the state of the verify flag in DOS.

Declaration

procedure SetVerify(Verify: Boolean);

See Also

GetVerify

Sample Code

GetVerify.PAS


Sin (function)

Returns the sine of the argument.

Declaration

function Sin(X: Real): Real;

See Also

ArcTan

Cos

Sample Code

Sin.PAS


SizeOf (function)

Returns the number of bytes occupied by the argument.

Declaration

function SizeOf: Integer;

Remarks

When applied to an instance of an object type that has a virtual method table (VMT), SizeOf returns the size stored in the VMT.

See Also

constructor

virtual

Sample Code

Sizeof.PAS


SPtr (function)

Retruns the current value of the SP register.

Declaration

function SPtr: Word;

See Also

Sseg

Sample Code

CSeg.PAS


Sqr (function)

Returns the square of the argument.

Declaration

function Sqr(X): (Same type as parameter);

See Also

Sqrt

Sample Code

Sqr.PAS


Sqrt (function)

Returns the square root of the argument.

Declaration

function Sqrt(X: Real): Real;

See Also

Sqr

Sample Code

Sqr.PAS


SSeg (function)

Returns the current value of the SS register.

Declaration

function SSeg: Word;

See Also

CSeg

DSeg

SPtr

Sample Code

CSeg.PAS


Str (procedure)

Converts a numeric value to a string.

Declaration

procedure Str(X [: Width [: Decimals ]]; var S);

Remarks

Converts the numeric value X to the same string representation that would be output by Write.

See Also

Val

Write (text)

Write (typed)

Sample Code

Str.PAS


StrCat (function)
StrCat (function)     (Strings unit)

Appends a copy of one string to the end of another and returns the concatenated string.

Declaration

function StrCat(Dest, Source: PChar): PChar;

Remarks

StrCat does not perform any length checking.

The destination buffer must have room for at least StrLen(Dest)+StrLen(Source)+1 characters.

See Also

StrLCat

Sample Code

StrCat.PAS


StrComp (function)
StrComp (function)     (Strings unit)

Compares two strings.

Declaration

function StrComp(Str1, Str2 : PChar): Integer;

Return Value

<0	if Str1 < Str2

=0	if Str1 = Str2

>0	if Str1 > Str2

See Also

StrIComp

StrLComp

StrLIComp

Sample Code

StrComp.PAS


StrCopy (function)
StrCopy (function)     (Strings unit)

Copies one string to another.

Declaration

function StrCopy(Dest, Source: PChar): PChar;

Remarks

StrCopy does not perform any length checking.

The destination buffer must have room for at least StrLen(Source)+1 characters.

See Also

StrECopy

StrLCopy

Sample Code

StrCopy.PAS


StrDispose (function)
StrDispose (function)     (Strings unit)

Disposes a string on a heap.

Declaration

function StrDispose(Str: PChar);

Remarks

StrDispose disposes of a string that was previously allocated with StrNew.

If Str is nil, StrDispose does nothing.

Sample Code

StrNew.PAS


StrECopy (function)
StrECopy (function)     (Strings unit)

Copies one string to another and returns a pointer to the end of the resulting string.

Declaration

function StrECopy(Dest, Source: Pchar): PChar;

Remarks

StrECopy does not perform any length checking.

The destination buffer must have room for at least StrLen(Source)+1 characters.

See Also

StrCopy

StrEnd

Sample Code

StrECopy.PAS


StrEnd (function)
StrEnd (function)     (Strings unit)

Returns a pointer to the end of a string.

Declaration

function StrEnd(Str: PChar): Pchar;

See Also

StrLen

Sample Code

StrEnd.PAS


StrIComp (function)
StrIComp (function)     (Strings unit)

Compares two strings without case sensitivity.

Declaration

function StrIComp(Str1, Str2:PChar): Integer;

See Also

StrComp

StrLComp

StrLIComp

Sample Code

StrlComp.PAS


StrLCat (function)
StrLCat (function)     (Strings unit)

Appends characters from a string to the end of another and returns the concatenated string.

Declaration

function StrLCat(Dest, Source: PChar; MaxLen: Word): PChar;

See Also

StrCat

Sample Code

StrLCat.PAS


StrLComp (function)
StrLComp (function)     (Strings unit)

Compares two strings, up to a maximum length.

Declaration

function StrLComp(Str1, Str2: PChar; MaxLen: Word): Integer;

See Also

StrComp

StrIComp

StrLIComp

Sample Code

StrLComp.PAS


StrLCopy (function)
StrLCopy (function)     (Strings unit)

Copies characters from one string to another.

Declaration

function StrLCopy(Dest, Source: PChar; MaxLen: Word): PChar;

See Also

StrCopy

Sample Code

StrLCopy.PAS


StrLen (function)
StrLen (function)     (Strings unit)

Returns the number of characters in Str.

Declaration

function StrLen(Str: PChar): Word;

See Also

StrEnd

Sample Code

StrLen.PAS


StrLIComp (function)
StrLIComp (function)     (Strings unit)

Compares two strings, up to a maximum length, without case sensitivity.

Declaration

function StrLIComp(Str1, Str2: PChar; MaxLen: Word): Integer;

Remarks

StrLIComp compares Str1 to Str2 , up to a maximum length of MaxLen characters, without case sensitivity.

The return value is the same as StrComp.

See Also

StrComp

StrIComp

StrLComp

Sample Code

StrComp.PAS


StrLower (function)
StrLower (function)     (Strings unit)

Converts a string to lower case.

Declaration

function StrLower(Str: PChar): PChar;

See Also

StrUpper

Sample Code

StrUpper.PAS


StrMove (function)
StrMove (function)     (Strings unit)

Copies characters from one string to another.

Declaration

function StrMove(Dest, Source: PChar; Count: Word): PChar;

Sample Code

StrMove.PAS


StrNew (function - Strings unit)
StrNew (function)     (Strings unit)

Allocates a string on the heap.

Declaration

function StrNew(Str: PChar): PChar;;

Remarks

StrNew allocates a copy of Str on the heap.

If Str is nil or points to an empty string, StrNew returns nil and doesn't allocate any heap space.

Otherwise, StrNew makes a duplicate of Str, obtaining space with a call to the GetMem standard procedure, and returns a pointer to the duplicated string.

The allocated space is StrLen(Str) + 1 bytes long.

See Also

StrDispose


StrPas (function)
StrPas (function)     (Strings unit)

Converts a null-terminated string to a Pascal-style string.

Declaration

function StrPas(Str: PChar): PChar;

See Also

StrPCopy

Sample Code

StrPas.PAS


StrPCopy (function)
StrPCopy (function)     (Strings unit)

Copies a Pascal-style string to a null-terminated string.

Declaration

function StrPCopy(Dest: PChar; Source: String);

Remarks

StrPCopy does not perform any length checking.

The destination buffer must have room for at least Length(Source)+1 characters.

See Also

StrCopy

Sample Code

StrPCopy.PAS


StrPos (function)
StrPos (function)     (Strings unit)

Returns a pointer to the first occurrence of a string in another string.

Declaration

function StrPos(Str1, Str2: PChar): PChar;

Return Value

0	if Str2 does not occur in Str1

Sample Code

StrPos.PAS


StrScan (function)
StrScan (function)     (Strings unit)

Returns a pointer to the first occurrence of a character in a string.

Declaration

function StrScan(Str: PChar; Chr: Char): PChar;

Return Value

0	if Chr does not occur in Str

See Also

StrRScan

Sample Code

StrScan.PAS


StrRScan (function)
StrRScan (function)     (Strings unit)

Returns a pointer to the first occurrence of a string in another string.

Declaration

function StrRScan(Str: PChar; Chr: Char): PChar;

Return Value

0	if Chr does not occur in Str

See Also

StrScan

Sample Code

StrRScan.PAS


StrUpper (function)
StrUpper (function)     (Strings unit)

Converts a string to upper case.

Declaration

function StrUpper(Str: PChar): PChar;

See Also

StrLower

Sample Code

StrUpper.PAS


Succ (function)

Returns the successor of the argument.

Declaration

function Succ(X): (Same type as parameter);

See Also

Inc

Pred

Sample Code

Pred.PAS


Swap (function)

Swaps the high- and low-order bytes of the argument.

Declaration

function Swap(X): (Same type as parameter);

See Also

Hi

Lo

Sample Code

Swap.PAS


TrackCursor (procedure)
TrackCursor (procedure)     (WinCrt unit)

Scrolls the CRT window if necessary to ensure that the cursor is visible.

Declaration

procedure TrackCursor;

Sample Code

TrackCur.PAS


Trunc (function)

Truncates a real-type value to an Integer-type value.

Declaration

function Trunc(X: Real): Longint;

See Also

Int

Round

Sample Code

Trunc.PAS


Truncate (procedure)

Truncates the file at the current file position.

Declaration

procedure Truncate(var F);

See Also

Reset

Rewrite

Seek

Sample Code

Truncate.PAS


UnpackTime (procedure)
UnpackTime (procedure)     (WinDos unit)

Converts a Longint to a record.

Declaration

procedure UnpackTime(Time: Longint; var DT: TDateTime);

Remarks

Converts a 4-byte, packed date-and-time Longint returned by GetFTime, FindFirst, or FindNext into an unpacked DateTime record.

See Also

GetFTime

GetTime

PackTime

SetFTime

SetTime

Sample Code

GetFTime.PAS


UpCase (function)

Converts a character to uppercase.

Declaration

function UpCase(Ch: Char): Char;

Sample Code

UpCase.PAS


Val (procedure)

Converts a string value to its numeric representation.

Declaration

procedure Val(S; var V; var Code: Integer);

where:

S	string-type variable; must be a sequence of characters that form a signed whole number

V	integer-type or real-type variable

Code	variable of type Integer.

Remarks

Converts the string value (S) to its numeric representation, as if it were read from a text file with Read.

See Also

Str

Sample Code

Val.PAS


WhereX (function)
WhereX (function)     (WinCrt unit)

Returns the X coordinate of the current cursor location.

Declaration

function WhereX: Integer;

Return Value

1-based. It corresponds to Cursor.X + 1.

Sample Code

WhereX.PAS


WhereY (function)
WhereY (function)     (WinCrt unit)

Returns the Y coordinate of the current cursor location.

Declaration

function WhereY: Integer;

Remarks

1-based. It orresponds to Cursor.Y + 1.

Sample Code

WhereY.PAS


Write (procedure)

-	For typed files, writes a variable into a file component

-	For text files, writes one or more values to the file

Declaration

Typed files: procedure Write(F, V1 [, V2,...,Vn ] );

Text files: procedure Write( [ var F: Text; ] V1 [,V2,...,Vn ] );

See Also

Read

Readln

Writeln

Sample Code

Eof.PAS


WriteBuf (procedure)
WriteBuf (procedure)     (WinCrt unit)

Writes a block of characters to the CRT window.

Declaration

procedure WriteBuf(Buffer: PChar; Count: Word);

Remarks

Two parameters are passed to this procedure: Buffer and Count.

Buffer points to the first character in the block. Count contains the number of characters to write. I

If AutoTracking is turned on, the CRT window scrolls if necessary to ensure that the cursor is visible after writing the block of characters.

Sample Code

WriteBuf.PAS


WriteChar (procedure)
WriteChar (procedure)     (WinCrt unit)

Writes a single character to the CRT window.

Declaration

procedure WriteChar(Ch: Char);

Sample Code

WriteChr.PAS


Writeln (procedure)

Executes the Write procedure, then outputs an end-of-line marker to the file.

Declaration

procedure Writeln([ var F: Text; ] V1 [, V2, ...,Vn ] );

See Also

Write (text)

Write (typed)

Sample Code

Readln.PAS


AccessResource (API function)
AccessResource (Windows API function)

Declaration

function AccessResource(Instance, ResInfo: THandle): Integer;

Description

Opens and positions resource file to the beginning of a resource. The file should be closed after reading the resource.

Parameters

Instance	Instance module whose executable file contains the resource

ResInfo	Desired resource, created by calling the FindResource function

Return Value

DOS file handle, or

-1 if resource not found


AddAtom (API function)
AddAtom (Windows API function)

Declaration

function AddAtom(Str: PChar): Atom;

Description

Adds Str to the atom table. A reference count is maintained for each unique string instance.

Parameters

Str	Null-terminated character string

Return Value

Unique atom identifier if successful, or

-1 if not

See Also

GetAtomName


AddFontResource (API function)
AddFontResource (Windows API function)

Declaration

function AddFontResource(FileName: PChar): Integer;

Description

Adds font resource from FileName font-resource file to the system font table.

Parameters

FileName	Handle to loaded module or null-terminated string

Return Value

Number of fonts added, or

0 if no fonts added

See Also

wm_FontChange


AdjustWindowRect (API procedure)
AdjustWindowRect (Windows API procedure)

Declaration

procedure AdjustWindowRect(var Rect: TRect; Style: Longint; Menu: Bool);

Description

Computes the required size of a window rectangle based on Rect size. Assumes a single row menu, if one.

Parameters

Rect	TRect containing client rectangle coordinates to be converted

Style	Window styles of the window whose client rectangle is to be converted

Menu	Non-zero if window has a menu

See Also

CreateWindow


AdjustWindowRectEx (API procedure)
AdjustWindowRectEx (Windows API procedure)

Declaration

procedure AdjustWindowRectEx(var Rect: TRect; Style: Longint; Menu: Bool; ExStyle: Longint);

Description

Computes the required size of a window rectangle with extended style based on Rect size. Assumes a single row menu, if one.

Parameters

Rect	TRect structure containing client rectangle coordinates to be converted

Style	Window styles of the window whose client rectangle is to be converted

Menu	Non-zero if window has a menu

ExStyle	Extended style of the window being created

See Also

CreateWindowEx


AllocDStoCSAlias (API function)
AllocDStoCSAlias (Windows API function)

Declaration

function AllocDStoCSAlias(Selector: Word): Word;

Description

Maps Selector to a code-segment selector.

Parameters

Selector	Data-segment selector

Return Value

Corresponding code-segment selector if successful;

0 if not


AllocResource (API function)
AllocResource (Windows API function)

Declaration

function AllocResource(Instance, ResInfo: THandle; Size: Longint): THandle;

Description

Allocates uninitialized memory for ResInfo.

Parameters

Instance	Module instance of executable file containing the resource

ResInfo	Desired resource

Size	Size in bytes to allocate for the resource; ignored if 0

Return Value

Allocated global memory block

See Also

FindResource

LoadResource


AllocSelector (API function)
AllocSelector (Windows API function)

Declaration

function AllocSelector(Selector: Word): Word;

Description

Allocates a new selector which is an exact copy of Selector. If Selector is nil allocates a new, uninitialized selector.

Use of AllocSelector and related functions is not normal Windows programming practice. These functions should be avoided if possible.

Parameters

Selector	Selector to be copied

Return Value

A selector if successful;

0 if not


AnimatePalette (API procedure)
AnimatePalette (Windows API procedure)

Declaration

procedure AnimatePalette(Palette: HPalette; StartIndex: Word; NumEntries: Word; var PaletteColors);

Description

Replaces entries in Palette between StartIndex and NumEntries with PaletteColors.

Parameters

Palette	The logical palette

StartIndex	The first entry in palette to be animated

NumEntries	The number of entries in palette to be animated

PaletteColors	An array of TPaletteEntry structures

See Also

CreatePalette


AnsiLower (API function)
AnsiLower (Windows API function)

Declaration

function AnsiLower(Str: PChar): PChar;

Description

Uses language driver to convert Str to lowercase.

Parameters

Str	Null-terminated string or a single character (in low-order byte)

Return Value

Converted string or character


AnsiLowerBuff (API function)
AnsiLowerBuff (Windows API function)

Declaration

function AnsiLowerBuff(Str: PChar; Length: Word): Word;

Description

Uses language driver to convert Str to lowercase.

Parameters

Str	Buffer of characters

Length	Number of characters in buffer; if 0 length is 64K (65,536)

Return Value

Length of the converted string


AnsiNext (API function)
AnsiNext (Windows API function)

Declaration

function AnsiNext(CurrentChar: PChar): PChar;

Description

Used to iterate through strings whose characters are 2 or more bytes long.

Parameters

CurrentChar	Null-terminated string

Return Value

Pointer to next character in string


AnsiPrev (API function)
AnsiPrev (Windows API function)

Declaration

function AnsiPrev(Start, CurrentChar: PChar): PChar;

Description

Used to iterate backwards through strings whose characters are 2 or more bytes long.

Parameters

Start	Beginning of string (null-terminated)

CurrentChar	Points to a character in the string

Return Value

*Pointer to previous character in the string


AnsiToOem (API function)
AnsiToOem (Windows API function)

Declaration

function AnsiToOem(AnsiStr, OemStr: PChar): Integer;

Description

Translates AnsiStr to OEM-defined character set. Length can be greater than 64K.

Parameters

AnsiStr	String (null-terminated) of ANSI characters

OemStr	Location where translated string is to be copied, can be same as AnsiStr

Return Value

Always -1


AnsiToOemBuff (API procedure)
AnsiToOemBuff (Windows API procedure)

Declaration

procedure AnsiToOemBuff(AnsiStr, OemStr: PChar; Length: Integer);

Description

Translates AnsiStr to OEM-defined character set.

Parameters

AnsiStr	Buffer of ANSI characters

OemStr	Location where translated string is to be copied, can be same a AnsiStr

Length	Size of AnsiStr, if 0, the length is 64K


AnsiUpper (API function)
AnsiUpper (Windows API function)

Declaration

function AnsiUpper(Str: PChar): PChar;

Description

Uses language driver to convert Str to uppercase.

Parameters

Str	String (null-terminated) or a single character (in low-order byte)

Return Value

Converted string or character


AnsiUpperBuff (API function)
AnsiUpperBuff (Windows API function)

Declaration

function AnsiUpperBuff(Str: PChar; Length: Word): Word;

Description

Uses language driver to convert Str to uppercase.

Parameters

Str	Buffer of characters

Length	Size of Str; if 0 length is 64K (65,536)

Return Value

Length of the converted string


AnyPopup (API function)
AnyPopup (Windows API function)

Declaration

function AnyPopup: Bool;

Description

Determines whether a popup window exists on the screen.

Return Value

Non-zero if popup window exists, or

0 if not


AppendMenu (API function)
AppendMenu (Windows API function)

Declaration

function AppendMenu(Menu: HMenu; Flags, IDNewItem: Word; NewItem: PChar): Bool;

Description

Appends a new item, whose state is specified by Flags, to the end of a menu.

Parameters

Menu	Menu to be changed

Flags	One or a combination of the following mf_ Menu flags constants:

mf_Bitmap

mf_Checked

mf_Disabled

mf_Enabled

mf_Grayed

mf_MenuBarBreak

mf_MenuBreak

mf_OwnerDraw

mf_Popup

mf_Separator

mf_String

mf_Unchecked

IDNewItem	Command ID or menu handle if popup menu

NewItem	New menu string, or in the case of a using a bitmap as an item, the low order word holds a handle to the bitmap

Return Value

Non-zero if successful, or

0 if not

See Also

DrawMenuBar

SetMenuItemBitmaps

wm_DrawItem

wm_MeasureItem


Arc (API function)
Arc (Windows API function)

Declaration

function Arc(DC: HDC; X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer): Bool;

Description

Draws an elliptical arc centered in the bounding rectangle.

Parameters

DC	Device context

X1, Y1	Upper-left corner of bounding rectangle

X2, Y2	Lower-right corner of bounding rectangle

X3, Y3	Arc's starting point

X4, Y4	Arc's end point

Return Value

Non-zero if the arc is drawn, or

0 if not

See Also

The bounding rectangle must not be taller or wider than 32,767 units


ArrangeIconicWindows (API function)
ArrangeIconicWindows (Windows API function)

Declaration

function ArrangeIconicWindows(Wnd: HWnd): Word;

Description

Arranges icons in an MDI client window or icons on the desktop window.

Parameters

Wnd	Parent window identifier

Return Value

Height of one row of icons, or

0 if no icons

See Also

GetDesktopWindow


BeginDeferWindowPos (API function)
BeginDeferWindowPos (Windows API function)

Declaration

function BeginDeferWindowPos(NumWindows: Integer): THandle;

Description

Allocates memory for multiple window-position data structure.

Parameters

NumWindows	Initial number of windows whose position information is to be stored

Return Value

Window-position structure identifier

See Also

DeferWindowPos

EndDeferWindowPos


BeginPaint (API function)
BeginPaint (Windows API function)

Declaration

function BeginPaint(Wnd: HWnd; var Paint: TPaintStruct): HDC;

Description

Prepares a window for painting in response to a wm_Paint message. Fills Paint with information for painting.

Parameters

Wnd	Window to be repainted

Paint	TPaintStruct to receive painting information

Return Value

Device context identifier

See Also

EndPaint

InvalidateRect

InvalidateRgn

wm_EraseBkgnd

wm_Paint


BitBlt (API function)
BitBlt (Windows API function)

Declaration

function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: Longint): Bool;

Description

Copies a bitmap from SrcDC to DestDC performing the specified raster operation.

Parameters

DestDC	Device context to receive the bitmap

X, Y	Upper-left corner of the destination rectangle

Width	Width of the destination rectangle and source bitmap

Height	Height of the destination rectangle and source bitmap

SrcDC	Device context to copy bitmap from, or 0 for raster op on DestDC only

XSrc, YSrc	Upper-left corner of SrcDC

Rop	One of the Ternary raster operations constants performs a simple copy from source to destination

Return Value

Non-zero if bitmap is drawn, or

0 if not


BringWindowToTop (API procedure)
BringWindowToTop (Windows API procedure)

Declaration

procedure BringWindowToTop(Wnd: HWnd);

Description

Activates and brings Wnd to top of a stack of overlapping windows.

Parameters

Wnd	Pop-up or child window


BuildCommDCB (API function)
BuildCommDCB (Windows API function)

Declaration

function BuildCommDCB(Def: PChar; var DCB: TDCB): Integer;

Description

Translates Def into appropriate device-control block codes which are copied into DCB.

Parameters

Def	DOS MODE command-line (null-terminated) of device-control information

DCB	Receiving TDCB structure

Return Value

0 if Def is translated, or

negative if not

See Also

SetCommState


CallMsgFilter (API function)
CallMsgFilter (Windows API function)

Declaration

function CallMsgFilter(var Msg: TMsg; Code: Integer): Bool;

Description

Passes Msg to the current message filter function.

Parameters

Msg	TMsg containing message to be filtered

Code	Filter function code

Return Value

0 if message should be processed, or

non-zero if not

See Also

SetWindowsHook


CallWindowProc (API function)
CallWindowProc (Windows API function)

Declaration

function CallWindowProc(PrevWndProc: TFarProc; Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Longint;

Description

Calls and passes message information to PrevWndProc. Enables window subclassing by allowing messages to be intercepted before being passed to the window function of the class.

Parameters

PrevWndProc	Procedure-instance address of the previous window function

Wnd	Window that receives the message

Msg	Message identifier

wParam	Additional message-dependent information

lParam	Additional message-dependent information

Return Value

Value from call to PrevWndProc

See Also

SetWindowLong


Catch (API function)
Catch (Windows API function)

Declaration

function Catch(var CatchBuf: TCatchBuf): Integer;

Description

Copies the state of all systems registers and the instruction pointer into CatchBuf.

Parameters

CatchBuf	TCatchBuf to copy execution environment into

Return Value

0 if the environment is copied

See Also

Throw


ChangeClipboardChain (API function)
ChangeClipboardChain (Windows API function)

Declaration

function ChangeClipboardChain(Wnd, WndNext: HWnd): Bool;

Description

Removes Wnd from the chain of clipboard viewers and replaces it with WndNext.

Parameters

Wnd	Window to be removed from chain

WndNext	Window that follows Wnd in the clipboard-viewer chain

Return Value

Non-zero if the window is found and removed

See Also

SetClipboardViewer

wm_ChangeCBChain


ChangeSelector (API function)
ChangeSelector (Windows API function)

Declaration

function ChangeSelector(DestSelector, SourceSelector: Word): Word;

Description

Changes the attributes of a selector from code to data or vice versa. The value of the selector is not affected.

This is not normally done, and should only be done if absolutely necessary. The converted selector should be used immediately, as there is no way to keep the source and destination selectors synchronized.

Parameters

DestSelector	The selector that receives the converted selector. Must have been previously allocated with AllocSelector.

SourceSelector	The selector to be converted.

Return Value

Converted selector, or

0 if conversion failed.


CheckDlgButton (API procedure)
CheckDlgButton (Windows API procedure)

Declaration

procedure CheckDlgButton(Dlg: HWnd; IDButton: Integer; Check: Word);

Description

Places or removes a checkmark from a button control, or changes state of a three-button control.

Parameters

Dlg	Dialog box that contains the button

IDButton	Button control to be modified

Check	Removed(0), checked(1), grayed(2)


CheckMenuItem (API function)
CheckMenuItem (Windows API function)

Declaration

function CheckMenuItem(Menu: HMenu; IDCheckItem, Check: Word): Bool;

Description

Places or removes a checkmark from menu items in a popup menu.

Parameters

Menu	Popup menu

IDCheckItem	Menu item to be checked

Check	How item should be checked and how its position is specified; can be a combination of the following mf_ Menu flags:

mf_ByCommand

mf_ByPosition

mf_Checked

mf_Unchecked

Return Value

Previous state of item, or

-1 if menu item does not exist


CheckRadioButton (API procedure)
CheckRadioButton (Windows API procedure)

Declaration

procedure CheckRadioButton(Dlg: HWnd; IDFirstButton, IDLastButton, IDCheckButton: Integer);

Description

Checks IDCheckButton and removes the checkmark from the group of radio buttons specified by IDFirstButton and IDLastButton.

Parameters

Dlg	Dialog box

IDFirstButton	ID of first radio button in group

IDLastButton	ID of last radio button in group

IDCheckButton	ID of radio button to check


ChildWindowFromPoint (API function)
ChildWindowFromPoint (Windows API function)

Declaration

function ChildWindowFromPoint(WndParent: HWnd; APoint: TPoint): HWnd;

Description

Determines which child window owned by WndParent contains APoint.

Parameters

WndParent	Parent window

APoint	TPoint structure of client coordinates to be tested

Return Value

Child window that contains the point, or

0 if point lies outside the parent window, or

WndParent if point not contained within any child window


Chord (API function)
Chord (Windows API function)

Declaration

function Chord(DC: HDC; X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer): Bool;

Description

Draws a chord bounded by the intersection of an ellipse which is centered in the bounding rectangle and a line segment.

Parameters

DC	Device context

X1, Y1	Upper-left corner of bounding rectangle

X2, Y2	Lower-right corner of bounding rectangle

X3, Y3	One end of the line segment

X4, Y4	One end of the line segment

Return Value

Non-zero if the chord is drawn, or

0 if not


ClearCommBreak (API function)
ClearCommBreak (Windows API function)

Declaration

function ClearCommBreak(Cid: Integer): Integer;

Description

Restores character transmission and places the line in a non-break state.

Parameters

Cid	Communication device to be restored

Return Value

0 if successful, or

negative if Cid is not a valid device

See Also

OpenComm


ClientToScreen (API procedure)
ClientToScreen (Windows API procedure)

Declaration

procedure ClientToScreen(Wnd: HWnd; var Point: TPoint);

Description

Converts client coordinates in APoint to screen coordinates.

Parameters

Wnd	Window containing client area

APoint	TPoint containing client coordinates


ClipCursor (API procedure)
ClipCursor (Windows API procedure)

Declaration

procedure ClipCursor(Rect: LPRect);

Description

Confines cursor to Rect. If Rect is nil the cursor is unbounded.

Parameters

Rect	Bounding TRect in screen coordinates

See Also

SetCursorPos


CloseClipboard (API function)
CloseClipboard (Windows API function)

Declaration

function CloseClipboard: Bool;

Description

Closes the clipboard to allow access by other applications.

Return Value

Non-zero if clipboard is closed, or

0 if not


CloseComm (API function)
CloseComm (Windows API function)

Declaration

function CloseComm(Cid: Integer): Integer;

Description

Closes Cid, flushing the output queue. Any memory used for transmit and receive queues is freed.

Parameters

Cid	Communications device

Return Value

0 if device is closed, or

negative if error

See Also

OpenComm


CloseMetaFile (API function)
CloseMetaFile (Windows API function)

Declaration

function CloseMetaFile(DC: THandle): THandle;

Description

Closes DC and creates a metafile handle that can be used to play the metafile.

Parameters

DC	Metafile device context

Return Value

Metafile identifier if successful, or

0 if not

See Also

PlayMetaFile


CloseSound (API procedure)
CloseSound (Windows API procedure)

Declaration

procedure CloseSound;

Description

Flushes all voice queues, frees any allocated buffers and closes access to the play device


CloseWindow (API procedure)
CloseWindow (Windows API procedure)

Declaration

procedure CloseWindow(Wnd: HWnd);

Description

Minimizes Wnd. Icons for overlapped windows are moved into the icon area of the screen.

Parameters

Wnd	Window to be minimized


CombineRgn (API function)
CombineRgn (Windows API function)

Declaration

function CombineRgn(DestRgn, SrcRgn1, SrcRgn2: HRgn; CombineMode: Integer): Integer;

Description

Combines regions SrcRgn1 with SrcRgn2 and places result in DestRgn. CombineMode specifies the method with which the regions are combined.

Parameters

DestRgn	Region to be replaced with new region

SrcRgn1	An existing region

SrcRgn2	An existing region

CombineMode	One of the rgn_ Combine region flags

Return Value

One of the Region flags constants


CopyMetaFile (API function)
CopyMetaFile (Windows API function)

Declaration

function CopyMetaFile(SrcMetaFile: THandle; FileName: PChar): THandle;

Description

Copies SrcMetaFile to the file FileName.

Parameters

SrcMetaFile	Source metafile

FileName	Metafile name (null-terminated) or 0 to copy to a memory metafile

Return Value

New metafile identifier


CopyRect (API procedure)
CopyRect (Windows API procedure)

Declaration

procedure CopyRect(var DestRect, SourceRect: TRect);

Description

Copies SourceRect to DestRect.

Parameters

DestRect	TRect structure

SourceRect	TRect structure


CountClipboardFormats (API function)
CountClipboardFormats (Windows API function)

Declaration

function CountClipboardFormats: Integer;

Description

Counts number of formats the clipboard can render.

Return Value

Number of data formats in clipboard


CountVoiceNotes (API function)
CountVoiceNotes (Windows API function)

Declaration

function CountVoiceNotes(Voice: Integer): Integer;

Description

Counts the number of notes in Voice.

Parameters

Voice	Voice queue

Return Value

Number of notes

See Also

SetVoiceNote


CreateBitmap (API function)
CreateBitmap (Windows API function)

Declaration

function CreateBitmap(Width, Height: Integer; Planes, BitCount: Byte; Bits: Pointer): HBitmap;

Description

Creates a device-dependent memory bitmap.

Parameters

Width	Width (in pixels) of the bitmap

Height	Height (in pixels) of the bitmap

Planes	Number of color planes in the bitmap

BitCount	Number of color bits per display pixel

Bits	Short-integer array containing initial bitmap values; if nil the new bitmap is left uninitialized

Return Value

Bitmap identifier if successful, or

0 if not

See Also

BitBlt

SelectObject


CreateBitmapIndirect (API function)
CreateBitmapIndirect (Windows API function)

Declaration

function CreateBitmapIndirect(var Bitmap: TBitmap): HBitmap;

Description

Creates a bitmap defined by Bitmap.

Parameters

Bitmap	TBitmap structure

Return Value

Bitmap identifier if successful, or

0 if not

See Also

BitBlt


CreateBrushIndirect (API function)
CreateBrushIndirect (Windows API function)

Declaration

function CreateBrushIndirect(var LogBrush: TLogBrush): HBrush;

Description

Creates a logical brush defined by LogBrush.

Parameters

LogBrush	TLogBrush structure

Return Value

Logical brush identifier if successful, or

0 if not


CreateCaret (API procedure)
CreateCaret (Windows API procedure)

Declaration

procedure CreateCaret(Wnd: HWnd; ABitmap: HBitmap; Width, Height: Integer);

Description

Creates a new shape for the system caret.

Parameters

Wnd	Owning window of the new caret

ABitmap	Bitmap that defines the caret; if 0, caret is black; if, 1 caret is gray

Width	Caret width (in logical units)

Height	Caret height (in logical units)

See Also

CreateBitmap

CreateDIBitmap

GetSystemMetrics

LoadBitmap


CreateCompatibleBitmap (API function)
CreateCompatibleBitmap (Windows API function)

Declaration

function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBitmap;

Description

Creates a bitmap that is compatible with DC.

Parameters

DC	Device context

Width	Bitmap width (in bits)

Height	Bitmap height (in bits)

Return Value

Bitmap identifier if successful;

0 if not


CreateCompatibleDC (API function)
CreateCompatibleDC (Windows API function)

Declaration

function CreateCompatibleDC(DC: HDC): HDC;

Description

Creates a memory device context that is compatible with DC.

Parameters

DC	Device context; if 0 a memory device context is created

Return Value

New memory device context if successful;

0 if not

See Also

DeleteDC

GetDeviceCaps


CreateCursor (API function)
CreateCursor (Windows API function)

Declaration

function CreateCursor(Instance: THandle; Xhotspot, Yhotspot, Width, Height: Integer; ANDBitPlane, XORBitPlane: Pointer): HCursor;

Description

Creates a cursor.

Parameters

Instance	Module instance creating the cursor

Xhotspot, Yhotspot	Position of cursor hotspot

Width	Cursor width (in pixels)

Height	Cursor height (in pixels)

ANDBitPlane	Array of bytes containing AND mask

XORBitPlane	Array of bytes containing XOR mask

Return Value

Cursor identifier if successful;

0 if not


CreateDC (API function)
CreateDC (Windows API function)

Declaration

function CreateDC(DriverName, DeviceName, Output: PChar; InitData: Pointer): HDC;

Description

Creates a device context for DriverName device.

Parameters

DriverName	DOS filename (without extension and null-terminated) of the device driver

DeviceName	Name of specific device to be supported (null-terminated)

Output	Output DOS file or device name (null-terminated)

InitData	DEVMODE structure containing device-specific initialization data

Return Value

Device context identifier if successful;

0 if not


CreateDialog (API function)
CreateDialog (Windows API function)

Declaration

function (Instance: THandle; TemplateName: PChar; WndParent: HWnd; DialogFunc: TFarProc): HWnd;

Description

Creates a modeless dialog box defined by TemplateName dialog box resource.

Parameters

Instance	Module instance whose executable file contains the dialog box resource

TemplateName	Dialog box resource name (null-terminated)

WndParent	Parent window of the dialog box

DialogFunc	Dialog function procedure-instance address or nil if class defined

Return Value

Dialog box window handle if successful;

0 if not

See Also

DefDlgProc

MakeProcInstance

wm_InitDialog


CreateDialogIndirect (API function)
CreateDialogIndirect (Windows API function)

Declaration

function CreateDialogIndirect(Instance: THandle; DialogTemplate: PChar; Parent: HWnd; DialogFunc: TFarProc): HWnd;

Description

Creates a modeless dialog box defined by dialog template.

Parameters

Instance	Module instance

DialogTemplate	Structure containing dialog box template

WndParent	Owning window of the dialog box

DialogFunc	Dialog callback function procedure-instance address

Return Value

Dialog box window handle if successful;

0 if not

See Also

DefDlgProc

MakeProcInstance

wm_InitDialog


CreateDialogIndirectParam (API function)
CreateDialogIndirectParam (Windows API function)

Declaration

function CreateDialogIndirectParam(Instance: THandle;var DialogTemplate; WndParent: HWnd; DialogFunc: TFarProc; InitParam: Longint): HWnd;

Description

Creates a modeless dialog box defined by dialog template. It differs from CreateDialogIndirect in that it allows you to pass a parameter, InitParam, to the callback function.

Parameters

Instance	Module instance

DialogTemplate	Structure containing dialog box template

WndParent	Owning window of the dialog box

DialogFunc	Dialog function procedure-instance address or nil if class defined

InitParam	Value passed to dialog function (lParam of wm_InitDialog message) when the dialog box is created

Return Value

Dialog box window handle if successful;

0 if not

See Also

DefDlgProc

MakeProcInstance

wm_InitDialog


CreateDialogParam (API function)
CreateDialogParam (Windows API function)

Declaration

function CreateDialogParam(Instance: THandle; TemplateName: PChar; WndParent: HWnd; DialogFunc: TFarProc; InitParam: Longint): HWnd;

Description

Creates a modeless dialog box defined by TemplateName.

Parameters

Instance	Module instance whose executable file contains the dialog box template

TemplateName	Dialog box template name (null-terminated)

Parent	Owning window of the dialog box

DialogFunc	Dialog function procedure-instance address or nil if class defined

InitParam	Value passed to dialog function (lParam of wm_InitDialog message) when the dialog box is created

Return Value

Dialog box window handle if successful;

0 if not

See Also

DefDlgProc

MakeProcInstance


CreateDIBitmap (API function)
CreateDIBitmap (Windows API function)

Declaration

function CreateDIBitmap(DC: HDC; var InfoHeader: TBitmapInfoHeader; Usage: Longint; InitBits: PChar; var InitInfo: TBitmapInfo; Usage: Word): HBitmap;

Description

Creates a device-specific memory bitmap from a device-independent bitmap described by InfoHeader and InitInfo.

Parameters

DC	Device context

InfoHeader	TBitmapInfoHeader which describes bitmap size and format

Usage	If cbm_Init the bitmap is initialized according to InitBits and InitInfo

InitBits	Byte array containing initial bitmap values, format dependent on biBitCount field of InitInfo

InitInfo	TBitmapInfo structure which describes dimensions and color format

Usage	One of the DIB_ Color table identifiers constants

Return Value

Bitmap identifier if successful;

0 if not


CreateDIBPatternBrush (API function)
CreateDIBPatternBrush (Windows API function)

Declaration

function CreateDIBPatternBrush(PackedDIB: THandle; Usage: Word): HBitmap;

Description

Creates a logical brush from the device-independent bitmap defined by PackedDIB.

Parameters

PackedDIB	Global memory containing TBitmapInfo structure plus array of pixels

Usage	One of the DIB_ Color table identifiers constants

Return Value

Logical brush identifier if successful;

0 if not

See Also

GetDeviceCaps


CreateDiscardableBitmap (API function)
CreateDiscardableBitmap (Windows API function)

Declaration

function CreateDiscardableBitmap(DC: HDC; Width, Height: Integer): HBitmap;

Description

Creates a discardable bitmap compatible with DC.

Parameters

DC	Device context

Width	Bitmap width (in bits)

Height	Bitmap height (in bits)

Return Value

Bitmap identifier if successful;

0 if not


CreateEllipticRgn (API function)
CreateEllipticRgn (Windows API function)

Declaration

function CreateEllipticRgn(X1, Y1, X2, Y2: Integer): HRgn;

Description

Creates an elliptical region bounded by the specified rectangle.

Parameters

X1, Y1	Upper-left corner of bounding rectangle

X2, Y2	Lower-right corner of bounding rectangle

Return Value

New region identifier if successful;

0 if not


CreateEllipticRgnIndirect (API function)
CreateEllipticRgnIndirect (Windows API function)

Declaration

function CreateEllipticRgnIndirect(var Rect: TRect): HRgn;

Description

Creates an elliptical region bounded by the rectangle specified in ARect.

Parameters

ARect	TRect containing upper-left and lower-right corners of the bounding rectangle

Return Value

New region identifier if successful;

0 if not


CreateFont (API function)
CreateFont (Windows API function)

Declaration

function CreateFont(Height, Width, Escapement, Orientation, Weight: Integer; Italic, Underline, StrikeOut, CharSet, OutputPrecision, ClipPrecision, Quality, PitchAndFamily: Byte; FaceName: PChar): HFont;

Description

Creates a logical font selected from GDI's pool of physical fonts according to specified

characteristics.

Parameters

Height	Font height (in logical units)

Width	Average font width (in logical units)

Escapement	Line angle (in tenths of degrees)

Orientation	Character baseline angle (in tenths of degrees)

Weight	Font weight (0 - 1000); or use a fw_ Font weight flag such as fw_Normal or fw_Bold

Italic	Font is italic

Underline	Font is underlined

StrikeOut	Font is struck out

CharSet	One of the Font character set flags constants

OutputPrecision	One of the out_ Font output precision flags constants

ClipPrecision	One of the clip_ Font clipping precision flags constants

Quality	One of the Font output quality flags constants

PitchAndFamily	One of the Font pitch flags constants combined with one of the ff_ Font family flags

Facename	Font typeface name (null-terminated)

Return Value

Logical font identifier if successful;

0 if not

See Also

EnumFonts


CreateFontIndirect (API function)
CreateFontIndirect (Windows API function)

Declaration

function CreateFontIndirect(var LogFont: TLogFont): HFont;

Description

Creates a logical font selected from GDI's pool of physical fonts according to the characteristics in ALogFont.

Parameters

ALogFont	TLogFont structure

Return Value

Logical font identifier if successful;

0 if not


CreateHatchBrush (API function)
CreateHatchBrush (Windows API function)

Declaration

function CreateHatchBrush(Index: Integer; Color: TColorRef): HBrush;

Description

Creates a logical brush with the specified hatch style.

Parameters

Index	One of the hs_ Hatch styles constants

Color	TColorRef that specifies the color of the hatches

Return Value

Logical brush identifier if successful;

0 if not


CreateIC (API function)
CreateIC (Windows API function)

Declaration

function CreateIC(DriverName, DeviceName, Output, InitData: PChar): HDC;

Description

Creates an information context for the device.

Parameters

DriverName	Device driver DOS filename (no extension and null-terminated)

DeviceName	Specific device name (null-terminated)

Output	Output DOS file or device name (null-terminated)

InitData	Device-specific initialization data; nil for default initialization

Return Value

Information context identifier if successful;

0 if not


CreateIcon (API function)
CreateIcon (Windows API function)

Declaration

function CreateIcon(Instance: THandle; Width, Height: Integer; Planes, BitsPixel: Byte; ANDbits, XORbits: Pointer): HIcon;

Description

Creates an icon.

Parameters

Instance	Module instance creating the icon

Width	Icon width (in pixels)

Height	Icon height (in pixels)

Planes	Number of planes in XOR mask

BitsPixel	Number of bits per pixel in XOR mask

ANDbits	Byte array containing monochrome AND mask of the icon

XORbits	Byte array containing XOR mask

Return Value

Icon identifier if successful;

0 if not of the icon


CreateMenu (API function)
CreateMenu (Windows API function)

Declaration

function CreateMenu: HMenu;

Description

Creates an initially empty menu.

Return Value

Menu identifier if successful;

0 if not

See Also

AppendMenu

InsertMenu


CreateMetaFile (API function)
CreateMetaFile (Windows API function)

Declaration

function CreateMetaFile(FileName: PChar): THandle;

Description

Creates a metafile device context.

Parameters

FileName	Metafile name (null-terminated) or nil to specify a memory metafile

Return Value

Metafile device context identifier if successful;

0 if not


CreatePalette (API function)
CreatePalette (Windows API function)

Declaration

function CreatePalette(var LogPalette: TLogPalette): HPalette;

Description

Creates a logical color palette.

Parameters

LogPalette	TLogPalette containing color information about the logical palette

Return Value

Logical palette identifier if successful;

0 if not


CreatePatternBrush (API function)
CreatePatternBrush (Windows API function)

Declaration

function CreatePatternBrush(Bitmap: HBitmap): HBrush;

Description

Creates a logical brush with Bitmap pattern.

Parameters

Bitmap	HBitmap bitmap identifier

Return Value

Logical brush identifier if successful;

0 if not

See Also

CreateBitmap

CreateBitmapIndirect

LoadBitmap

CreateCompatibleBitmap

DeleteObject

GetDeviceCaps


CreatePen (API function)
CreatePen (Windows API function)

Declaration

function CreatePen(PenStyle, Width: Integer; Color: TColorRef): HPen;

Description

Creates a logical pen.

Parameters

PenStyle	One of the ps_ Pen styles constants

Width	Pen width (in logical units)

Color	Pen TColorRef

Return Value

Logical pen identifier if successful;

0 if not


CreatePenIndirect (API function)
CreatePenIndirect (Windows API function)

Declaration

function CreatePenIndirect(var LogPen: TLogPen): HPen;

Description

Creates a logical pen defined by LogPen.

Parameters

LogPen	TLogPen structure

Return Value

Logical pen identifier if successful;

0 if not


CreatePolygonRgn (API function)
CreatePolygonRgn (Windows API function)

Declaration

function CreatePolygonRgn(var Points; Count, PolyFillMode: Integer): HRgn;

Description

Creates a polygon region.

Parameters

Points	TPoint array containing vertices of the polygon

Count	Number of points in Points

PolyFillMode	Mode for filling the region; use one of the PolyFill modes constants

Return Value

New region identifier if successful;

0 if not

See Also

SetPolyFillMode


CreatePolyPolygonRgn (API function)
CreatePolyPolygonRgn (Windows API function)

Declaration

function CreatePolyPolygonRgn(var Points; var PolyCounts; Counts, PolyFillMode: Integer): HRgn;

Description

Creates a region consisting of a series of possibly overlapping closed polygons.

Parameters

Points	TPoint array containing vertices of the polygons

PolyCounts	Integer array where each corresponding element specifies the number of points for each polygon in Points

Count	Size of PolyCounts

PolyFillMode	One of the PolyFill modes

Return Value

Region identifier if successful;

0 if not


CreatePopupMenu (API function)
CreatePopupMenu (Windows API function)

Declaration

function CreatePopupMenu: HMenu;

Description

Creates an empty popup menu.

Return Value

Menu identifier if successful;

0 if not

See Also

AppendMenu

InsertMenu

TrackPopupMenu


CreateRectRgn (API function)
CreateRectRgn (Windows API function)

Declaration

function CreateRectRgn(X1, Y1, X2, Y2: Integer): HRgn;

Description

Creates a rectangular region bounded by the specified rectangle.

Parameters

X1, Y1	Upper-left corner of bounding rectangle

X2, Y2	Lower-right corner of bounding rectangle

Return Value

Region identifier if successful;

0 if not


CreateRectRgnIndirect (API function)
CreateRectRgnIndirect (Windows API function)

Declaration

function CreateRectRgnIndirect(var Rect: TRect): HRgn;

Description

Creates a rectangular region bounded by ARect.

Parameters

ARect	TRect containing upper-left and lower-right corners of the region


CreateRoundRectRgn (API function)
CreateRoundRectRgn (Windows API function)

Declaration

function CreateRoundRectRgn(X1, Y1, X2, Y2, X3, Y3: Integer): HRgn;

Description

Creates a rectangular region with rounded corners bounded by the specified region.

Parameters

X1, Y1	Upper-left corner of region

X2, Y2	Lower-right corner of region

X3	Ellipse width for rounded corners

Y3	Ellipse height for rounded corners

Return Value

Region identifier if successful;

0 if not


CreateSolidBrush (API function)
CreateSolidBrush (Windows API function)

Declaration

function CreateSolidBrush(Color: TColorRef): HBrush;

Description

Creates a logical brush.

Parameters

Color	Brush TColorRef

Return Value

Logical brush identifier if successful;

0 if not


CreateWindow (API function)
CreateWindow (Windows API function)

Declaration

function CreateWindow(ClassName, WindowName: PChar; Style: Longint; X, Y, Width, Height: Integer; WndParent: HWnd; Menu: HMenu; Instance: THandle; Param: Pointer): HWnd;

Description

Creates an overlapped, pop-up, or child window.

Parameters

ClassName	Window class name (null-terminated) or a predefined control-class name

WindowName	Window caption or name (null-terminated)

Style	One or a combination of window or control style constants:

bs_ Button styles

cbs_ Combo box styles

ds_ Dialog styles

es_ Edit control styles

lbs_ List box styles

sbs_ Scroll bar styles

ss_ Static control styles

ws_ Window styles

X, Y	Initial window position or cw_UseDefault

Width	Initial window width (in device units)

Height	Initial window height (in device units)

WndParent	Owner window

Menu	Menu or child-window identifier

Instance	Associated module instance

Param	Value passed in TCreateStruct in lParam of the wm_Create message, must be a pointer to a TClientCreateStruct for MDI client window creation

Return Value

Window identifier if successful;

0 if not

See Also

RegisterClass

wm_Create

wm_GetMinMaxInfo

wm_NCCreate


CreateWindowEx (API function)
CreateWindowEx (Windows API function)

Declaration

function CreateWindowEx(ExStyle: Longint; ClassName, WindowName: PChar; Style: Longint; X, Y, Width, Height: Integer; WndParent: HWnd; Menu: HMenu; Instance: THandle; Param: Pointer): HWnd;

Description

Creates an overlapped, pop-up, or child window with an extended style.

Parameters

ExStyle	One of the ws_ex_ Extended window styles constants

ClassName	Window class name (null-terminated) or a predefined control-class name

WindowName	Window caption or name (null-terminated)

Style	One or a combination of window or control style constants:

bs_ Button styles

cbs_ Combo box styles

ds_ Dialog styles

es_ Edit control styles

lbs_ List box styles

sbs_ Scroll bar styles

ss_ Static control styles

ws_ Window styles

X, Y	Initial window position or cw_UseDefault

Width	Initial window width (in device units)

Height	Initial window height (in device units)

WndParent	Owner window

Menu	Menu or child-window identifier

Instance	Associated module instance

Param	Value passed in  TCreateStruct in lParam of the wm_Create message, must be a pointer to a TClientCreateStruct for MDI client window creation

Return Value

Window identifier if successful;

0 if not

See Also

CreateWindow

wm_ParentNotify


DebugBreak (API procedure)
DebugBreak (Windows API procedure)

Declaration

procedure DebugBreak;

Description

Forces a break to the debugger.


DefDlgProc (API function)
DefDlgProc (Windows API function)

Declaration

function DefDlgProc(Dlg: HWnd; Msg, wParam: Word; lParam: Longint): Longint;

Description

Provides default processing for dialogs with a private window class.

Parameters

Dlg	Dialog box identifier

Msg	Message number

wParam	message-dependent information

lParam	message-dependent information

Return Value

Result of the message processing


DeferWindowPos (API function)
DeferWindowPos (Windows API function)

Declaration

function DeferWindowPos(WinPosInfo: THandle; Wnd, WndInsertAfter: HWnd; X, Y, cX, cY: Integer; Flags: Word): THandle;

Description

Updates WinPosInfo for the window identified by Wnd.

Parameters

WinPosInfo	Multiple window-position data structure identifier

Wnd	Window to store update information about

WndInsertAfter	Window to insert Wnd after

X, Y	Windows upper-left corner position

cX	Window's new width

cY	Window's new height

Flags	One of the swp_ Set window position flags

Return Value

Updated multiple window-position data structure

See Also

BeginDeferWindowPos

EndDeferWindowPos


DefFrameProc (API function)
DefFrameProc (Windows API function)

Declaration

function DefFrameProc(Wnd, MDIClient: HWnd; Msg, wParam: Word; lParam: Longint): Longint;

Description

Provides default message processing for MDI frame windows.

Parameters

Wnd	MDI frame window

MDIClient	MDI client window

Msg	Message number

wParam	Message dependent information

lParam	Message dependent information

Return Value

Result of message processing


DefHookProc (API function)
DefHookProc (Windows API function)

Declaration

function DefHookProc(Code: Integer; wParam: Word; lParam: Longint; NextHook: TFarProc): Longint;

Description

Calls next function in chain of hook (message filter) functions.

Parameters

Code	Determines how message is processed

wParam	Message word parameter

lParam	Message long parameter

NextHook	TFarProc to next hook function

Return Value

A value dependent upon code

See Also

SetWindowsHook

UnhookWindowsHook


DefineHandleTable (API function)
DefineHandleTable (Windows API function)

Declaration

function DefineHandleTable(Offset: Word): Bool;

Description

Creates a private handle table in the default data segment.

The table holds the addresses of locked global memory objects, as returned by GlobalLock. If the memory objects are moved, Windows updates these addresses when running in real mode. Addresses are not updated in protected modes (standard and 386-enhanced).

The handle table consists of two Word-type values followed by an array of addresses.

-	The first word is the number of entries in the table, which must be initialized before the call to DefineHandleTable.

-	The second is the number of entries to set to 0 when Windows updates its list of least-recently-used memory. Either word may be changed at any time.

The addresses in the rest of the table are returned by GlobalLock.

Parameters

Offset	The offset of the table from the beginning of the data segment. A value of 0 indicates that Windows should no longer update the table.

Return Values

Non-zero if successful;

0 if successful.


DefMDIChildProc (API function)
DefMDIChildProc (Windows API function)

Declaration

function DefMDIChildProc(Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Longint;

Description

Provides default message processing for MDI child windows.

Parameters

Wnd	MDI child window

Msg	Message number

wParam	Message-dependent information

lParam	Message-dependent information

Return Value

Result of the message processing


DefWindowProc (API function)
DefWindowProc (Windows API function)

Declaration

function DefWindowProc(Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Longint;

Description

Provides default message processing for messages not explicitly handled by the application.

Parameters

Wnd	Window identifier

Msg	Message number

wParam	Message-dependent information

lParam	Message-dependent information

Return Value

Result of the message processing


DeleteAtom (API function)
DeleteAtom (Windows API function)

Declaration

function DeleteAtom(AnAtom: Atom): Atom;

Description

Deletes an atom. If the atom's reference count is 0 the associated string will be removed from the atom table.

Parameters

AnAtom	Atom identifier

Return Value

0 if successful;

Atom if not


DeleteDC (API function)
DeleteDC (Windows API function)

Declaration

function DeleteDC(DC: HDC): Bool;

Description

Deletes the device context. Notifies the device and releases all storage and systems resources if DC is the last device context for the device.

Parameters

DC	Device context identifier

Return Value

Non-zero if successful;

0 if not


DeleteMenu (API function)
DeleteMenu (Windows API function)

Declaration

function DeleteMenu(Menu: HMenu; Position, Flags: Word): Bool;

Description

Deletes an item from Menu If the item is a popup its handle is destroyed and memory freed.

Parameters

Menu	Menu identifier

Position	Position or command ID

Flags	One of the mf_ Menu flags constants:

mf_ByPosition

mf_ByCommand

Return Value

Non-zero if successful;

0 if not


DeleteMetaFile (API function)
DeleteMetaFile (Windows API function)

Declaration

function DeleteMetaFile(MF: THandle): Bool;

Description

Invalidates a metafile handle and frees its associated system resources. The metafile itself is not deleted.

Parameters

MF	Metafile identifier

Return Value

Non-zero if successful;

0 if MF is not a valid handle

See Also

GetMetaFile


DeleteObject (API function)
DeleteObject (Windows API function)

Declaration

function DeleteObject(Handle: THandle): Bool;

Description

Deletes Handle from memory and frees all associated system resources.

Parameters

Handle	Handle to a logical pen, brush, font, bitmap, region, or palette

Return Value

Non-zero if deleted;

0 if Handle is not valid or currently selected into a device context


DestroyCaret API
DestroyCaret (Windows API procedure)

Declaration

procedure DestroyCaret;

Description

Destroys the current caret, frees it from the owning window and removes it from the screen (if visible).


DestroyCursor (API function)
DestroyCursor (Windows API function)

Declaration

function DestroyCursor(Cursor: HCursor): Bool;

Description

Destroys Cursor and frees associated memory.

Parameters

Cursor	Cursor identifier

Return Value

Non-zero if successful;

0 if not

See Also

CreateCursor


DestroyIcon (API function)
DestroyIcon (Windows API function)

Declaration

function DestroyIcon(Icon: HIcon): Bool;

Description

Destroys Icon and frees associated memory.

Parameters

Icon	Icon identifier

Return Value

Non-zero if successful;

0 if not

See Also

CreateIcon


DestroyMenu(API function)
DestroyMenu (Windows API function)

Declaration

function DestroyMenu(Menu: HMenu): Bool;

Description

Destroys Menu and frees associated memory.

Parameters

Menu	Menu identifier

Return Value

Non-zero if successful;

0 if not


DestroyWindow(API function)
DestroyWindow (Windows API function)

Declaration

function DestroyWindow(Wnd: HWnd): Bool;

Description

Destroys a window or a modeless dialog box and any associated child windows.

Parameters

Wnd	Window identifier

Return Value

Non-zero if successful;

0 if not

See Also

CreateDialog

wm_Destroy

wm_NCDestroy


DialogBox (API function)
DialogBox (Windows API function)

Declaration

function DialogBox(Instance: THandle; TemplateName: PChar; WndParent: HWnd; DialogFunc: TFarProc): Integer;

Description

Creates a modal dialog box defined by TemplateName and sends wm_InitDialog before displaying the dialog.

Parameters

Instance	Module instance whose executable file contains the dialog box template

TemplateName	Dialog box template name (null-terminated)

WndParent	Owning window

DialogFunc	Dialog callback function procedure-instance address

Return Value

EndDialog nResult parameter;

-1 if dialog could not be created


DialogBoxIndirect (API function)
DialogBoxIndirect (Windows API function)

Declaration

function DialogBoxIndirect(Instance, DialogTemplate: THandle; WndParent: HWnd; DialogFunc: TFarProc): Integer;

Description

Creates a modal dialog box defined by dialog template and sends wm_InitDialog before displaying the dialog.

Parameters

Instance	Module instance whose executable file contains the dialog box template

DialogTemplate	Global memory block containing dialog template structure

WndParent	Owning window

DialogFunc	Dialog callback function procedure-instance address

Return Value

EndDialog nResult parameter;

-1 if dialog could not be created


DialogBoxIndirectParam (API function)
DialogBoxIndirectParam (Windows API function)

Declaration

function DialogBoxIndirectParam(Instance, DialogTemplate: THandle; WndParent: HWnd; DialogFunc: TFarProc; InitParam: Longint): Integer;

Description

Creates a modal dialog box defined by dialog template and sends wm_InitDialog before displaying the dialog. Also allows you to send an initial parameter to the callback function.

Parameters

Instance	Module instance whose executable file contains the dialog box template

DialogTemplate	Global memory block containing dialog template structure

WndParent	Owning window

DialogFunc	Dialog function procedure-instance address

InitParam	Passed in lParam of wm_InitDialog message

Return Value

EndDialog nResult parameter;

-1 if dialog could not be created


DialogBoxParam (API function)
DialogBoxParam (Windows API function)

Declaration

function DialogBoxParam(Instance: THandle; TemplateName: PChar; Parent: HWnd; DialogFunc: TFarProc; InitParam: Longint): Integer;

Description

Creates a modal dialog box defined by TemplateName and sends wm_InitDialog before displaying the dialog. Also allows you to send an initial parameter to the callback function.

Parameters

Instance	Module instance whose executable file contains the dialog box template

TemplateName	Dialog box template name (null-terminated)

Parent	Owning window

DialogFunc	Dialog function procedure-instance address

InitParam	Passed in lParam of wm_InitDialog message

Return Value

EndDialog nResult parameter;

-1 if dialog could not be created


DispatchMessage(API function)
DispatchMessage (Windows API function)

Declaration

function DispatchMessage(var Msg: TMsg): Longint;

Description

Passes the message in Msg to the window's window function.

Parameters

Msg	TMsg structure

Return Value

Value returned from the window function, generally ignored


DlgDirList(API function)
DlgDirList (Windows API function)

Declaration

function DlgDirList(Dlg: HWnd; PathSpec: PChar; IDListBox, IDStaticPath: Integer; Filetype: Word): Integer;

Description

Fills IDListBox with a file or directory listing matching the pathname given by PathSpec.

Parameters

Dlg	Dialog box containing IDListBox

PathSpec	Pathname string (null-terminated)

IDListBox	List box control ID

IDStaticPath	Static-text control ID to display current drive and directory

Filetype	$0000 (read\\write), $0001 (read-only), $0002 (hidden), $0004 (system), $0010 (subdirectories), $0020 archives), $2000 (lb_Dir), $4000(drives), $8000 (exclusive)

Return Value

Non-zero if listing made;

0 if invalid search path

See Also

lb_ResetContent

lb_Dir


DlgDirListComboBox (API function)
DlgDirListComboBox (Windows API function)

Declaration

function DlgDirListComboBox(Dlg: HWnd; PathSpec: PChar; IDComboBox, IDStaticPath: Integer; Filetype: Word): Integer;

Description

Fills IDComboBox with a file or directory listing matching the pathname given by PathSpec.

Parameters

Dlg	Dialog box containing IDComboBox

PathSpec	Pathname string (null-terminated)

IDComboBox	Combo box control ID

IDStaticPath	Static-text control ID to display current drive and directory

Filetype	$0000 (read\\write), $0001 (read-only), $0002 (hidden), $0004 (system), $0010 (subdirectories), $0020 (archives), $2000 (lb_Dir), $4000(drives), $8000 (exclusive)

Return Value

Non-zero if listing made;

0 if invalid search path

See Also

cb_ResetContent

cb_Dir


DlgDirSelect(API function)
DlgDirSelect (Windows API function)

Declaration

function DlgDirSelect(Dlg: HWnd; Str: PChar; IDListBox: Integer): Bool;

Description

Retrieves current list box selection and fills Str.

Parameters

Dlg	Dialog box containing IDListBox

Str	Pathname buffer

IDListBox	List box control ID

Return Value

Non-zero if current selection is a directory;

0 if not

See Also

DlgDirList

lb_GetCurSel

lb_GetText


DlgDirSelectComboBox (API function)
DlgDirSelectComboBox (Windows API function)

Declaration

function DlgDirSelectComboBox(Dlg: HWnd; Str: PChar; IDComboBox: Integer): Bool;

Description

Retrieves current combo box selection, from a simple combo box (cbs_Simple) only, and fills Str.

Parameters

Dlg	Dialog box containing IDComboBox

Str	Pathname buffer

IDComboBox	Combo box control ID

Return Value

Non-zero if current selection is a directory;

0 if not

See Also

DlgDirListComboBox

cb_GetCurSel

cb_GetLBTText


DOS3Call (API procedure)
DOS3Call (Windows API procedure)

Declaration

procedure DOS3Call;

Description

Calls the DOS interrupt function 21h.

DOS3Call should only be called from assembly-language routines, as the registers for the INT 21h call must be set up.

Under Windows, DOS3Call will work somewhat faster than a direct call to the software interrupt.


DPtoLP (API function)
DPtoLP (Windows API function)

Declaration

function DPtoLP(DC: HDC; var Points; Count: Integer): Bool;

Description

Converts device points into logical points.

Parameters

DC	Device context identifier

Points	Array of TPoint structures

Count	Number of points in Points

Return Value

Non-zero if all points are converted;

0 if not


DrawFocusRect (API procedure)
DrawFocusRect (Windows API procedure)

Declaration

procedure DrawFocusRect(DC: HDC; var Rect: TRect);

Description

Performs XOR to draw a focus style rectangle.

Parameters

DC	Device context identifier

Rect	TRect to be drawn


DrawIcon (API function)
DrawIcon (Windows API function)

Declaration

function DrawIcon(DC: HDC; X, Y: Integer; Icon: HIcon): Bool;

Description

Draws an icon.

Parameters

DC	Device context identifier

X, Y	Upper-left corner of the icon

Icon	Icon to be drawn

Return Value

Non-zero if successful;

0 if not


DrawMenuBar (API procedure)
DrawMenuBar (Windows API procedure)

Declaration

procedure DrawMenuBar(Wnd: HWnd);

Description

Redraws a windows menu bar. Used if the menu bar has been changed after the window is created.

Parameters

Wnd	Window identifier


DrawText (API function)
DrawText (Windows API function)

Declaration

function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Format: Word): Integer;

Description

Draws formatted text. The type of formatting is specified by Format Unless otherwise specified by dt_NoClip the text is clipped to the bounding rectangle.

Parameters

DC	Device-context identifier

Str	String to be drawn; if Count is -1 must be null-terminated

Count	Number of bytes in string

Rect	Bounding TRect of the text

Format	One or more of the dt_ Text drawing formatting flags

Return Value

Text height


Ellipse (API function)
Ellipse (Windows API function)

Declaration

function Ellipse(DC: HDC; X1, Y1, X2, Y2: Integer): Bool;

Description

Draws an ellipse centered in the bounding rectangle, whose border is drawn with the current pen and filled with the current brush.

Parameters

DC	Device context identifier

X1, Y1	Upper-left corner of the bounding rectangle

X2, Y2	Lower-left corner of the bounding rectangle

Return Value

Non-zero if the ellipse was drawn;

0 if not


EmptyClipboard (API function)
EmptyClipboard (Windows API function)

Declaration

function EmptyClipboard: Bool;

Description

Empties the clipboard and frees handles to data in the clipboard. Ownership is assigned to the window that has the clipboard open.

Return Value

Non-zero if the clipboard is emptied;

0 if error


EnableHardwareInput (API function)
EnableHardwareInput (Windows API function)

Declaration

function EnableHardwareInput(EnableInput: Bool): Bool;

Description

Disables mouse and keyboard input saving or discarding input as specified by EnableInput.

Parameters

EnableInput	Non-zero to save input;

0 to discard input

Return Value

Non-zero (default) if input was previously enabled;

0 if not


EnableMenuItem (API function)
EnableMenuItem (Windows API function)

Declaration

function EnableMenuItem(Menu: HMenu; IDEnableItem, Enable: Word): Bool;

Description

Enables, disables, or grays a menu item as specified by Enable.

Parameters

Menu	Menu identifier

IDEnableItem	ID or position of menu item or pop-up to be checked

Enable	A combination of the mf_ Menu flags constants

mf_Command or mf_ByPosition with

mf_Disabled, mf_Enabled, or mf_Grayed

Return Value

Previous state of menu item;

-1 if menu item does not exist


EnableWindow (API function)
EnableWindow (Windows API function)

Declaration

function EnableWindow(Wnd: HWnd; Enable: Bool): Bool;

Description

Enables or disables mouse and keyboard input to a window or control.

Parameters

Wnd	Window to be enabled or disabled

Enable	Non-zero to enable; 0 to disable

Return Value

Non-zero if successful;

0 if not


EndDeferWindowPos (API procedure)
EndDeferWindowPos (Windows API procedure)

Declaration

procedure EndDeferWindowPos(WinPosInfo: THandle);

Description

Simultaneously updates, in a single screen-refresh cycle, size and position of one or more windows.

Parameters

WinPosInfo	Multiple window data structure containing update info for multiple windows

See Also

BeginDeferWindowPos

DeferWindowPos


EndDialog (API procedure)
EndDialog (Windows API procedure)

Declaration

procedure EndDialog(Dlg: HWnd; Result: Integer);

Description

Terminates a modal dialog box. The value specified by Result is returned to the creating DialogBox function.

Parameters

Dlg	Dialog to be destroyed

Result	Return value


EndPaint (API procedure)
EndPaint (Windows API procedure)

Declaration

procedure EndPaint(Wnd: HWnd; var Paint: TPaintStruct);

Description

Signifies end of painting in Wnd.

Parameters

Wnd	Repainted window

Paint	TPaintStruct retrieved from BeginPaint function


EnumChildWindows (API function)
EnumChildWindows (Windows API function)

Declaration

function EnumChildWindows(WndParent: HWnd; EnumFunc: TFarProc; lParam: Longint): Bool;

Description

Enumerates child windows of given parent passing the child handle and lParam to the callback. Enumeration ends if the callback returns 0 or the last child is enumerated.

Parameters

WndParent	Parent window of child windows to enumerate

EnumFunc	Callback function's procedure-instance address

lParam	Value passed to callback function

Return Value

Non-zero if all child windows have been enumerated;

0 if not


EnumClipboardFormats (API function)
EnumClipboardFormats (Windows API function)

Declaration

function EnumClipboardFormats(Format: Word): Word;

Description

Enumerates list of available clipboard formats.

Parameters

Format	A known format or 0 for first format in list; the formats are specified by the cf_ Clipboard formats

Return Value

Next known clipboard format;

0 if end of format list or clipboard not open

See Also

OpenClipboard


EnumFonts (API function)
EnumFonts (Windows API function)

Declaration

function EnumFonts(DC: HDC; FaceName: PChar; FontFunc: TFarProc; Data: Pointer): Integer;

Description

Enumerates available fonts having the specified typeface on a given device. The callback is passed TLogFont, TTextMetric, FontType, and Data. Enumeration ends if the callback returns 0 or all fonts are enumerated.

Parameters

DC	Device context identifier

FaceName	Typeface name (null-terminated) or nil to randomly select a one font for each available typeface

FontFunc	Callback function's procedure-instance address

Data	Data passed to the callback function

Return Value

Last value returned by the callback


EnumMetaFile (API function)
EnumMetaFile (Windows API function)

Declaration

function EnumMetaFile(DC: HDC; MF: THandle; CallbackFunc: TFarProc; ClientData: LPByte): Bool;

Description

Enumerates GDI calls in a metafile passing:

-	DC

-	a pointer to the metafile's object handles table

-	a pointer to a record in the metafile

-	the number of objects with associated handles in the table, and

-	ClientData

to the callback.

Enumeration ends if the callback returns 0 or all GDI calls are enumerated.

Parameters

DC	Device context associated with metafile

MF	Metafile identifier

CallbackFunc	Callback function's procedure instance address

ClientData	Data passed to callback

Return Value

Non-zero if all GDI calls in metafile are enumerated;

0 if not


EnumObjects(API function)
EnumObjects (Windows API function)

Declaration

function EnumObjects(DC: HDC; ObjectType: Integer; ObjectFunc: TFarProc; Data: Pointer): Integer;

Description

Enumerates object types available on a device passing TLogPen or TLogBrushand Data to the callback. Enumeration ends if the callback returns 0 or all objects are enumerated.

Parameters

DC	Device context identifier

ObjectType	Can be one of the obj_ GDI Object Type Constants: obj_Brush or obj_Pen

ObjectFunc	Callback function's procedure-instance address

Data	Data passed to callback

Return Value

Last value returned by callback


EnumProps (API function)
EnumProps (Windows API function)

Declaration

function EnumProps(Wnd: HWnd; EnumFunc: TFarProc): Integer;

Description

Enumerates a window's property list passing Wnd, nDummy, PSTR, and hData to the callback. Enumeration ends if the callback returns 0 or all properties are enumerated.

Parameters

Wnd	Window identifier

EnumFunc	Callback function's procedure-instance address

Return Value

Last value returned by callback;

-1 if no properties


EnumTaskWindows (API function)
EnumTaskWindows (Windows API function)

Declaration

function EnumTaskWindows(Task: THandle; EnumFunc: TFarProc; lParam: Longint): Bool;

Description

Enumerates all windows in a task passing the window handle and lParam to the callback. Enumeration ends if the callback returns 0 or all windows are enumerated.

Parameters

Task	Task identifier

EnumFunc	Callback function's procedure-instance address

lParam	Value passed to callback

Return Value

Non-zero if all windows are enumerated;

0 if not

See Also

GetCurrentTask


EnumWindows (API function)
EnumWindows (Windows API function)

Declaration

function EnumWindows(EnumFunc: TFarProc; lParam: Longint): Bool;

Description

Enumerates all parent windows on the screen passing the window handle and lParam to the callback. Enumeration ends if the callback returns 0 or all windows are enumerated.

Parameters

EnumFunc	Callback function's procedure-instance address

lParam	Value passed to callback

Return Value

Non-zero if all windows are enumerated;

0 if not


EqualRect (API function)
EqualRect (Windows API function)

Declaration

function EqualRect(var Rect1, Rect2: TRect): Bool;

Description

Compares the upper-left and lower-right corners of two rectangles for equality.

Parameters

Rect1, Rect2	Rectangles to be compared

Return Value

Non-zero if equal;

0 if not


EqualRgn (API function)
EqualRgn (Windows API function)

Declaration

function EqualRgn(SrcRgn1, SrcRgn2: HRgn): Bool;

Description

Compares two regions for equality.

Parameters

SrcRgn1, SrcRgn2	Regions to be compared

Return Value

Non-zero if equal;

0 if not


Escape (API function)
Escape (Windows API function)

Declaration

function Escape(DC: HDC; Escape, Count: Integer; InData, OutData: Pointer): Integer;

Description

Allows access to device specific facilities not supported by GDI.

Parameters

DC	Device context identifier

Count	Bytes of data in InData

InData	The input data structure

OutData	Structure to receive Escape output data or nil for no output data

Return Value

A positive number if successful;

0 if escape is not implemented;

negative if error.

If error, may be one of the sp_ Spooler error codes


EscapeCommFunction(API function)
EscapeCommFunction (Windows API function)

Declaration

function EscapeCommFunction(Cid, Func: Integer): Integer;

Description

Performs extended function specified by Func on communications device.

Parameters

Cid	Communications device

Func	One of the Escape comm constants

Return Value

0 if successful;

negative if invalid function code specified

See Also

OpenComm


ExcludeClipRect (API function)
ExcludeClipRect (Windows API function)

Declaration

function ExcludeClipRect(DC: HDC; X1, Y1, X2, Y2: Integer): Integer;

Description

Creates a new clipping region consisting of the existing region minus the specified rectangle.

Parameters

DC	Device context identifier

X1, Y1	Upper-left corner of the rectangle

X2, Y2	Lower-right corner of the rectangle

Return Value

One of the Region flags constants


ExcludeUpdateRgn (API function)
ExcludeUpdateRgn (Windows API function)

Declaration

function ExcludeUpdateRgn(DC: HDC; Wnd: HWnd): Integer;

Description

Excludes a window's updated region from a clipping region which prevents drawing within invalid areas of the window.

Parameters

DC	Device context identifier

Wnd	Window being updated

Return Value

One of the Region flags constants


ExitWindows (API function)
ExitWindows (Windows API function)

Declaration

function ExitWindows(Reserved: DWord; ReturnCode: Word): Bool;

Description

Initiates standard Windows shutdown procedure. All applications must agree to terminate for Windows to exit. Calls DOS Integer 21H function 4CH.

Parameters

Reserved	Set to 0

ReturnCode	Value passed to DOS (AL)

Return Value

0 if one or more applications refuse to terminate

See Also

wm_QueryEndSession

wm_EndSession


ExtFloodFill (API function)
ExtFloodFill (Windows API function)

Declaration

function ExtFloodFill(DC: HDC; X, Y: Integer; Color: TColorRef; FillType: Word): Bool;

Description

Fills an area of a raster display surface in the manner specified by FillType The current brush is used.

Parameters

DC	Device context identifier

X, Y	Fill begin point

Color	TColorRef of boundary or area to be filled

FillType	One of the Flood fill style flags constants

Return Value

Non-zero if successful;

0 if not

See Also

FloodFill


ExtTextOut (API function)
ExtTextOut (Windows API function)

Declaration

function ExtTextOut(DC: HDC; X, Y: Integer; Options: Word; Rect: LPRect; Str: PChar; Count: Word; Dx: LPInteger): Bool;

Description

Writes a string using currently selected font within Rect.

Parameters

DC	Device context identifier

X, Y	Origin of first character cell

Options	Can be a combination of eto_ ExtTextOut options

ARect	TRect or nil

Str	String to write

Count	Number of characters in string

Dx	Array of values specifying distance between adjacent cells or 0 for default spacing

Return Value

Non-zero if string is drawn;

0 if not

See Also

SetTextAlign


FatalExit  (API procedure)
FatalExit (Windows API procedure)

Declaration

procedure FatalExit(Code: Integer);

Description

Displays Code and stack trace on the computer's auxiliary port. The user is prompted for further action. Used for debugging purposes only.

Parameters

Code	Displayed error code


FillRect (API function)
FillRect (Windows API function)

Declaration

function FillRect(DC: HDC; var Rect: TRect; Brush: HBrush): Integer;

Description

Fills a rectangle using Brush up to the right and bottom borders.

Parameters

DC	Device context identifier

Rect	 TRect to be filled

Brush	Fill brush

Return Value

Not used

See Also

CreateHatchBrush

CreatePatternBrush

CreateSolidBrush

GetStockObject


FillRgn (API function)
FillRgn (Windows API function)

Declaration

function FillRgn(DC: HDC; Rgn: HRgn; Brush: HBrush): Bool;

Description

Fills a region using Brush.

Parameters

DC	Device context identifier

Rgn	Region to be filled

Brush	Fill brush

Return Value

Non-zero if successful;

0 if not


FindAtom (API function)
FindAtom (Windows API function)

Declaration

function FindAtom(Str: PChar): Atom;

Description

Searches the atom table for the atom associated with Str.

Parameters

Str	Search string (null-terminated)

Return Value

Atom associated with Str;

0 if not found in table


FindResource (API function)
FindResource (Windows API function)

Declaration

function FindResource(Instance: THandle; Name, ResType: PChar): THandle;

Description

Locates a resource in a resource file.

Parameters

Instance	Module instance whose executable file contains the resource

Name	Resource name either a null-terminated string or an integer ID

ResType	One of the rt_ Resource types constants, a null-terminated string, or an integer ID

Return Value

Resource identifier;

0 if resource not found


FindWindow (API function)
FindWindow (Windows API function)

Declaration

function FindWindow(ClassName, WindowName: PChar): HWnd;

Description

Finds a top-level parent window with matching ClassName and WindowName Does not search child windows.

Parameters

ClassName	Window's class name (null-terminated or nil for all)

WindowName	Window's text caption or 0 for all

Return Value

Window handle;

0 if no such window


FlashWindow (API function)
FlashWindow (Windows API function)

Declaration

function FlashWindow(Wnd: HWnd; Invert: Bool): Bool;

Description

Flashes a window or icon. An open window's active status is inverted.

Parameters

Wnd	Window to be flashed

Invert	Non-zero to flash or 0 to return to original state (ignored for icons)

Return Value

Non-zero if window was active previous to call;

0 otherwise


FloodFill (API function)
FloodFill (Windows API function)

Declaration

function FloodFill(DC: HDC; X, Y: Integer; Color: TColorRef): Bool;

Description

Fills display area with current brush bounded by Color.

Parameters

DC	Device context identifier

X, Y	Position to begin filling

Color	Boundary color, a TColorRef

Return Value

Non-zero if successful;

0 if not


FlushComm (API function)
FlushComm (Windows API function)

Declaration

function FlushComm(Cid, Queue: Integer): Integer;

Description

Flushes a communication device's transmit or receive queue.

Parameters

Cid	Communications device to be flushed

Queue	0 to flush transmit queue or 1 to flush receive queue

Return Value

Non-zero if successful;

0 if not

See Also

OpenComm


FrameRect (API procedure)
FrameRect (Windows API procedure)

Declaration

procedure FrameRect(DC: HDC; var Rect: TRect; Brush: HBrush;

Description

Draws a one logical unit wide border around a rectangle.

Parameters

DC	Device context identifier

Rect	TRect defining corners of the rectangle

Brush	Framing brush

See Also

CreateHatchBrush

CreatePatternBrush

CreateSolidBrush


FrameRgn (API function)
FrameRgn (Windows API function)

Declaration

function FrameRgn(DC: HDC; Rgn: HRgn; Brush: HBrush; Width, Height: Integer): Bool;

Description

Draws a border around a region.

Parameters

DC	Device context identifier

Rgn	Region to be closed

Brush	Framing brush

Width	Border width in vertical brush strokes (logical units)

Height	Border height in horizontal brush strokes (logical units)

Return Value

Non-zero if successful;

0 if not


FreeLibrary (API procedure)
FreeLibrary (Windows API procedure)

Declaration

procedure FreeLibrary(LibModule: THandle);

Description

Invalidates LibModule and frees associated memory if the module is no longer referenced.

Parameters

LibModule	Loaded library module


FreeModule (API function)
FreeModule (Windows API function)

Declaration

function FreeModule(Module: THandle): Bool;

Description

Invalidates Module and frees associated memory if the module is no longer referenced.

Parameters

Module	Loaded module identifier

Return Value

Not used


FreeProcInstance (API procedure)
FreeProcInstance (Windows API procedure)

Declaration

procedure FreeProcInstance(Proc: TFarProc);

Description

Frees a function's procedure-instance address.

Parameters

Proc	Function's procedure-instance address to be freed

See Also

MakeProcInstance


FreeResource (API function)
FreeResource (Windows API function)

Declaration

function FreeResource(ResData: THandle): Bool;

Description

Invalidates ResData and frees associated memory if the resource is no longer referenced.

Parameters

ResData	Resource data identifier

Return Value

0 if successful;

non-zero if not

See Also

LoadResource


FreeSelector (API function)
FreeSelector (Windows API function)

Declaration

function FreeSelector(Selector: Word): Word;

Description

Frees and invalidates a selector allocated by AllocSelector or AllocDStoCSAlias.

Parameters

Selector	The selector to free

Return Value

0 if successful;

selector if not


GetActiveWindow (API function)
GetActiveWindow (Windows API function)

Declaration

function GetActiveWindow: HWnd;

Description

Retrieves the handle of the window that has the current input focus.

Return Value

Active window identifier

See Also

SetActiveWindow


GetAspectRatioFilter (API function)
GetAspectRatioFilter (Windows API function)

Declaration

function GetAspectRatioFilter(DC: HDC): Longint;

Description

Retrieves the aspect ratio used by the current aspect ratio filter.

Parameters

DC	Device context containing the specified aspect ratio

Returns	Aspect ratio where the x- and y-coordinates are contained in the high and low word, respectively

See Also

SetMapperFlags


GetAsyncKeyState (API function)
GetAsyncKeyState (Windows API function)

Declaration

function GetAsyncKeyState(Key: Integer): Integer;

Description

Determines the state of a virtual key.

Parameters

Key	Virtual-key code

Return Value

If MSB set Key is down and if LSB set Key was pressed after a preceding call to the function


GetAtomHandle (API function)
GetAtomHandle (Windows API function)

Declaration

function GetAtomHandle(AnAtom: Atom): THandle;

Description

Retrieves the string that corresponds to the specified atom.

Parameters

AnAtom	Atom identifier

Return Value

Local memory handle to atom string;

0 if atom does not exist


GetAtomName (API function)
GetAtomName (Windows API function)

Declaration

function GetAtomName(AnAtom: Atom; Buffer: PChar; Size: Integer): Word;

Description

Copies associated atom string into Buffer.

Parameters

AnAtom	Atom identifier

Buffer	Buffer to receive atom string

Size	Buffer size (in bytes)

Return Value

Number of bytes copied into Buffer;

0 if invalid atom specified


GetBitmapBits (API function)
GetBitmapBits (Windows API function)

Declaration

function GetBitmapBits(Bitmap: HBitmap; Count: Longint; Bits: Pointer): Longint;

Description

Copies the bits of a bitmap into Bits.

Parameters

Bitmap	Bitmap identifier

Count	Number of bytes to copy

Bits	Byte array which conforms to a structure where horizontal scan lines are multiples of 16 bits

Return Value

Actual number of bytes in the bitmap;

0 if error


GetBitmapDimension (API function)
GetBitmapDimension (Windows API function)

Declaration

function GetBitmapDimension(Bitmap: HBitmap): Longint;

Description

Retrieves the height and width of a bitmap.

Parameters

Bitmap	Bitmap identifier

Return Value

Height (in tenths of millimeters) in high word;

Width (in tenths of millimeters) in low word;

0 if dimensions have not been used

See Also

SetBitmapDimension


GetBkColor (API function)
GetBkColor (Windows API function)

Declaration

function GetBkColor(DC: HDC): Longint;

Description

Retrieves the current device background color.

Parameters

DC	Device context identifier

Return Value

RGB color value


GetBkMode (API function)
GetBkMode (Windows API function)

Declaration

function GetBkMode(DC: HDC): Integer;

Description

Retrieves the current device background mode, used for text, hatched brushes, and non-solid line pen styles.

Parameters

DC	Device context identifier

Return Value

One of the Background Modes constants


GetBrushOrg (API function)
GetBrushOrg (Windows API function)

Declaration

function GetBrushOrg(DC: HDC): Longint;

Description

Retrieves the current device brush origin.

Parameters

DC	Device context identifier

Return Value

X-coordinates in low word;

Y-coordinates in high word


GetBValue (API function)
GetBValue (Windows API function)

Declaration

function GetBValue(RGBColor: Longint): Byte;

Description

Extracts the blue intensity value from an RGB color value.

Parameters

RGBColor	An RGB color value

Return Value

The blue intensity value, from 0 to 255


GetCapture (API function)
GetCapture (Windows API function)

Declaration

function GetCapture: HWnd;

Description

Retrieves the window that is currently receiving all mouse input.

Return Value

Window that has the mouse capture;

0 if no window

See Also

SetCapture


GetCaretBlinkTime (API function)
GetCaretBlinkTime (Windows API function)

Declaration

function GetCaretBlinkTime: Word;

Description

Retrieves caret blink (time between flashes of the caret)

Return Value

Blink rate (in milliseconds)


GetCaretPos (API procedure)
GetCaretPos (Windows API procedure)

Declaration

procedure GetCaretPos(var Point: TPoint);

Description

Retrieves the current caret position (in client coordinates).

Parameters

Point	Receiving TPoint structure


GetCharWidth (API function)
GetCharWidth (Windows API function)

Declaration

function GetCharWidth(DC: HDC; FirstChar, LastChar: Word; var Buffer): Bool;

Description

Retrieves individual character widths for the specified group of consecutive characters.

Parameters

DC	Device context identifier

FirstChar	First character in consecutive character group

LastChar	Last character in consecutive character group

Buffer	Receiving integer array for width values

Return Value

Non-zero if successful;

0 if not


GetClassInfo (API function)
GetClassInfo (Windows API function)

Declaration

function GetClassInfo(Instance: THandle; ClassInfo: PChar; var WndClass: TWndClass): Bool;

Description

Retrieves class information for the specified class. TWndClass fields lpszClassName, lpszMenuName, and hInstance are not returned.

Parameters

Instance	Application instance that created the class or 0 for a predefined Windows class

ClassName	Class name (null-terminated) or ID

WndClass	TWndClass to receive class information

Return Value

Non-zero if successful;

0 if matching class not found


GetClassLong (API function)
GetClassLong (Windows API function)

Declaration

function GetClassLong(Wnd: HWnd; Index: Integer): Longint;

Description

Retrieves the long value at Index from a window's TWndClass structure. Positive byte offsets (from 0) to access extra class bytes.

Parameters

Wnd	Window identifier

Index	Byte offset or the constant gcl_WndProc

Return Value

Value retrieved


GetClassName (API function)
GetClassName (Windows API function)

Declaration

function GetClassName(Wnd: HWnd; ClassName: PChar; MaxCount: Integer): Integer;

Description

Retrieves a window's class name.

Parameters

Wnd	Window identifier

ClassName	Buffer to receive class name

MaxCount	Size of buffer

Return Value

Actual number of characters copied;

0 if error


GetClassWord (API function)
GetClassWord (Windows API function)

Declaration

function GetClassWord(Wnd: HWnd, Index: Integer): Word;

Description

Retrieves the word value at Index from a window's TWndClass structure. Positive byte offsets (from 0) to access extra class bytes.

Parameters

Wnd	Window identifier

Index	Byte offset or one of the gcw_ Class field offsets constants

Return Value

Value retrieved

See Also

SetClassWord


GetClientRect (API procedure)
GetClientRect (Windows API procedure)

Declaration

procedure GetClientRect(Wnd: HWnd; var Rect: TRect);

Description

Retrieves a window's client coordinates.

Parameters

Wnd	Window identifier

Rect	TRect to receive client coordinates


GetClipboardData (API function)
GetClipboardData (Windows API function)

Declaration

function GetClipboardData(Format: Word): THandle;

Description

Retrieves clipboard data in specified format. The returned memory block is controlled by the clipboard.

Parameters

Format	Clipboard data format; one of the cf_ Clipboard formats constants

Return Value

Memory block containing clipboard data;

0 if error

See Also

SetClipboardData


GetClipboardFormatName (API function)
GetClipboardFormatName (Windows API function)

Declaration

function GetClipboardFormatName(Format: Word; FormatName: PChar; MaxCount: Integer): Integer;

Description

Retrieves a registered format name from the clipboard.

Parameters

Format	Clipboard format; one of the cf_ Clipboard formats constants

FormatName	Receiving buffer

MaxCount	Size of buffer

Return Value

Actual length of copied string;

0 if invalid format requested


GetClipboardOwner (API function)
GetClipboardOwner (Windows API function)

Declaration

function GetClipboardOwner: HWnd;

Description

Retrieves the window that currently owns the clipboard.

Return Value

Owning window;

0 if no owner


GetClipboardViewer (API function)
GetClipboardViewer (Windows API function)

Declaration

function GetClipboardViewer: HWnd;

Description

Retrieves the first window in the clipboard-viewer chain.

Return Value

Window currently responsible for displaying the clipboard;

0 if no viewer


GetClipBox (API function)
GetClipBox (Windows API function)

Declaration

function GetClipBox(DC: HDC; var Rect: TRect): Integer;

Description

Retrieves the tightest bounding rectangle around the current clipping boundary.

Parameters

DC	Device context identifier

Rect	Receiving TRect structure

Return Value

One of the Region flags constants


GetCodeHandle (API function)
GetCodeHandle (Windows API function)

Declaration

function GetCodeHandle(Proc: TFarProc): THandle;

Description

Retrieves the code segment (loading it if necessary) that contains the specified function.

Parameters

Proc	Function's procedure-instance address

Return Value

Code segment that contains the function


GetCodeInfo (API procedure)
GetCodeInfo (Windows API procedure)

Declaration

procedure GetCodeInfo(Proc: TFarProc; SegInfo: Pointer);

Description

Retrieves information about the code segment containing Proc.

Parameters

Proc	Function address or module handle and segment number

SegInfo	Array of four 32-bit values


GetCommError (API function)
GetCommError (Windows API function)

Declaration

function GetCommError(Cid: Integer; var Stat: TComStat): Integer;

Description

Clears a devices communications error.

Parameters

Cid	Communications device

Stat	TComStat to receive device status information or nil

Return Value

One of the ce_ Comm error flags constants

See Also

OpenComm


GetCommEventMask(API function)
GetCommEventMask (Windows API function)

Declaration

function GetCommEventMask(Cid, EvtMask: Integer): Word;

Description

Retrieves a device's current event mask and then clears it.

Parameters

Cid	Communications device

EvtMask	Events to be enabled

Return Value

Current event mask value

See Also

OpenComm

SetCommEventMask


GetCommState (API function)
GetCommState (Windows API function)

Declaration

function GetCommState(Cid: Integer; var DCB: TDCB): Integer;

Description

Retrieves a device's device control block.

Parameters

Cid	Communications device

DCB	TDCB to receive the current device control block

Return Value

0 if successful;

negative if not

See Also

OpenComm


GetCurrentPDB (API function)
GetCurrentPDB (Windows API function)

Declaration

function GetCurrentPDB: Word;

Description

Retrieves the current DOS Program Data Base (PDB), also known as the Program Segment Prefix.

Return Value

Current PDB paragraph address or selector


GetCurrentPosition (API function)
GetCurrentPosition (Windows API function)

Declaration

function GetCurrentPosition(DC: HDC): Longint;

Description

Retrieves the logical coordinates of the current position.

Parameters

DC	Device context identifier

Return Value

X-coordinate in the low word;

Y-coordinate in the high word.


GetCurrentTask (API function)
GetCurrentTask (Windows API function)

Declaration

function GetCurrentTask :THandle;

Description

Retrieves handle of the currently executing task.

Return Value

Task identifier if successful;

0 if not


GetCurrentTime (API function)
GetCurrentTime (Windows API function)

Declaration

function GetCurrentTime: Longint;

Description

Retrieves elapsed time since the system was rebooted.

Return Value

Current time (in milliseconds)


GetCursorPos (API procedure)
GetCursorPos (Windows API procedure)

Declaration

procedure GetCursorPos(var Point: TPoint);

Description

Retrieves the screen coordinates of the cursor's current position.

Parameters

Point	Receiving TPoint structure


GetDC (API function)
GetDC (Windows API function)

Declaration

function GetDC(Wnd: HWnd): HDC;

Description

Retrieves a display context for performing GDI operations in a window's client area.

Parameters

Wnd	Window identifier

Return Value

Display context identifier;

0 if error

See Also

ReleaseDC


GetDCOrg (API function)
GetDCOrg (Windows API function)

Declaration

function GetDCOrg(DC: HDC): Longint;

Description

Retrieves a device's final translation origin (in screen coordinates) which is the offset used by Windows to translate device coordinates to client coordinates.

Parameters

DC	Device context identifier

Return Value

X-coordinate in the low word;

Y-coordinate in the high word.


GetDesktopWindow (API function)
GetDesktopWindow (Windows API function)

Declaration

function GetDesktopWindow: HWnd;

Description

Retrieves the handle to Windows desktop window.

Return Value

Windows desktop window identifier


GetDeviceCaps (API function)
GetDeviceCaps (Windows API function)

Declaration

function GetDeviceCaps(DC: HDC; Index: Integer): Integer;

Description

Retrieves a display's device-specific information.

Parameters

DC	Device context identifier

Index	Item to return (see Device capabilities)

Return Value

Desired item value


GetDialogBaseUnits (API function)
GetDialogBaseUnits (Windows API function)

Declaration

function GetDialogBaseUnits: Longint;

Description

Retrieves dialog base units. The base width represents the average system font width. The actual dialog unit is 1/4 and 1/8 the returned base width and height unit, respectively.

Return Value

Height (in pixels) base unit in high word

Width (in pixels) base unit in low word


GetDIBits (API function)
GetDIBits (Windows API function)

Declaration

function GetDIBits(DC: HDC; Bitmap: THandle; StartScan, NumScans: Word; Bits: Pointer; var BitInfo: TBitmapInfo; Usage: Word): Integer;

Description

Copies a bitmap, in device independent format, to Bits.

Parameters

DC	Device context identifier

Bitmap	Source bitmap identifier

StartScan	First scan line

NumScans	Number of lines to copy

Bits	Buffer to receive bitmap or nil to fill BitsInfo

BitInfo	TBitmapInfo containing color format and dimension of bitmap

Usage	Indicates the source of colors; one of the Dib_ Color table identifiers constants

Return Value

Number of scan lines copied;

0 if error


GetDlgCtrlID (API function)
GetDlgCtrlID (Windows API function)

Declaration

function GetDlgCtrlID(Wnd: HWnd): Integer;

Description

Retrieves a control window's ID value.

Parameters

Wnd	Control identifier

Return Value

Control's numeric identifier;

0 if error


GetDlgItem (API function)
GetDlgItem (Windows API function)

Declaration

function GetDlgItem(Dlg: HWnd; IDDlgItem: Integer): HWnd;

Description

Retrieves a control handle contained in the specified dialog box.

Parameters

Dlg	Dialog box containing the control

IDDlgItem	Control ID

Return Value

Control identifier;

0 if specified control does not exist


GetDlgItemInt (API function)
GetDlgItemInt (Windows API function)

Declaration

function GetDlgItemInt(Dlg: HWnd; IDDlgItem: Integer; Translate: LPBool; Signed: Bool): Word;

Description

Translates a control's text, in a dialog box, into an integer value. Preceding spaces are stripped.

Parameters

Dlg	Dialog box identifier

IDDlgItem	Item ID

Translate	Returned Bool value; 0 if translation error

Signed	Treat retrieved value as signed

Return Value

Translated value

See Also

wm_GetText


GetDlgItemText (API function)
GetDlgItemText (Windows API function)

Declaration

function GetDlgItemText(Dlg: HWnd; IDDlgItem: Integer; Str: PChar; MaxCount: Integer): Integer;

Description

Retrieves a control's text.

Parameters

Dlg	Dialog box identifier

IDDlgItem	Item ID

Str	Buffer to receive text

MaxCount	Size of buffer

Return Value

Actual number of characters copied

See Also

wm_GetText


GetDOSEnvironment (API function)
GetDOSEnvironment (Windows API function)

Declaration

function GetDOSEnvironment: PChar;

Description

Retrieves the current task's DOS environment string.

Return Value

Task's environment string


GetDoubleClickTime (API function)
GetDoubleClickTime (Windows API function)

Declaration

function GetDoubleClickTime: Word;

Description

Retrieves the maximum time between a series of two mouse clicks that constitutes a double-click.

Return Value

Current double-click time (in milliseconds)


GetDriveType (API function)
GetDriveType (Windows API function)

Declaration

function GetDriveType(Drive: Integer): Word;

Description

Determines whether Drive is removeable, fixed, or remote.

Parameters

Drive	Drive to check (i.e. A: is 0, B: is 1, etc.)

Return Value

One of the drive_ Drive types constants;

0 if cannot determine;

1 if does not exist


GetEnvironment (API function)
GetEnvironment (Windows API function)

Declaration

function GetEnvironment(PortName, Environ: PChar; MaxCount: Word): Integer;

Description

Retrieves the current environment for the device attached to the system port.

Parameters

PortName	Port name (null-terminated)

Environ	Buffer to receive environment (first field must contain device name) or nil to return required size

MaxCount	Size of buffer

Return Value

Actual number of bytes copied;

0 if environment cannot be found


GetFocus (API function)
GetFocus (Windows API function)

Declaration

function GetFocus: HWnd;

Description

Retrieves the window that currently has the input focus.

Return Value

Window identifier if successful;

0 if not


GetFreeSpace (API function)
GetFreeSpace (Windows API function)

Declaration

function GetFreeSpace(Flag: Word): Longint;

Description

Retrieves the amount of free memory in the global heap.

Parameters

Flag	The constant gmem_Not_Banked to scan below bank line or 0 to scan above; ignored for non-EMS systems

Return Value

Available memory (in bytes)

See Also

GlobalCompact


GetGValue (API function)
GetGValue (Windows API function)

Declaration

function GetGValue(RGBColor: Longint): Byte;

Description

Extracts the green intensity value from an RGB color value.

Parameters

RGBColor	An RGB color value

Return Value

The green intensity value, from 0 to 255


GetInputState (API function)
GetInputState (Windows API function)

Declaration

function GetInputState: Bool;

Description

Determines whether the system queue currently contains mouse, keyboard, or timer events.

Return Value

Non-zero if input detected;

0 if not


GetInstanceData (API function)
GetInstanceData (Windows API function)

Declaration

function GetInstanceData(Instance: THandle; Data, Count: Word): Integer;

Description

Copies a previous instance data into Data.

Parameters

Instance	Previous application's instance identifier

Data	Receiving buffer

Count	Size of buffer

Return Value

Actual number of bytes copied


GetKBCodePage (API function)
GetKBCodePage (Windows API function)

Declaration

function GetKBCodePage: Integer;

Description

Retrieves the currently loaded OEM/ANSI table.

Return Value

Current code page:

(437) USA,

(850) International,

(860) Portugal,

(861) Iceland,

(863) French Canadian,

(865) Norway/Denmark


GetKeyboardState  (API procedure)
GetKeyboardState (Windows API procedure)

Declaration

procedure GetKeyboardState(var KeyState: Byte);

Description

Copies the virtual-keyboard key set status into KeyState. If high-bit of byte is 1, key is down. If low-bit is 1, key was pressed odd number of times since system startup.

Parameters

KeyState	256 byte character array


GetKeyboardType (API function)
GetKeyboardType (Windows API function)

Declaration

function GetKeyboardType(TypeFlag: Integer): Integer;

Description

Retrieves the system keyboard type.

Parameters

TypeFlag	0 (keyboard type), 1 (keyboard subtype), 2 (number of function keys--FK)

Return Value

1 (PC/XT, 10 FKs)

2 (Olivetti M24, 12 FKs)

3 (AT, 10 FKs)

4 (Enhanced, 12 FKs)

5 (Nokia 1050, 10 FKs)

6 (Nokia 9140, 24 FKs)


GetKeyNameText (API function)
GetKeyNameText (Windows API function)

Declaration

function GetKeyNameText(lParam: Longint; Buffer: PChar; Size: Integer): Integer;

Description

Retrieves key name string for keys longer than a single character.

Parameters

lParam	Long parameter to wm_KeyDown message

Buffer	Receiving buffer

Size	Size of buffer

Return Value

Actual number of bytes copied


GetKeyState (API function)
GetKeyState (Windows API function)

Declaration

function GetKeyState(VirtKey: Integer): Integer;

Description

Retrieves whether the state of a virtual key is up, down, or toggled.

Parameters

VirtKey	Virtual key

Return Value

Key is down if high-order bit is 1 and key is toggled if low-order bit is 1


GetLastActivePopup (API function)
GetLastActivePopup (Windows API function)

Declaration

function GetLastActivePopup(WndOwner: HWnd): HWnd;

Description

Retrieves the most recently active popup.

Parameters

WndOwner	Owning parent window of popup

Return Value

Popup window identifier; WndOwner


GetMapMode (API function)
GetMapMode (Windows API function)

Declaration

function GetMapMode(DC: HDC): Integer;

Description

Retrieves current mapping mode.

Parameters

DC	Device context identifier

Return Value

A mm_ Mapping modes constant

See Also

SetMapMode


GetMenu (API function)
GetMenu (Windows API function)

Declaration

function GetMenu(Wnd: HWnd): HMenu;

Description

Retrieves a window's menu handle.

Parameters

Wnd	Owning window of menu

Return Value

Menu identifier;

0 if no menu;

undefined if Wnd is a child window


GetMenuCheckMarkDimensions (API function)
GetMenuCheckMarkDimensions (Windows API function)

Declaration

function GetMenuCheckMarkDimensions: Longint;

Description

Retrieves the dimensions of the default checkmark bitmap which is displayed next to checked menu items.

Return Value

Height (in pixels) in the high-order word;

Width (in pixels) in the low order word.

See Also

SetMenuItemBitmaps


GetMenuItemCount (API function)
GetMenuItemCount (Windows API function)

Declaration

function GetMenuItemCount(Menu: HMenu): Word;

Description

Retrieves the number of top-level menus and menu items in the specified menu.

Parameters

Menu	The menu identifier

Return Value

The number of menu items, if successful;

-1 if unsuccessful


GetMenuItemID (API function)
GetMenuItemID (Windows API function)

Declaration

function GetMenuItemID(Menu: HMenu; Pos: Integer): Word;

Description

Retrieves the menu item numeric ID located at the specified position in the menu.

Parameters

Menu	Popup menu identifier

Pos	Item position, starting at 0, in menu

Return Value

Item ID if successful;

0 if item is a popup;

-1 if error


GetMenuState (API function)
GetMenuState (Windows API function)

Declaration

function GetMenuState(Menu: HMenu; ID, Flags: Word): Word;

Description

Retrieves state information for the specified menu item.

Parameters

Menu	Menu or popup menu identifier

ID	Menu item ID

Flags	One of the mf_ Menu flags constants:

mf_ByPosition

mf_ByCommand

Return Value

Flags mask of the following mf_ Menu flags values:

mf_Checked

mf_Disabled

mf_Enabled

mf_MenuBarBreak

mf_MenuBreak

mf_Separator

mf_Unchecked

If popup, high-order byte contains number of items;

-1 if ID is invalid


GetMenuString (API function)
GetMenuString (Windows API function)

Declaration

function GetMenuString(Menu: HMenu; IDItem: Word; Str: PChar; MaxCount: Integer; Flag: Word): Integer;

Description

Copies a menu item's label into Str. The copied label is null-terminated.

Parameters

Menu	Menu identifier

IDItem	Menu item ID

Str	Receiving buffer

MaxCount	Size of buffer

Flag	One of the mf_ Menu flags constants:

mf_ByPosition

mf_ByCommand

Return Value

Actual number of bytes copied


GetMessage (API function)
GetMessage (Windows API function)

Declaration

function GetMessage(var Msg: TMsg; Wnd: HWnd; MsgFilterMin, MsgFilterMax: Word): Bool;

Description

Retrieves a message, within filter range, from the applications message queue. Yields control to other applications if no messages available or wm_Paint, or wm_Timer is the next message.

Parameters

Msg	Receiving TMsg structure

Wnd	Message destination window or 0 for all windows in application

MsgFilterMin	0 for no filtering or wm_KeyFirst for keyboard only or wm_MouseFirst for mouse only

MsgFilterMax	0 for no filtering or wm_KeyLast for keyboard only or wm_MouseLast for mouse only

Return Value

Non-zero if not wm_Quit message;

0 otherwise


GetMessagePos (API function)
GetMessagePos (Windows API function)

Declaration

function GetMessagePos: Longint;

Description

Retrieves the cursor position for the last message obtained from GetMessage.

Return Value

X-coordinates in low word;

Y-coordinates in high word


GetMessageTime (API function)
GetMessageTime (Windows API function)

Declaration

function GetMessageTime: Longint;

Description

Retrieves the elapsed time since system reboot for the last message obtained from GetMessage.

Return Value

Message time (in milliseconds)


GetMetaFile (API function)
GetMetaFile (Windows API function)

Declaration

function GetMetaFile(FileName: PChar): THandle;

Description

Creates a handle for the named metafile.

Parameters

FileName	Metafile DOS filename (null-terminated)

Return Value

Metafile identifier if successful;

0 if not


GetMetaFileBits (API function)
GetMetaFileBits (Windows API function)

Declaration

function GetMetaFileBits(MF: THandle): THandle;

Description

Obtains a read-only global memory block containing the metafile as a collection of bits. Used to determine size and save as metafile.

Parameters

MF	Memory metafile identifier, becomes invalid after call

Return Value

Global memory block if successful;

0 if not


GetModuleFileName (API function)
GetModuleFileName (Windows API function)

Declaration

function GetModuleFileName(Module: THandle; FileName: PChar; Size: Integer): Integer;

Description

Retrieves full pathname (null-terminated) of the executable file for the specified module.

Parameters

Module	Module identifier

FileName	Receiving buffer

Size	Size of buffer

Return Value

Actual number of bytes copied


GetModuleHandle (API function)
GetModuleHandle (Windows API function)

Declaration

function GetModuleHandle(ModuleName: PChar): THandle;

Description

Retrieves a module's handle.

Parameters

ModuleName	Module name (null-terminated)

Return Value

Module identifier if successful;

0 if not


GetModuleUsage (API function)
GetModuleUsage (Windows API function)

Declaration

function GetModuleUsage(Module: THandle): Integer;

Description

Retrieves a module's reference count.

Parameters

Module	Module identifier

Return Value

Reference count value


GetNearestColor (API function)
GetNearestColor (Windows API function)

Declaration

function GetNearestColor(DC: HDC; Color: TColorRef): Longint;

Description

Obtains the closest matching logical color to Color that the device can support.

Parameters

DC	Device context identifier

Color	TColorRef to be matched

Return Value

RGB solid color


GetNearestPaletteIndex (API function)
GetNearestPaletteIndex (Windows API function)

Declaration

function GetNearestPaletteIndex(Palette: HPalette; Color: TColorRef): Word;

Description

Obtains the closest matching color in a logical-palette to Color.

Parameters

Palette	Logical palette identifier

Color	TColorRef to be matched

Return Value

Logical-palette entry index


GetNextDlgGroupItem (API function)
GetNextDlgGroupItem (Windows API function)

Declaration

function GetNextDlgGroupItem(Dlg: HWnd; Ctrl: HWnd; Previous: Bool): HWnd;

Description

Retrieves the next or previous ws_Group style control from Ctrl. The search is cyclical.

Parameters

Dlg	Dialog box identifier

Ctrl	Search start control identifier

Previous	0 to search for previous control or non-zero to search for next

Return Value

Control identifier


GetNextDlgTabItem (API function)
GetNextDlgTabItem (Windows API function)

Declaration

function GetNextDlgTabItem(Dlg: HWnd; Ctrl: HWnd; Previous: Bool): HWnd;

Description

Retrieves the next or previous ws_TabStop style control from Ctrl. The search is cyclical.

Parameters

Dlg	Dialog box identifier

Ctrl	Search start control identifier

Previous	0 to search for previous control or non-zero to search for next

Return Value

Control identifier


GetNextWindow (API function)
GetNextWindow (Windows API function)

Declaration

function GetNextWindow(Wnd: HWnd; Flag: Word): HWnd;

Description

Retrieves next or previous window from Wnd. If top-level window searches for next top-level window or if child window searches for next child window.

Parameters

Wnd	Window identifier

Flag	One of the gw_ Get window constants:

gw_HWndNext

gw_HWndPrev

Return Value

Window identifier


GetNumTasks (API function)
GetNumTasks (Windows API function)

Declaration

function GetNumTasks: Word;

Description

Retrieves number of tasks that are currently executing in the system.

Return Value

Number of currently executing tasks


GetObject (API function)
GetObject (Windows API function)

Declaration

function GetObject(hObject: THandle; Count: Integer; ObjectPtr: Pointer): Integer;

Description

Fills a buffer with data that defines a logical object. Only returns number of entries for logical palettes.

Parameters

hObject	Object identifier

Count	Number of bytes to copy into ObjectPtr

ObjectPtr	Receiving buffer; TLogPen, TLogBrush, TLogFont, TBitmap, or an integer

Return Value

Actual number of bytes copied;

0 if error

See Also

GetBitmapBits

GetPaletteEntries


GetPaletteEntries (API function)
GetPaletteEntries (Windows API function)

Declaration

function GetPaletteEntries(Palette: HPalette; StartIndex, NumEntries: Word; var PaletteEntries): Word;

Description

Retrieves the specified range of palette entries and copies them to PaletteEntries.

Parameters

Palette	Logical palette identifier

StartIndex	First entry

NumEntries	Number of entries

PaletteEntries	TPaletteEntry array to receive the palette entries

Return Value

Actual number of entries retrieved;

0 if error


GetParent (API function)
GetParent (Windows API function)

Declaration

function GetParent(Wnd: HWnd): HWnd;

Description

Retrieves a window's parent window handle.

Parameters

Wnd	Window identifier

Return Value

Parent window identifier;

0 if no parent window


GetPixel (API function)
GetPixel (Windows API function)

Declaration

function GetPixel(DC: HDC; X, Y; Integer): Longint;

Description

Retrieves the RGB color at the specified point.

Parameters

DC	Device context identifier

X, Y	Point to be examined

Return Value

RGB color value;

-1 if point not in clipping region


GetPolyFillMode (API function)
GetPolyFillMode (Windows API function)

Declaration

function GetPolyFillMode(DC: HDC): Integer;

Description

Retrieves the current polygon filling mode.

Parameters

DC	Device context identifier

Return Value

Polygon filling mode; one of the PolyFill modes constants


GetPriorityClipboardFormat (API function)
GetPriorityClipboardFormat (Windows API function)

Declaration

function GetPriorityClipboardFormat(var PriorityList; Count: Integer): Integer;

Description

Retrieves the first clipboard format in PriorityList for which data exists.

Parameters

PriorityList	Integer array containing clipboard formats in priority order; the formats are cf_ Clipboard formats

Count	Size of PriorityList

Return Value

Highest priority format in list;

-1 if no match;

0 if no data in the clipboard


GetPrivateProfileInt (API function)
GetPrivateProfileInt (Windows API function)

Declaration

function GetPrivateProfileInt(ApplicationName, KeyName: PChar; Default: Integer; FileName: PChar): Word;

Description

Retrieves an integer key value from the specified initialization file.

Parameters

ApplicationName	Application heading name in FileName

KeyName	Key name in FileName

Default	Default value if KeyName not found

FileName	Initialization filename in Windows directory

Return Value

Key value;

0 if negative or not an integer


GetPrivateProfileString (API function)
GetPrivateProfileString (Windows API function)

Declaration

function GetPrivateProfileString(ApplicationName, KeyName, Default, ReturnedString: PChar; Size: Integer; FileName: PChar): Integer;

Description

Retrieves a string key value from the specified initialization file.

Parameters

ApplicationName	Application heading name in FileName

KeyName	Key name in FileName or nil to obtain list of key names

Default	Default value if KeyName not found

ReturnedString	Receiving buffer

Size	Size of buffer

FileName	Initialization filename in Windows directory

Return Value

Actual number of characters copied


GetProcAddress (API function)
GetProcAddress (Windows API function)

Declaration

function GetProcAddress(Module: THandle; ProcName: PChar): TFarProc;

Description

Retrieves the address of an exported library function.

Parameters

Module	Library module

ProcName	Function name (null-terminated) or ordinal name

Return Value

Function's entry point if successful;

0 if not


GetProfileInt (API function)
GetProfileInt (Windows API function)

Declaration

function GetProfileInt(AppName, KeyName: PChar; Default: Integer): Word;

Description

Retrieves an integer key value from Windows WIN.INI file.

Parameters

AppName	Application heading name

KeyName	Search key name

Default	Default value if KeyName not found

Return Value

Key value;

0 if negative or not an integer


GetProfileString (API function)
GetProfileString (Windows API function)

Declaration

function GetProfileString(AppName, KeyName, Default, ReturnedString: PChar; Size: Integer): Integer;

Description

Retrieves a string key value from Windows WIN.INI file.

Parameters

AppName	Application heading name

KeyName	Search key name or nil to obtain all key names associated with AppName

Default	Default value if KeyName not found

ReturnedString	Receiving buffer

Size	Size of buffer

Return Value

Actual number of characters copied


GetProp (API function)
GetProp (Windows API function)

Declaration

function GetProp(Wnd: HWnd; Str: PChar): THandle;

Description

Retrieves the associated data handle from a window's property list.

Parameters

Wnd	Window identifier

Str	String (null-terminated) or Atom

Return Value

Data handle if property list contains Str;

0 if not

See Also

AddAtom


GetROP2 (API function)
GetROP2 (Windows API function)

Declaration

function GetROP2(DC: HDC): Integer;

Description

Retrieves the current drawing mode.

Parameters

DC	Raster device context

Return Value

Drawing mode; one of the r2_ Binary raster operations constants

See Also

SetROP2


GetRgnBox (API function)
GetRgnBox (Windows API function)

Declaration

function GetRgnBox(Rgn: HRgn; var Rect: TRect): Integer;

Description

Retrieves a region's bounding rectangle.

Parameters

Rgn	Region identifier

Rect	Receiving TRect

Return Value

Regions type, one of the Region flags:

ComplexRegion

NullRegion

SimpleRegion

0 if invalid region


GetRValue (API function)
GetRValue (Windows API function)

Declaration

function GetRValue(RGBColor: Longint): Byte;

Description

Extracts the red intensity value from an RGB color value.

Parameters

RGBColor	An RGB color value

Return Value

The red intensity value, from 0 to 255


GetScrollPos (API function)
GetScrollPos (Windows API function)

Declaration

function GetScrollPos(Wnd: HWnd; Bar: Integer): Integer;

Description

Retrieves current position of a scroll bar thumb relative to the current scrolling range.

Parameters

Wnd	Window containing scroll bar

Bar	One of the sb_ Scroll bar constants

Return Value

Current scroll bar thumb position


GetScrollRange (API procedure)
GetScrollRange (Windows API procedure)

Declaration

procedure GetScrollRange(Wnd: HWnd; Bar: Integer; var MinPos, MaxPos: Integer);

Description

Retrieves a scroll bar's minimum and maximum positions.

Parameters

Wnd	Window containing scroll bar

Bar	One of the sb_ Scroll bar constants

MinPos	Integer to receive minimum position

MaxPos	Integer to receive maximum position


GetStockObject (API function)
GetStockObject (Windows API function)

Declaration

function GetStockObject(Index: Integer): THandle;

Description

Retrieves a handle to a predefined stock pen, brush, or font.

Parameters

Index	One of the Stock logical objects constants

Return Value

Desired logical object identifier if successful;

0 if not


GetStretchBltMode (API function)
GetStretchBltMode (Windows API function)

Declaration

function GetStretchBltMode(DC: HDC): Integer;

Description

Retrieves the current stretching mode.

Parameters

DC	Device context identifier

Return Value

One of the StretchBlt modes constants

See Also

SetStretchBltMode


GetSubMenu (API function)
GetSubMenu (Windows API function)

Declaration

function GetSubMenu(Menu: HMenu; Pos: Integer): HMenu;

Description

Retrieves a popup menu's handle.

Parameters

Menu	Menu identifier

Pos	Position of popup menu in Menu

Return Value

Popup menu identifier;

0 if no popup exists at Pos


GetSysColor (API function)
GetSysColor (Windows API function)

Declaration

function GetSysColor(Index: Integer): Longint;

Description

Retrieves a Windows display element's current color.

Parameters

Index	Display element

Return Value

RGB color value

See Also

SetSysColors


GetSysModalWindow (API function)
GetSysModalWindow (Windows API function)

Declaration

function GetSysModalWindow: HWnd;

Description

Retrieves the current system-modal window's handle.

Return Value

System-modal window identifier if one is present;

0 if not


GetSystemDirectory (API procedure)
GetSystemDirectory (Windows API procedure)

Declaration

procedure GetSystemDirectory(Buffer: PChar; Size: Word);

Description

Obtains the Windows system subdirectory pathname.

Parameters

Buffer	Receiving buffer

Size	Size of Buffer (at least 144 characters)


GetSystemMenu (API function)
GetSystemMenu (Windows API function)

Declaration

function GetSystemMenu(Wnd: HWnd; Revert: Bool): HMenu;

Description

Retrieves a window's system menu for copying and modification.

Parameters

Wnd	Window identifier

Revert	0 to return handle to a copy of the system menu or non-zero to return handle to original system menu

Return Value

System menu identifier;

0 if Revert is non-zero and system menu has not been modified

See Also

AppendMenu

InsertMenu

ModifyMenu


GetSystemMetrics (API function)
GetSystemMetrics (Windows API function)

Declaration

function GetSystemMetrics(Index: Integer): Integer;

Description

Retrieves system metrics, such as pixel width and heights of various display elements, mouse status, and Windows debug version.

Parameters

Index	One of the sm_ System metrics codes constants

Return Value

Requested system metric value


GetSystemPaletteEntries (API function)
GetSystemPaletteEntries (Windows API function)

Declaration

function GetSystemPaletteEntries(DC: HDC; StartIndex, NumEntries: Word; var PaletteEntries: TPaletteEntry): Word;

Description

Retrieves a range of palette entries from the system palette.

Parameters

DC	Device context identifier

StartIndex	First entry to retrieve

NumEntries	Number of entries to retrieve

PaletteEntries	Receiving TPaletteEntry array

Return Value

Actual number of entries retrieved;

0 if error


GetSystemPaletteUse (API function)
GetSystemPaletteUse (Windows API function)

Declaration

function GetSystemPaletteUse(DC: HDC): Word;

Description

Determines whether an application has full access to the system palette.

Parameters

DC	Device context identifier

Return Value

One of the syspal_ System palette flags

See Also

SetSystemPaletteUse


GetTabbedTextExtent (API function)
GetTabbedTextExtent (Windows API function)

Declaration

function GetTabbedTextExtent(DC: HDC; Str: PChar; Count, TabPositions: Integer; var TabStopPositions): Longint;

Description

Computes the height and width (in pixels) of Str using the currently selected font. Tabs are expanded as specified.

Parameters

DC	Device context identifier

Str	Line of text

Count	Number of characters in Str

TabPositions	Number of tab-stop positions in TabStopPositions or 0 and tabs are expanded eight average character widths

TabStopPositions	Integer array containing increasing order of tab-stop positions (in pixels)

Return Value

Height in high-order word;

Width in low-order word


GetTempDrive (API function)
GetTempDrive (Windows API function)

Declaration

function GetTempDrive(DriveLetter: Char): Char;

Description

Retrieves the disk-drive that will provide optimal access time for temporary file operations.

Parameters

DriveLetter	Disk-drive letter or 0 to return current drive

Return Value

Disk-drive letter


GetTempFileName (API function)
GetTempFileName (Windows API function)

Declaration

function GetTempFileName(DriveLetter: Char; PrefixString: PChar; Unique: Word; TempFileName: PChar): Integer;

Description

Derives a unique temporary filename whose pathname is either the root directory or that specified by the TEMP environment variable.

Parameters

DriveLetter	Suggested drive or tf_ForceDrive bit-or-ed with suggested drive or 0 for default drive

PrefixString	FileName three character prefix (null-terminated)

Unique	Base filename numeric value or 0 for system derived value

TempFileName	Receiving pathname buffer (at least 144 bytes long)

Return Value

Filename's unique numeric value


GetTextAlign (API function)
GetTextAlign (Windows API function)

Declaration

function GetTextAlign(DC: HDC): Word;

Description

Retrieves text-alignment flags.

Parameters

DC	Device context identifier

Return Value

Combination of ta_ Text alignment options flags

See Also

TextOut

ExtTextOut


GetTextCharacterExtra (API function)
GetTextCharacterExtra (Windows API function)

Declaration

function GetTextCharacterExtra(DC: HDC): Integer;

Description

Retrieves extra space (in logical units) added to each character as it is written in a line.

Parameters

DC	Device context identifier

Return Value

Current inter-character spacing

See Also

TextOut

ExtTextOut


GetTextColor (API function)
GetTextColor (Windows API function)

Declaration

function GetTextColor(DC: HDC): Longint;

Description

Retrieves the current foreground color used to draw characters.

Parameters

DC	Device context

Return Value

RGB color value

See Also

TextOut

ExtTextOut


GetTextExtent (API function)
GetTextExtent (Windows API function)

Declaration

function GetTextExtent(DC: HDC; Str: PChar; Count: Integer): Longint;

Description

Computes dimensions of Str based on the currently selected font.

Parameters

DC	Device context identifier

Str	Line of text

Count	Number of characters in Str

Return Value

Height (in logical units) in high word;

Width (in logical units) in low word


GetTextFace (API function)
GetTextFace (Windows API function)

Declaration

function GetTextFace(DC: HDC; Count: Integer; Facename: PChar): Integer;

Description

Copies selected font's typeface name to Facename.

Parameters

DC	Device context identifier

Count	Size of Facename

Facename	Receiving buffer

Return Value

Actual number of bytes copied


GetTextMetrics (API function)
GetTextMetrics (Windows API function)

Declaration

function GetTextMetrics(DC: HDC; var Metrics: TTextMetric): Bool;

Description

Retrieves metrics of the currently selected font in Metrics.

Parameters

DC	Device context identifier

Metrics	Receiving TTextMetric structure

Return Value

Non-zero if successful;

0 if not


GetThresholdEvent (API function)
GetThresholdEvent (Windows API function)

Declaration

function GetThresholdEvent: LPInteger;

Description

Retrieves a recent threshold event.

Return Value

Pointer to threshold event


GetThresholdStatus (API function)
GetThresholdStatus (Windows API function)

Declaration

function GetThresholdStatus: Integer;

Description

Retrieves threshold event status where each set bit represents a voice-queue level currently below threshold.

Return Value

Current threshold event status flags


GetTickCount (API function)
GetTickCount (Windows API function)

Declaration

function GetTickCount: Longint;

Description

Retrieves the elapsed time since system was started.

Return Value

Elapsed time (in milliseconds)


GetTopWindow (API function)
GetTopWindow (Windows API function)

Declaration

function GetTopWindow(Wnd: HWnd): HWnd;

Description

Retrieves a window's top-level child window.

Parameters

Wnd	Parent window identifier

Return Value

Child window identifier;

0 if does not exist


GetUpdateRect (API function)
GetUpdateRect (Windows API function)

Declaration

function GetUpdateRect(Wnd: HWnd; var Rect: TRect; Erase: Bool): Bool;

Description

Receives into Rect, the smallest enclosing rectangle of a window's update region.

Parameters

Wnd	Window identifier

Rect	Receiving TRect structure

Erase	Non-zero to erase update region background

Return Value

Non-zero if non-empty update region;

0 if otherwise

See Also

wm_EraseBkgnd


GetUpdateRgn (API function)
GetUpdateRgn (Windows API function)

Declaration

function GetUpdateRgn(Wnd: HWnd; Rgn: HRgn; Erase: Bool): Integer;

Description

Copies into Rgn a window's update region.

Parameters

Wnd	Window identifier

Rgn	Receiving update region

Erase	Non-zero if background should be erased and child windows redrawn

Return Value

One of the Region flags constants


GetVersion (API function)
GetVersion (Windows API function)

Declaration

function GetVersion: Word;

Description

Retrieves Window's current version number.

Return Value

Minor version number in high-order byte

Major version number in low-order byte


GetViewportExt (API function)
GetViewportExt (Windows API function)

Declaration

function GetViewportExt(DC: HDC): Longint;

Description

Retrieves the viewport extents of a device context.

Parameters

DC	Device context identifier

Return Value

X extents (in device units) in low-order word;

Y extents (in device units) in high-order word


GetViewportOrg (API function)
GetViewportOrg (Windows API function)

Declaration

function GetViewportOrg(DC: HDC): Longint;

Description

Retrieves the viewport origin of a device context.

Parameters

DC	Device context identifier

Return Value

X-coordinate (in device units) in low-order word;

Y-coordinate (in device units) in high-order word


GetWindow (API function)
GetWindow (Windows API function)

Declaration

function GetWindow(Wnd: HWnd; Cmd: Word): HWnd;

Description

Retrieves the window with the relationship specified in Cmd to the window specified in Wnd.

Parameters

Wnd	Original window

Cmd	One of the gw_ Get window constants

Return Value

Window identifier;

0 if not found or invalid Cmd


GetWindowDC (API function)
GetWindowDC (Windows API function)

Declaration

function GetWindowDC(Wnd: HWnd): HDC;

Description

Retrieves a display context typically used for painting non-client areas of a window.

Parameters

Wnd	Window identifier

Return Value

Display context identifier;

0 if error.

See Also

ReleaseDC


GetWindowExt (API function)
GetWindowExt (Windows API function)

Declaration

function GetWindowExt(DC: HDC): Longint;

Description

Retrieves a window's extents.

Parameters

DC	Device context identifier

Return Value

X extents (in device units) in low-order word;

Y extents (in device units) in high-order word


GetWindowLong (API function)
GetWindowLong (Windows API function)

Declaration

function GetWindowLong(Wnd: HWnd; Index: Integer): Longint;

Description

Retrieves information about a window or a window's extra byte values.

Parameters

Wnd	Window identifier

Index	Byte offset or one of the gwl_ Window field offsets

Return Value

Specified window information


GetWindowOrg (API function)
GetWindowOrg (Windows API function)

Declaration

function GetWindowOrg(DC: HDC): Longint;

Description

Retrieves a window's origin.

Parameters

DC	Device context identifier

Return Value

X-coordinates (in logical coordinates) n low word;

Y-coordinates (in logical coordinates) n high word


GetWindowRect (API procedure)
GetWindowRect (Windows API procedure)

Declaration

procedure GetWindowRect(Wnd: HWnd; var Rect: TRect);

Description

Retrieves the dimensions of a window's bounding rectangle into Rect (in screen coordinates).

Parameters

Wnd	Window identifier

Rect	Receiving TRect structure


GetWindowsDirectory (API procedure)
GetWindowsDirectory (Windows API procedure)

Declaration

function GetWindowsDirectory(Buffer: PChar; Size: Word): Word;

Description

Retrieves the Windows directory path name into Buffer.

Parameters

Buffer	Receiving path name buffer

Size	Size of Buffer (should be at least 144 bytes long)

Return Value

Length of the string copied into Buffer


GetWindowTask (API function)
GetWindowTask (Windows API function)

Declaration

function GetWindowTask(Wnd: HWnd): THandle;

Description

Retrieves a window's application task identifier.

Parameters

Wnd	Window identifier

Return Value

Task identifier


GetWindowText (API function)
GetWindowText (Windows API function)

Declaration

function GetWindowText(Wnd: HWnd; Str: PChar; MaxCount: Integer): Integer;

Description

Copies a window's caption or a control's text into Str.

Parameters

Wnd	Window or control identifier

Str	Receiving string buffer

MaxCount	Size of Str

Return Value

Actual number of bytes copied;

0 if no text


GetWindowTextLength (API function)
GetWindowTextLength (Windows API function)

Declaration

function GetWindowTextLength(Wnd: HWnd): Integer;

Description

Retrieves a window's caption or a control's text length.

Parameters

Wnd	Window or control identifier

Return Value

Text length


GetWindowWord (API function)
GetWindowWord (Windows API function)

Declaration

function GetWindowWord(Wnd: HWnd; Index: Integer): Word;

Description

Retrieves information about a window or window-class extra byte values.

Parameters

Wnd	Window identifier

Index	Positive byte offset or one of the gww_ Window field offsets constants

Return Value

Word value


GetWinFlags(API function)
GetWinFlags (Windows API function)

Declaration

function GetWinFlags: Longint;

Description

Retrieves memory configuration flags which Windows is running.

Return Value

Flag mask specifying the current memory configuration; can include one of the following wf_ Windows memory configuration flags:

wf_CPU286

wf_CPU386

wf_PMode

wf_SmallFrame

wf_Win286

wf_Win386


GlobalAddAtom (API function)
GlobalAddAtom (Windows API function)

Declaration

function GlobalAddAtom(Str: PChar): Atom;

Description

Adds Str to the atom table, creating a new global atom.

Parameters

Str	String (null-terminated)

Return Value

Newly created atom;

0 if error


GlobalAlloc (API function)
GlobalAlloc (Windows API function)

Declaration

function GlobalAlloc(Flags: Word; Bytes: Longint): THandle;

Description

Allocates memory of at least the requested size from the global heap.

Parameters

Flags	Flag mask; one or more of the gmem_ Global memory flags constants

Bytes	Number of bytes to allocate

Return Value

Allocated global memory identifier;

0 if error

See Also

GlobalSize


GlobalCompact (API function)
GlobalCompact (Windows API function)

Declaration

function GlobalCompact(MinFree: Longint): Longint;

Description

Compacts global memory and, if necessary, removes discardable segments to create a MinFree size block, if possible.

Parameters

MinFree	Desired free bytes or 0 to return largest free segment if all discardable segments are removed

Return Value

Size of largest free block


GlobalDeleteAtom (API function)
GlobalDeleteAtom (Windows API function)

Declaration

function GlobalDeleteAtom(AnAtom: Atom): Atom;

Description

Decreases a global atom's reference count by one, deleting the atom and associated string from the atom table if the reference count becomes 0.

Parameters

AnAtom	Atom identifier

Return Value

0 if successful;

AnAtom if not


GlobalDiscard (API function)
GlobalDiscard (Windows API function)

Declaration

function GlobalDiscard(Mem: THandle): THandle;

Description

Discards the specified global memory block if the block is discardable and unlocked.

Parameters

Mem	The handle of the global memory block to discard

Return Value

Handle of the block if successfully discarded;

0 otherwise


GlobalDosAlloc (API function)
GlobalDosAlloc (Windows API function)

Declaration

function GlobalDosAlloc(Bytes: LongInt): Longint;

Description

Allocates global memory in the first megabyte of linear address space that can be accessed by DOS.

Use of this function should be avoided if possible, as low memory is a scarce system resource.

Parameters

Bytes	The number of bytes to allocate

Return Value

0 if memory could not be allocated

Otherwise, the value is a paragraph-segment value in the high-order word and a selector in the low-order word. In real mode, the paragraph-segment value can be used to access the allocated memory. In protected mode, the selector should be used.


GlobalDosFree (API function)
GlobalDosFree (Windows API function)

Declaration

function GlobalDosFree(Selector: Word): Word;

Description

Frees a block of memory allocated by GlobalDosAlloc.

Parameters

Selector	The selector of the memory to free

Return Value

0 if successful;

selector if not


GlobalFindAtom (API function)
GlobalFindAtom (Windows API function)

Declaration

function GlobalFindAtom(Str: PChar): Atom;

Description

Retrieves the global atom associated with Str.

Parameters

Str	Search string (null-terminated)

Return Value

Global atom;

0 if Str not in table


GlobalFix (API procedure)
GlobalFix (Windows API procedure)

Declaration

procedure GlobalFix(Mem: THandle);

Description

Fixes a global memory block in memory and increases it lock reference count by one.

Parameters

Mem	Global memory block identifier

See Also

GlobalUnfix


GlobalFlags (API function)
GlobalFlags (Windows API function)

Declaration

function GlobalFlags(Mem: THandle): Word;

Description

Retrieves information about Mem.

Parameters

Mem	Global memory block identifier

Return Value

In high byte: em_Ddeshare, gmem_Discardable, gmem_Discarded, or gmem_Not_Banked;

In low byte: lock reference-count

See Also

gmem_ Global memory flags


GlobalFree (API function)
GlobalFree (Windows API function)

Declaration

function GlobalFree(Mem: THandle): THandle;

Description

Frees an unlocked global memory block and invalidates its handle.

Parameters

Mem	Global memory block identifier

Return Value

0 if successful;

Mem if not


GlobalGetAtomName (API function)
GlobalGetAtomName (Windows API function)

Declaration

function GlobalGetAtomName(AnAtom: Atom; Buffer: PChar; Size: Integer): Word;

Description

Copies the string associated with AnAtom into Buffer.

Parameters

AnAtom	Atom identifier

Buffer	Receive buffer

Size	Size of Buffer

Return Value

Actual number of bytes copied;

0 if AnAtom not valid


GlobalHandle (API function)
GlobalHandle (Windows API function)

Declaration

function GlobalHandle(Mem: Word): Longint;

Description

Retrieves the handle of a global memory object with the specified segment address.

Parameters

Mem	Segment address

Return Value

Handle and segment address in low- and high-word, respectively;

0 if does not exist


GlobalLock (API function)
GlobalLock (Windows API function)

Declaration

function GlobalLock(Mem: THandle): Pointer;

Description

Increments the reference count of a global memory block and returns a pointer to it.

Parameters

Mem	Global memory block identifier

Return Value

Memory block address if successful;

nil if not


GlobalLRUNewest (API function)
GlobalLRUNewest (Windows API function)

Declaration

function GlobalLRUNewest(Mem: THandle): THandle;

Description

Minimizes the likelihood that a global memory object will be discarded by moving it into the newest, least recently-used memory position.

Parameters

Mem	Global memory object identifier

Return Value

0 if invalid Mem


GlobalLRUOldest (API function)
GlobalLRUOldest (Windows API function)

Declaration

function GlobalLRUOldest(Mem: THandle): THandle;

Description

Maximizes the likelihood that a global memory object will be discarded by moving it into the oldest, least recently-used memory position.

Parameters

Mem	Global memory object identifier

Return Value

0 if invalid Mem


GlobalNotify (API procedure)
GlobalNotify (Windows API procedure)

Declaration

procedure GlobalNotify(NotifyProc: TFarProc);

Description

Calls NotifyProc passing the handle of the global memory block to be discarded. If NotifyProc returns non-zero, the block is discarded.

Parameters

NotifyProc	Notification callback procedure's instance-address


GlobalPageLock (API function)
GlobalPageLock (Windows API function)

Declaration

function GlobalPageLock(Selector: THandle): Word;

Description

Increments a memory block's page-lock count. Lock operations may be nested.

Parameters

Selector	Memory selector

Return Value

Incremented page-lock count if successful;

0 if not

See Also

GlobalPageUnlock


GlobalPageUnlock (API function)
GlobalPageUnlock (Windows API function)

Declaration

function GlobalPageUnlock(Selector: THandle): Word;

Description

Decrements a memory block's page-lock count. If count reaches 0 the page is allowed to move or be swapped to disk.

Parameters

Selector	Memory selector

Return Value

Decremented page-lock count if successful;

0 if not

See Also

GlobalPageLock


GlobalReAlloc (API function)
GlobalReAlloc (Windows API function)

Declaration

function GlobalReAlloc(Mem: THandle; Bytes: Longint; Flags: Word): THandle;

Description

Reallocates a global memory block to Bytes size.

Parameters

Mem	Global memory block identifier

Bytes	New size of Mem

Flags	One or more of the following gmem_ Global memory flags:

gmem_Discardable

gmem_Notify

gmem_Moveable

gmem_NoCompact

gmem_NoDiscard

gmem_ZeroInit

Return Value

Reallocated global memory block identifier;

0 if error


GlobalSize (API function)
GlobalSize (Windows API function)

Declaration

function GlobalSize(Mem: THandle): Longint;

Description

Retrieves the current size of a global memory block.

Parameters

Mem	Global memory block identifier

Return Value

Actual size (in bytes);

0 if Mem invalid or discarded


GlobalUnfix (API function)
GlobalUnfix (Windows API function)

Declaration

function GlobalUnfix(Mem: THandle): Bool;

Description

Unlocks a global memory block locked by GlobalFix. If the block's lock reference-count reaches 0 the block is subject to moving or discarding.

Parameters

Mem	Global memory block identifier

Return Value

0 if lock reference-count decrements to 0;

non-zero if not


GlobalUnlock (API function)
GlobalUnlock (Windows API function)

Declaration

function GlobalUnlock(Mem: THandle): Bool;

Description

Unlocks a global memory block locked by GlobalLock. If the block's lock reference-count reaches 0 the block is subject to moving or discarding.

Parameters

Mem	Global memory block identifier

Return Value

0 if lock reference-count decrements to 0;

non-zero if not


GlobalUnWire (API function)
GlobalUnWire (Windows API function)

Declaration

function GlobalUnWire(Mem: THandle): Bool;

Description

Unlocks a memory segment locked by GlobalWire.

Parameters

Mem	Segment identifier

Return Value

Non-zero if segment unlocked;

0 if not


GlobalWire (API function)
GlobalWire (Windows API function)

Declaration

function GlobalWire(Mem: THandle): PChar;

Description

Moves a segment, that must be locked for a long period, into low memory and locks it.

Parameters

Mem	Segment identifier

Return Value

New segment location if successful;

nil if not

See Also

GlobalUnWire


GrayString (API function)
GrayString (Windows API function)

Declaration

function GrayString(DC: HDC; Brush: HBrush; OutputFunc: TFarProc; Data: Longint; Count, X, Y, Width, Height: Integer): Bool;

Description

Draws gray text, using the currently selected font, by calling OutputFunc and passing DC (with a bitmap of Height and Width size), Data, and Count.

Parameters

DC	Device context identifier

Brush	HBrush used for graying

OutputFunc	Draw function procedure-instance address or nil to use TextOut

Data	Data to pass to OutputFunc or string if OutputFunc is 0

Count	Size of Data or 0 and Data is a string to calculate length or -1 and OutputFunc returns 0 and image is displayed but not shown

X, Y	Starting logical position of enclosing rectangle

Width	Width (in logical units) of enclosing rectangle or 0 and Data is a string to calculate width

Height	Height (in logical units) of enclosing rectangle or 0 and Data is a string to calculate height

Return Value

Non-zero if successful;

0 if output function returned 0 or insufficient memory to create bitmap

See Also

Color_Graytext

GetSysColor

mm_Text

SetTextColor


HiByte (API function)
HiByte (Windows API function)

Declaration

function HiByte(A: Word): Byte;

  inline(

    $5A/       { POP AX    }

    $8A/$C4/   { MOV AL,AH }

    $32/$E4);  { XOR AH,AH }

Description

Extracts the high-order byte from a 16-bit integer value.

Parameters

A	The 16-bit integer

Return Value

The high-order byte


HiWord (API function)
HiWord (Windows API function)

Declaration

function HiWord(AnInteger: Longint): Word;

Description

Extracts the high-order word from a 32-bit integer value.

Parameters

AnInteger	The 32-bit integer

Return Value

The high-order word


HideCaret (API procedure)
HideCaret (Windows API procedure)

Declaration

procedure HideCaret(Wnd: HWnd);

Description

Non-destructively removes the caret from the display screen.

Parameters

Wnd	Owning window of caret or 0 if owning window is in current task

See Also

ShowCaret


HiliteMenuItem (API function)
HiliteMenuItem (Windows API function)

Declaration

function HiliteMenuItem(Wnd: HWnd; Menu: HMenu; IDHilite, Hilite: Word): Bool;

Description

Highlights or removes highlighting from a top-level menu item.

Parameters

Wnd	Window identifier

Menu	Top-level menu identifier

IDHilite	Integer ID or position of menu item

Hilite	A combination of the mf_ Menu flags, mf_ByCommand or mf_ByPosition with mf_Hilite or mf_Unhilite

Return Value

Non-zero if successful;

0 if not


InflateRect (API function)
InflateRect (Windows API function)

Declaration

procedure InflateRect(var Rect: TRect; X, Y: Integer);

Description

Modifies the width and height of Rect. Adds X to left and right ends and Y to top and bottom of rectangle.

Parameters

Rect	TRect structure

X	Positive or negative value to change rectangle width

Y	Positive or negative value to change rectangle height


InitAtomTable (API function)
InitAtomTable (Windows API function)

Declaration

function InitAtomTable(Size: Integer): Bool;

Description

Initializes the atom hash table and sets its size (37 by default).

Parameters

Size	Number of table entries in atom hash table (should be prime)

Return Value

Non-zero if successful;

0 if not


InSendMessage (API function)
InSendMessage (Windows API function)

Declaration

function InSendMessage: Bool;

Description

Determines whether the message being processed by the current window function was sent via a SendMessage call.

Return Value

Non-zero if message sent by SendMessage;

0 if not


InsertMenu (API function)
InsertMenu (Windows API function)

Declaration

function InsertMenu(Menu:HMenu; Position, Flags, IDNewItem: Word; NewItem: PChar): Bool;

Description

Inserts a new menu item whose state is specified by Flags.

Parameters

Menu	Menu identifier

Position	Command ID or position of menu item to insert new menu item after or -1 to append to end

Flags	One of the mf_ Menu flags, mf_ByCommand or mf_ByPosition combined with any of the following:

mf_Bitmap

mf_String

mf_OwnerDraw

mf_Separator

mf_Popup

mf_MenuBarBreak

mf_MenuBreak

mf_Checked

mf_Unchecked

IDNewItem	New menu item command ID or menu handle if popup

NewItem	New menu item contents

Return Value

Non-zero if successful;

0 if not

See Also

DrawMenuBar

wm_DrawItem

wm_MeasureItem


IntersectClipRect (API function)
IntersectClipRect (Windows API function)

Declaration

function IntersectClipRect(DC: HDC; X1, Y1, X2, Y2: Integer): Integer;

Description

Creates a new clipping region from the intersection of the region and the specified rectangle.

Parameters

DC	Device context identifier

X1, Y1	Upper-left corner of rectangle

X2, Y2	Lower-right corner of rectangle

Return Value

One of  the Region flags


IntersectRect (API procedure)
IntersectRect (Windows API function)

Declaration

function IntersectRect(var DestRect, Src1Rect, Src2Rect: TRect): Integer;

Description

Determines the intersection of two rectangles.

Parameters

DestRect	TRect structure representing the resulting rectangle

Src1Rect	TRect structure representing a source rectangle

Src2Rect	TRect structure representing a source rectangle

Return Value

Non-zero if intersection is not empty;

0 if intersection is empty


InvalidateRect (API function)
InvalidateRect (Windows API procedure)

Declaration

procedure InvalidateRect(Wnd: HWnd; Rect: LPRect; Erase: Bool);

Description

Invalidates a windows client area by adding Rect to the window's update region.

Parameters

Wnd	Window identifier

Rect	TRect to be added to update region or nil for entire client area

Erase	Non-zero for BeginPaint to erase background

See Also

ValidateRect

ValidateRgn

wm_Paint


InvalidateRgn (API procedure)
InvalidateRgn (Windows API procedure)

Declaration

procedure InvalidateRgn(Wnd: HWnd; Rgn: HRgn; Erase: Bool);

Description

Invalidates a window's client area by adding Rgn to the window's update region.

Parameters

Wnd	Window identifier

Rgn	Region identifier (in client coordinates)

Erase	Non-zero for BeginPaint to erase background

See Also

ValidateRect

ValidateRgn

wm_Paint


InvertRect (API procedure)
InvertRect (Windows API procedure)

Declaration

procedure InvertRect(DC: HDC; var Rect: TRect);

Description

Inverts the colors of the rectangle specified by Rect.

Parameters

DC	Device context identifier

Rect	TRect structure (in logical coordinates)


InvertRgn (API function)
InvertRgn (Windows API function)

Declaration

function InvertRgn(DC: HDC; Rgn: HRgn): Bool;

Description

Inverts the colors of the region specified by Rgn.

Parameters

DC	Device context identifier

Rgn	Region identifier (in device units)

Return Value

Non-zero if successful;

0 if not


IsCharAlpha (API function)
IsCharAlpha (Windows API function)

Declaration

function IsCharAlpha(AChar: Char): Bool;

Description

Uses language driver and current language to determine if AChar is alphabetical.

Parameters

AChar	Test character

Return Value

Non-zero if alphabetical;

0 if not


IsCharAlphaNumeric (API function)
IsCharAlphaNumeric (Windows API function)

Declaration

function IsCharAlphaNumeric(AChar: Char): Bool;

Description

Uses language driver and current language to determine if AChar is alphanumeric.

Parameters

AChar	Test character

Return Value

Non-zero if alphanumeric;

0 if not


IsCharLower (API function)
IsCharLower (Windows API function)

Declaration

function IsCharLower(AChar: Char): Bool;

Description

Uses language driver and current language to determine if AChar is lowercase.

Parameters

AChar	Test character

Return Value

Non-zero if lowercase;

0 if not


IsCharUpper (API function)
IsCharUpper (Windows API function)

Declaration

function IsCharUpper(AChar: Char): Bool;

Description

Uses language driver and current language to determine if AChar is uppercase.

Parameters

AChar	Test character

Return Value

Non-zero if uppercase;

0 if not


IsChild (API function)
IsChild (Windows API function)

Declaration

function IsChild(Parent, Wnd: HWnd): Bool;

Description

Determines if Wnd is a child window of Parent.

Parameters

Parent	Window identifier

Wnd	Test window

Return Value

Non-zero if child window;

0 if not


IsClipboardFormatAvailable (API function)
IsClipboardFormatAvailable (Windows API function)

Declaration

function IsClipboardFormatAvailable(Format: Word): Bool;

Description

Determines whether data in the specified format exists in the clipboard.

Parameters

Format	Registered clipboard format; one of the cf_ Clipboard formats constants

Return Value

Non-zero if data in Format available;

0 if not

See Also

SetClipboardData


IsDialogMessage (API function)
IsDialogMessage (Windows API function)

Declaration

function IsDialogMessage(Dlg: HWnd; var Msg: TMsg): Bool;

Description

Determines and processes messages for modeless dialog boxes, converting keyboard messages into command messages.

Parameters

Dlg	Dialog box identifier

Msg	TMsg structure

Return Value

Non-zero if Msg processed (TranslateMessage and DispatchMessage should not be called);

0 if not


IsDlgButtonChecked (API function)
IsDlgButtonChecked (Windows API function)

Declaration

function IsDlgButtonChecked(Dlg: HWnd; IDButton: Integer): Word;

Description

Determines if button control is checked.

Parameters

Dlg	Dialog box identifier

IDButton	Button control ID

Return Value

Non-zero if checked;

0 if not;

for three-state button, grayed (2), checked (1), or 0


IsIconic (API function)
IsIconic (Windows API function)

Declaration

function IsIconic(Wnd: HWnd): Bool;

Description

Determines whether a window is iconic (minimized).

Parameters

Wnd	Window identifier

Return Value

Non-zero if minimized;

0 if not


IsRectEmpty (API function)
IsRectEmpty (Windows API function)

Declaration

function IsRectEmpty(var Rect: TRect): Bool;

Description

Determines whether a rectangle's width and/or height are 0.

Parameters

Rect	TRect structure

Return Value

Non-zero if empty;

0 if not


IsWindow (API function)
IsWindow (Windows API function)

Declaration

function IsWindow(Wnd: HWnd): Bool;

Description

Determines if Wnd is a valid existing window.

Parameters

Wnd	Window identifier

Return Value

Non-zero if valid;

0 if not


IsWindowEnabled (API function)
IsWindowEnabled (Windows API function)

Declaration

function IsWindowEnabled(Wnd: HWnd): Bool;

Description

Determines whether a window is enabled for mouse and keyboard input.

Parameters

Wnd	Window identifier

Return Value

Non-zero if enabled;

0 if not


IsWindowVisible (API function)
IsWindowVisible (Windows API function)

Declaration

function IsWindowVisible(Wnd: HWnd): Bool;

Description

Determines whether a window has been made visible by ShowWindow.

Parameters

Wnd	Window identifier

Return Value

Non-zero if exists on screen (even if completely covered);

0 if not


IsZoomed (API function)
IsZoomed (Windows API function)

Declaration

function IsZoomed(Wnd: HWnd): Bool;

Description

Determines whether a window is maximized.

Parameters

Wnd	Window identifier

Return Value

Non-zero if maximized;

0 if not


KillTimer (API function)
KillTimer (Windows API function)

Declaration

function KillTimer(Wnd: HWnd; IDEvent: Integer): Bool;

Description

Kills a timer event removing any associated wm_Timer messages from the message queue.

Parameters

Wnd	Window identifier

IDEvent	Timer event ID

Return Value

Non-zero if successful;

0 if invalid IDEvent

See Also

SetTimer


_lclose (API function)
_lclose (Windows API function)

Declaration

function _lclose(FileHandle: Integer): Integer;

Description

Closes the specified file.

Parameters

FileHandle	DOS file handle

Return Value

0 if successful;

-1 if not


_lcreat (API function)
_lcreat (Windows API function)

Declaration

function _lcreat(PathName: PChar; Attribute: Integer): Integer;

Description

Opens the specified file.

Parameters

PathName	The full DOS pathname of the file to be opened

Attribute	One of: (0) read or write, (1) read only, (2) hidden, or (3) system file

Return Value

DOS file handle if successful;

-1 if not


LimitEmsPages (API procedure)
LimitEmsPages (Windows API procedure)

Declaration

procedure LimitEmsPages(Kbytes: Longint);

Description

Limits number of kilobytes of expanded memory that Windows assigns to an application when running under expanded memory configuration.

Parameters

Kbytes	Number of kilobytes


LineDDA (API procedure)
LineDDA (Windows API procedure)

Declaration

procedure LineDDA(X1, Y1, X2, Y2: Integer; LineFunc: TFarProc; Data: Pointer);

Description

Computes all successive points in a line and calls LineFunc passing X and Y of the point and Data.

Parameters

X1, Y1	First point in line

X2, Y2	Last point in line

LineFunc	Callback function procedure-instance address

Data	Data passed to LineFunc


LineTo (API function)
LineTo (Windows API function)

Declaration

function LineTo(DC: HDC; X, Y: Integer): Bool;

Description

Draws a line, using selected pen, from the current position up to the specified endpoint.

Parameters

DC	Device context identifier

X, Y	Endpoint of the line

Return Value

Non-zero if drawn;

0 if not


_llseek (API function)
_llseek (Windows API function)

Declaration

function _llseek(FileHandle: Integer; Offset: Longint; Origin: Integer): Longint;

Description

Positions the pointer in an open file.

Parameters

FileHandle	DOS file handle

Offset	Number of bytes to move the pointer

Origin	Specifies the starting point and direction of the move: (0) forward from the beginning, (1) from the current position, or (2) back from the end of the file

Return Value

The new offset of the pointer, or

-1 if unsuccessful


LoadAccelerators (API function)
LoadAccelerators (Windows API function)

Declaration

function LoadAccelerators(Instance: THandle; TableName: PChar): THandle;

Description

Loads the named accelerator table from an executable file.

Parameters

Instance	Module instance whose executable file contains the accelerator table

TableName	Accelerator table name (null-terminated) or integer ID

Return Value

Accelerator table identifier if successful;

0 if not


LoadBitmap (API function)
LoadBitmap (Windows API function)

Declaration

function LoadBitmap(Instance: THandle; BitmapName: PChar): HBitmap;

Description

Loads the named bitmap resource.

Parameters

Instance	Module instance whose executable file contains the bitmap or 0 for predefined bitmap

BitmapName	String (null-terminated) or integer ID specifying the bitmap, or a predefined bitmap, specified by an obm_ Predefined bitmaps constant

Return Value

Bitmap identifier if successful;

0 if not


LoadCursor (API function)
LoadCursor (Windows API function)

Declaration

function LoadCursor(Instance: THandle; CursorName: PChar): HCursor;

Description

Loads the named cursor resource.

Parameters

Instance	Module instance whose executable file contains the cursor or 0 for predefined cursor

CursorName	String (null-terminated) or integer ID name or a predefined cursor, specified with one of the idc_ Standard cursor IDs constants

Return Value

Cursor identifier if successful;

0 if cursor not found;

undefined if not a cursor resource


LockData (API function)
LockData (Windows API function)

Declaration

function LockData(Dummy: Integer): THandle;

Description

Locks the current moveable data segment in memory.

Parameters

Dummy	Not used; set to 0

Return Value

Identifier for the locked data segment if successful;

0 if unsuccessful

See Also

UnlockData


LoadIcon (API function)
LoadIcon (Windows API function)

Declaration

function LoadIcon(Instance: THandle; IconName: PChar): HIcon;

Description

Loads the named icon resource.

Parameters

Instance	Module instance whose executable file contains the icon or 0 for predefined icon

IconName	String or integer ID name or predefined icon, specified with one of the idi_ Standard icon IDs

Return Value

Icon identifier if successful;

0 if not


LoadLibrary (API function)
LoadLibrary (Windows API function)

Declaration

function LoadLibrary(LibFileName: PChar): THandle;

Description

Loads the named library module.

Parameters

LibFileName	Library filename (null-terminated)

Return Value

Library module instance identifier (value greater than 32) if successful;

if not, its value is less than 32, and one of the following:

(0) no memory

(5) attempt to link task

(6) multiple data segments

(10) invalid Windows version

(11) invalid EXE file

(12) OS/2 app

(13) DOS 4.0 app

(14) Invalid EXE type

(15) not protect mode


LoadMenu (API function)
LoadMenu (Windows API function)

Declaration

function LoadMenu(Instance: THandle; MenuName: PChar): HMenu;

Description

Loads the named menu resource.

Parameters

Instance	Module instance whose executable file contains the menu

MenuName	String (null-terminated) or integer ID name of menu

Return Value

Menu identifier if successful;

0 if not


LoadMenuIndirect (API function)
LoadMenuIndirect (Windows API function)

Declaration

function LoadMenuIndirect(var MenuTemplate): HMenu;

Description

Loads the menu defined by MenuTemplate.

Parameters

MenuTemplate	Array of TMenuItemTemplate structures

Return Value

Menu identifier if successful;

0 if not


LoadModule (API function)
LoadModule (Windows API function)

Declaration

function LoadModule(ModuleName: PChar; ParameterBlock: Pointer): THandle;

Description

Loads and runs a Windows application.

Parameters

ModuleName	Application filename (null-terminated)

ParameterBlock	Four field structure:

EnvSeg	Word, environment segment address or 0 for Windows environment

CmdLine	Longint, command line

CmdShow	Longint, two Word-length structure, first word set to 2, second set to CmdShow of ShowWindow

Reserved	Longint, must be 0

Return Value

Same as LoadLibrary

See Also

WinExec


LoadResource (API function)
LoadResource (Windows API function)

Declaration

function LoadResource(Instance, ResInfo: THandle): THandle;

Description

Allocates memory and loads a resource.

Parameters

Instance	Module instance whose executable file contains the resource

ResInfo	Resource identifier (returned by FindResource)

Return Value

Resource identifier if successful;

0 if not

See Also

LockResource


LoadString (API function)
LoadString (Windows API function)

Declaration

function LoadString(Instance: THandle; ID: Word; Buffer: PChar; BufferMax: Integer): Integer;

Description

Loads the named string resource and copies it into Buffer appending a null-character.

Parameters

Instance	Module instance whose executable file contains the string

ID	Integer ID of string

Buffer	Receiving buffer

BufferMax	Size of Buffer

Return Value

Actual number of bytes copied;

0 if does not exist


LoByte (API function)
LoByte (Windows API function)

Declaration

function LoByte(A: Word): Byte;

  inline(

    $5A/       { POP AX    }

    $32/$E4);  { XOR AH,AH }

Description

Extracts the low-order byte from a 16-bit integer value.

Parameters

A	The 16-bit integer

Return Value

The low-order byte


LoWord (API function)
LoWord (Windows API function)

Declaration

function LoWord(AnInteger: Longint): Word;

Description

Extracts the low-order word from a 32-bit integer value.

Parameters

AnInteger	The 32-bit integer

Return Value

The low-order word


LocalAlloc (API function)
LocalAlloc (Windows API function)

Declaration

function LocalAlloc(Flags, Bytes: Word): THandle;

Description

Allocates a local memory block from the local heap. The actual size may be larger than the specified size.

Parameters

Flags	One or more of the following lmem_ Local memory flags constants:

lmem_Discardable

lmem_Fixed

lmem_Modify

lmem_Moveable

lmem_Nocompact

lmem_Nodiscard

lmem_Zeroinit

Bytes	Size (in bytes) of block to allocate

Return Value

Local memory block identifier if successful;

0 if not

See Also

LockData


LocalCompact (API function)
LocalCompact (Windows API function)

Declaration

function LocalCompact(MinFree: Word): Word;

Description

Generates a free block of at least MinFree size. If necessary, the function will move and/or discard unlocked blocks.

Parameters

MinFree	Number of desired free bytes or 0 to return largest contiguous block

Return Value

Size (in bytes) of largest block


LocalDiscard (API function)
LocalDiscard (Windows API function)

Declaration

function LocalDiscard(Mem: THandle): THandle;

Description

Discards the specified local memory block, leaving its handle valid, meaning that the handle may be reused by calling LocalReAlloc.

Parameters

Mem	The handle of the local memory block

Return Value

0 if successful;

Mem if not


LocalFlags (API function)
LocalFlags (Windows API function)

Declaration

function LocalFlags(Mem: THandle): Word;

Description

Retrieves information about a memory block.

Parameters

Mem	Local memory block identifier

Return Value

In high byte: lmem_Discardable or lmem_Discarded in high-byte

In low byte: lock count

See Also

lmem_ Local memory flags


LocalFree (API function)
LocalFree (Windows API function)

Declaration

function LocalFree(Mem: THandle): THandle;

Description

Frees a local memory block and invalidates its handle.

Parameters

Mem	Local memory block identifier

Return Value

0 if successful;

Mem if not


LocalHandle (API function)
LocalHandle (Windows API function)

Declaration

function LocalHandle(Mem: Word): THandle;

Description

Retrieves the handle of a local memory object at the specified address.

Parameters

Mem	Local memory object address

Return Value

Local memory object identifier


LocalInit (API function)
LocalInit (Windows API function)

Declaration

function LocalIni(Segment, Start, End: Word): Bool;

Description

Initializes a local heap and calls GlobalLock to lock the segment.

Parameters

Segment	Segment address of local heap

Start	Offset address to start of local heap

End	Offset address to end of local heap

Return Value

Non-zero if initialized;

0 if not


LocalLock (API function)
LocalLock (Windows API function)

Declaration

function LocalLock(Mem: THandle): Pointer;

Description

Locks Mem and increments its lock count. The block cannot be moved or discarded.

Parameters

Mem	Local memory block identifier

Return Value

Pointer to block if successful;

nil if not


LocalReAlloc (API function)
LocalReAlloc (Windows API function)

Declaration

function LocalReAlloc(Mem: THandle; Bytes, Flags: Word): THandle;

Description

Changes the size or attributes, as specified by Flags, of a local memory block.

Parameters

Mem	Local memory block identifier

Bytes	New size (in bytes) of block

Flags	One or more of the lmem_ Local memory flags:

lmem_Discardable

lmem_Modify

lmem_Moveable

lmem_NoCompact

lmem_NoDiscard

lmem_ZeroInit

Return Value

Local memory block identifier if successful;

0 if not

See Also

LockData


LocalShrink (API function)
LocalShrink (Windows API function)

Declaration

function LocalShrink(Seg: THandle; Size: Word): Word;

Description

Reduces the local heap to the specified size whose value can be no less than the minimum size specified in the application's module-definition file

Parameters

Seg	Segment containing local heap or 0 for current data segment

Size	Desired size (in bytes)

Return Value

Size after shrinkage

See Also

GlobalSize


LocalSize (API function)
LocalSize (Windows API function)

Declaration

function LocalSize(Mem: THandle): Word;

Description

Retrieves the current size of a local memory block.

Parameters

Mem	Local memory block identifier

Return Value

Size (in bytes) of block;

0 if invalid Mem


LocalUnlock (API function)
LocalUnlock (Windows API function)

Declaration

function LocalUnlock(Mem: THandle): Bool;

Description

Unlocks a local memory block by decrementing its lock count.

Parameters

Mem	Local memory block identifier

Return Value

0 if lock count decremented to 0 (making the block subject to moving or discarding);

non-zero if not


LockResource (API function)
LockResource (Windows API function)

Declaration

function LockResource(ResData: THandle): Pointer;

Description

Retrieves the address of a loaded resource and increments its reference-count. The resource is no longer subject to moving or discarding.

Parameters

ResData	Resource identifier returned from LoadResource

Return Value

Pointer to loaded resource;

nil if not

See Also

UnlockResource


LockSegment (API function)
LockSegment (Windows API function)

Declaration

function LockSegment(Segment: Word): THandle;

Description

Locks a segment (except protected-mode non-discardable segments) and increments its lock reference-count.

Parameters

Segment	Segment address or -1 for current segment

Return Value

Pointer to segment;

nil if error or discarded

See Also

UnlockSegment


_lopen (API function)
_lopen (Windows API function)

Declaration

function _lopen(PathName: PChar; ReadWrite: Integer): Integer;

Description

Opens the specified file.

Parameters

PathName	String specifying the path and file name

ReadWrite	Specifies the read and write access; one of the following of_ Open file constants:

of_Read

of_ReadWrite

of_Write

Return Value

The DOS file handle if successful;

-1 if not


LPtoDP (API function)
LPtoDP (Windows API function)

Declaration

function LPtoDP(DC: HDC; var Points; Count: Integer): Bool;

Description

Converts logical points in Points, in the current mapping mode, to device points.

Parameters

DC	Device context identifier

Points	Array of TPoint structures

Count	Size of Points

Return Value

Non-zero if all points converted;

0 if not


_lread (API function)
_lread (Windows API function)

Declaration

function _lread(FileHandle: Integer; Buffer: PChar; Bytes: Integer): Word;

Description

Read a number of bytes from an open file.

Parameters

FileHandle	The DOS file handle

Buffer	Receiving buffer

Bytes	The number of bytes to read

Return Value

The number of bytes read, if successful;

-1 if not;

0 if at end of file


lstrcat (API function)
lstrcat (Windows API function)

Declaration

function lstrcat(Str1, Str2: PChar): PChar;

Description

Concatenates Str2 to Str1.

Parameters

Str1	First string (null-terminated)

Str2	Second string (null-terminated)

Return Value

Str1 if successful;

0 if not


lstrcmp (API function)
lstrcmp (Windows API function)

Declaration

function lstrcmp(Str1, Str2: PChar): Integer;

Description

Performs case-sensitive, lexicographical compare of two strings based on the currently selected language. Uppercase characters evaluate lower than lowercase characters.

Parameters

Str1	First string (null-terminated)

Str2	Second string (null-terminated)

Return Value

Less than 0 if Str1 < Str2;

0 if Str1 = Str2;

greater than 0 if Str1 > Str2


lstrcmpi (API function)
lstrcmpi (Windows API function)

Declaration

function lstrcmpi(Str1, Str2: PChar): Integer;

Description

Performs case-insensitive, lexicographical compare of two strings based on the currently selected language.

Parameters

Str1	First string (null-terminated)

Str2	Second string (null-terminated)

Return Value

Less than 0 if Str1 < Str2;

0 if Str1 = Str2;

greater than 0 if Str1 > Str2


lstrcpy (API function)
lstrcpy (Windows API function)

Declaration

function lstrcpy(Str1, Str2: PChar): PChar;

Description

Copies (including null) Str2 to Str1.

Parameters

Str1	First string (null-terminated)

Str2	Second string (null-terminated)

Return Value

Pointer to Str1 if successful;

0 if not


lstrlen (API function)
lstrlen (Windows API function)

Declaration

function lstrlen(Str: PChar): Integer;

Description

Calculates length (not including null) of Str.

Parameters

Str	String (null-terminated)

Return Value

Length (in bytes) of Str


_lwrite (API function)
_lwrite (Windows API function)

Declaration

function _lwrite(FileHandle: Integer; Buffer: PChar; Bytes: Integer): Word;

Description

Writes data from Buffer into the specified file.

Parameters

FileHandle	DOS file handle

Buffer	Holds the data to be written

Bytes	The number of bytes to be written

Return Value

The number of bytes written to the file, if successful;

-1 if not


MakeLong (API function)
MakeLong (Windows API function)

Declaration

function MakeLong(Low, High: Word): Longint;

Description

Concatenates two word values into one unsigned long value.

Parameters

Low	The low-order word of the new unsigned long

High	The high-order word of the new unsigned long

Return Value

The resulting unsigned Longint


MakeProcInstance (API function)
MakeProcInstance (Windows API function)

Declaration

function MakeProcInstance(Proc: TFarProc; Instance: THandle): TFarProc;

Description

Creates a procedure-instance address for the specified exported function.

Parameters

Proc	Exported function TFarProc address

Instance	Module instance identifier

Return Value

Function procedure-instance address if successful;

0 if not


MapDialogRect (API procedure)
MapDialogRect (Windows API procedure)

Declaration

procedure MapDialogRect(Dlg: HWnd; var Rect: TRect);

Description

Converts dialog box units in Rect to screen units.

Parameters

Dlg	Dialog box identifier

Rect	TRect structure

See Also

GetDialogBaseUnits


MapVirtualKey (API function)
MapVirtualKey (Windows API function)

Declaration

function MapVirtualKey(Code, MapType: Word): Word;

Description

Maps a virtual-key or scan code for a key to its corresponding scan code, virtual-key code, or ASCII value as specified by MapType.

Parameters

Code	Virtual-key or scan code for a key determined by MapType value

MapType	(0) virtual-key code, (1) scan code, (2) virtual-key code

Return Value

If MapType is

0, returns scan code

1, returns virtual-key code

2, returns unshifted ASCII value


MessageBeep (API procedure)
MessageBeep (Windows API procedure)

Declaration

procedure MessageBeep(BeepType: Word);

Description

Causes the system speaker to beep.

Parameters

BeepType	Set to 0


MessageBox (API function)
MessageBox (Windows API function)

Declaration

function MessageBox(Parent: HWnd; Txt, Caption: PChar; TextType: Word): Integer;

Description

Creates and displays a dialog box containing the specified message and caption and any predefined icons and pushbutton as specified by TextType.

Parameters

Parent	Owning window of message box

Txt	Message to display (null-terminated)

Caption	Dialog box caption (null-terminated) or nil for "Error"

TextType	One or a combination of the mb_ Message box flags constants

Return Value

One of the id Dialog box command IDs if successful;

0 if not enough memory


ModifyMenu (API function)
ModifyMenu (Windows API function)

Declaration

function ModifyMenu(Menu: HMenu; Position, Flags, IDNewItem: Word; NewItem: PChar): Bool;

Description

Changes an existing menu item whose new state is specified by Flags.

Parameters

Menu	Menu identifier

Position	Command ID or position of menu item

Flags	Combination of mf_ByCommand or mf_ByPosition with one of the following mf_ Menu flags constants:

mf_Disabled

mf_Enabled

mf_Grayed

mf_Bitmap

mf_String

mf_OwnerDraw

mf_Separator

mf_Popup

mf_MenuBarBreak

mf_MenuBreak

mf_Checked

mf_Unchecked

IDNewItem	Command ID or menu handle, if Flags set to mf_Popup, of modified menu item

NewItem	String (mf_String), HBitmap (mf_Bitmap), or application supplied data (mf_OwnerDraw)

Return Value

Non-zero if successful;

0 if not


MoveTo (API function)
MoveTo (Windows API function)

Declaration

function MoveTo(DC: HDC; X, Y: Integer): Longint;

Description

Moves the current position to the specified point.

Parameters

DC	Device context identifier

X, Y	New position

Return Value

Xcoordinates of previous position in low-order word;

Y-coordinates of previous position in high-order word.


MoveWindow (API procedure)
MoveWindow (Windows API procedure)

Declaration

procedure MoveWindow(Wnd: HWnd; X, Y, Width, Height: Integer; Repaint: Bool);

Description

Sends a wm_Size message to a window. Width and height values passed with wm_Size are those of the client area.

Parameters

Wnd	Pop-up or child window identifier

X, Y	New upper-left corner of window

Width	New window width

Height	New window height

Repaint	Non-zero to repaint window after moving


MulDiv (API function)
MulDiv (Windows API function)

Declaration

function MulDiv(Number, Numerator, Denominator: Integer): Integer;

Description

Multiplies Numerator by Number and divides the result by Denominator, rounding to the nearest integer.

Parameters

Number	A number

Numerator	Another number

Denominator	Another number

Return Value

Result value;

32,767 or -32767 if overflow or if Denominator is 0


NetBIOSCall (API procedure)
NetBIOSCall (Windows API procedure)

Declaration

procedure NetBIOSCall;

Description

Calls the NETBIOS interrupt 5Ch. This call should be used instead of a direct call to the 5Ch software interrupt for future compatibility.

NetBIOSCall should only be called from within assembly-language routines, as the CPU registers must be set for the interrupt call.


OemKeyScan (API function)
OemKeyScan (Windows API function)

Declaration

function OemKeyScan(OemChar: Word): Longint;

Description

Maps OemChar into OEM scan codes.

Parameters

OemChar	OEM ASCII character code (0 - $0FF)

Return Value

Scan code and shift state (bit 2 ctrl key, bit 1 shift key pressed) in low- and high-order word, respectively, if successful;

-1 in low- and high-order word if not


OemToAnsi (API function)
OemToAnsi (Windows API function)

Declaration

function OemToAnsi(OemStr, AnsiStr: PChar): Bool;

Description

Translates OemStr to ANSI character set.

Parameters

OemStr	String of OEM characters (null-terminated)

AnsiStr	Receive buffer or OemStr to translate in place

Return Value

Always False (-1)


OemToAnsiBuff (API procedure)
OemToAnsiBuff (Windows API procedure)

Declaration

procedure OemToAnsiBuff(OemStr, AnsiStr: PChar; Length: Integer);

Description

Translates OemStr to ANSI character set.

Parameters

OemStr	Buffer of OEM characters

AnsiStr	Receive buffer or OemStr to translate in place

Length	Size of OemStr


OffsetClipRgn (API function)
OffsetClipRgn (Windows API function)

Declaration

function OffsetClipRgn(DC: HDC; X, Y: Integer): Integer;

Description

Moves the device's clipping region according to the specified X and Y offsets.

Parameters

DC	Device context identifier

X	Logical units to move left or right

Y	Logical units to move up or down

Return Value

One of the Region flags constants


OffsetRect (API procedure)
OffsetRect (Windows API procedure)

Declaration

procedure OffsetRect(var Rect: TRect; X, Y: Integer);

Description

Adjusts a rectangle's coordinates by the specified X and Y offsets

Parameters

Rect	TRect structure

X	Units to move left or right

Y	Units to move up or down


OffsetRgn (API function)
OffsetRgn (Windows API function)

Declaration

function OffsetRgn(Rgn: HRgn; X, Y: Integer): Integer;

Description

Moves a region by the specified X and Y offsets.

Parameters

Rgn	Region identifier

X	Units to move left or right

Y	Units to move up or down

Return Value

One of the Region flags constants


OffsetViewportOrg (API function)
OffsetViewportOrg (Windows API function)

Declaration

function OffsetViewportOrg(DC: HDC; X, Y: Integer): Longint;

Description

Modifies a viewport origin by summing the current origin with the specified X and Y values.

Parameters

DC	Device context identifier

X	X-coordinate origin offset

Y	Y-coordinate origin offset

Return Value

Y-coordinates of previous origin in high-order word;

X-coordinates of previous origin in low-order word.


OffsetWindowOrg (API function)
OffsetWindowOrg (Windows API function)

Declaration

function OffsetWindowOrg(DC: HDC; X, Y: Integer): Longint;

Description

Modifies a window's origin by summing the current origin with the specified X and Y values.

Parameters

DC	Device context identifier

X	X-coordinate (in logical units) origin offset

Y	Y-coordinate (in logical units) origin offset

Return Value

Y-coordinates of previous origin in high-order word;

X-coordinates of previous origin in low-order word.


OpenClipboard (API function)
OpenClipboard (Windows API function)

Declaration

function OpenClipboard(Wnd: HWnd): Bool;

Description

Opens the clipboard for exclusive use by the application.

Parameters

Wnd	Window identifier

Return Value

Non-zero if successful;

0 if already opened by another application

See Also

CloseClipboard


OpenComm (API function)
OpenComm (Windows API function)

Declaration

function OpenComm(ComName: PChar; InQueue, OutQueue: Word): Integer;

Description

Opens a communications device. The device is initialized to a default configuration and transmit and receive queues are allocated.

Parameters

ComName	String containing 'COMn' or 'LPTn', where n is an integer

InQueue	Receive queue size or ignored for LPT ports

OutQueue	Transmit queue size or ignored for LPT ports

Return Value

Cid handle if successful;

if not, negative error value (one of the ie_ Open comm error flags)

See Also

SetCommState


OpenFile (API function)
OpenFile (Windows API function)

Declaration

function OpenFile(FileName: PChar; var ReOpenBuff: TOFStruct; Style: Word): Integer;

Description

Creates, opens, reopens, or deletes file.

Parameters

FileName	The specified file name

ReOpenBuff	Receives information about file when opened

Style	Specifies the action; one of the of_ Open file constants

Return Value

DOS file handle if successful;

-1 if not


OpenIcon (API function)
OpenIcon (Windows API function)

Declaration

function OpenIcon(Wnd: HWnd): Bool;

Description

Restores a minimized window to its original size and position.

Parameters

Wnd	Window identifier

Return Value

Non-zero if successful;

0 if not


OpenSound (API function)
OpenSound (Windows API function)

Declaration

function OpenSound: Integer;

Description

Opens the play device for exclusive use by the application.

Return Value

Number of available s_ Sound voices;

s_SerDVNA if in use;

s_SerOFM if insufficient memory


OutputDebugString (API procedure)
OutputDebugString (Windows API procedure)

Declaration

procedure OutputDebugString(OutputString: PChar);

Description

Sends OutputString to debugger if present, or otherwise to AUX port in debug version of Windows.

Parameters

OutputString	String (null-terminated)


PaintRgn (API function)
PaintRgn (Windows API function)

Declaration

function PaintRgn(DC: HDC; Rgn: HRgn): Bool;

Description

Fills a region with the selected brush.

Parameters

DC	Device context

Rgn	Fill region

Return Value

Non-zero if successful;

0 if not


PaletteRGB (API function)
PaletteRGB (Windows API function)

Declaration

function PaletteRGB(Red, Green, Blue: Byte): Longint;

Description

Produces a palette-relative RGB color value from three primary color values ranging from 0 to 255. The return value has 2 in the high-order byte.

Parameters

Red	The red intensity value

Green	The green intensity value

Blue	The blue intensity value

Return Value

The resulting RGB color


PatBlt (API function)
PatBlt (Windows API function)

Declaration

function PatBlt(DC: HDC; X, Y, Width, Height: Integer; Rop: Longint): Bool;

Description

Creates a bit pattern by performing Rop using the selected brush and the pattern already on the device.

Parameters

DC	Device context identifier

X, Y	Upper left corner of rectangle

Width	Width (in logical units) of rectangle

Height	Height (in logical units) of rectangle

Rop	One of the following Ternary raster operations:

PatCopy

PatInvert

DSTInvert

Blackness

Whiteness

Return Value

Non-zero if bit pattern drawn;

0 if not


PeekMessage (API function)
PeekMessage (Windows API function)

Declaration

function PeekMessage(var Msg: TMsg; Wnd: HWnd; MsgFilterMin, MsgFilterMax, RemoveMsg: Word): Bool;

Description

Checks application queue for a message and copies it to Msg. The function returns immediately if there are no messages and yields control to Windows.

Parameters

Msg	Receiving TMsg structure

Wnd	Messages destination window or 0 for any window in application or -1 for messages posted by PostAppMessage function

MsgFilterMin	Lowest message ID to examine or 0 for no limit

MsgFilterMax	Highest message ID to examine or 0 for no limit

RemoveMsg	One or more of the pm_ Peek message options

Return Value

Non-zero if message available;

0 if not

See Also

GetMessage

WaitMessage


Pie (API function)
Pie (Windows API function)

Declaration

function Pie(DC: HDC; X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer): Bool;

Description

Draws a pie-shaped wedge using the selected pen and filled with the selected brush, centered in the bounding rectangle.

Parameters

DC	Device context identifier

X1, Y1	Upper-left corner of bounding rectangle

X2, Y2	Lower-left corner of bounding rectangle

X3, Y3	Starting point of arc

X4, Y4	Endpoint of arc

Return Value

Non-zero if drawn;

0 if not


PlayMetaFile (API function)
PlayMetaFile (Windows API function)

Declaration

function PlayMetaFile(DC: HDC; MF: THandle): Bool;

Description

Executes the contents of a metafile on the specified device.

Parameters

DC	Device context identifier

MF	Metafile identifier

Return Value

Non-zero if successful;

0 if not


PlayMetaFileRecord (API procedure)
PlayMetaFileRecord (Windows API procedure)

Declaration

procedure PlayMetaFileRecord(DC: HDC; var HandleTable: THandleTable; var MetaRecord: TMetaRecord; Handles: Word);

Description

Executes the GDI function call contained in a metafile record.

Parameters

DC	Device context identifier

HandleTable	THandleTable used for metafile playback

MetaRecord	TMetaRecord of metafile to play

Handles	Size of HandleTable

See Also

EnumMetaFile


Polygon (API function)
Polygon (Windows API function)

Declaration

function Polygon(DC: HDC; var Points; Count: Integer): Bool;

Description

Draws a polygon using the current polygon-filling mode, whose vertices a specified by Points. The polygon is closed if necessary.

Parameters

DC	Device context identifier

Points	Array of TPoint structures

Count	Size of Points

Return Value

Non-zero if successful;

0 if not

See Also

SetPolyFillMode


Polyline (API function)
Polyline (Windows API function)

Declaration

function Polyline(DC: HDC; var Points; Count: Integer): Bool;

Description

Draws a set of line segments using the selected pen, where each subsequent point is specified by Points.

Parameters

DC	Device context identifier

Points	Array of TPoint structures

Count	Size of Points

Return Value

Non-zero if successful;

0 if not


PolyPolygon (API function)
PolyPolygon (Windows API function)

Declaration

function PolyPolygon(DC: HDC; var Points; var PolyCounts; Count: Integer): Bool;

Description

Draws a series of possibly overlapping polygons using the current polygon-filling mode, whose vertices are specified by Points. The polygons are not automatically closed.

Parameters

DC	Device context identifier

Points	Array of TPoint structures

PolyCounts	Array of integers where each number specifies the number of vertices for each polygon in Points

Count	Size of PolyCounts

Return Value

Non-zero if drawn;

0 if not


PostAppMessage (API function)
PostAppMessage (Windows API function)

Declaration

function PostAppMessage(Task: THandle; Msg, wParam: Word; lParam: Longint): Bool;

Description

Posts a message to an application. The Wnd of the message is set to 0.

Parameters

Task	Application to receive message

Msg	Message type

wParam	Additional message information

lParam	Additional message information

Return Value

Non-zero if successful;

0 if not

See Also

GetCurrentTask

GetMessage

PeekMessage


PostMessage (API function)
PostMessage (Windows API function)

Declaration

function PostMessage(Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Bool;

Description

Posts a message to an application window.

Parameters

Wnd	Window to receive message or $FFFF for all overlapped or popup windows

Msg	Message type

wParam	Additional message information

lParam	Additional message information

Return Value

Non-zero if successful;

0 if not


PostQuitMessage (API procedure)
PostQuitMessage (Windows API procedure)

Declaration

procedure PostQuitMessage(ExitCode: Integer);

Description

Posts a wm_Quit message typically in response to a wm_Destroy message.

Parameters

ExitCode	Application exit code (wParam of wm_Quit message)


PtInRect (API function)
PtInRect (Windows API function)

Declaration

function PtInRect(var Rect: TRect; Point: TPoint): Bool;

Description

Determines whether a point lies within, or on the left or top side, of the specified rectangle.

Parameters

Rect	TRect structure

Point	TPoint structure

Return Value

Non-zero if Point lies within Rect;

0 if not


PtInRegion (API function)
PtInRegion (Windows API function)

Declaration

function PtInRegion(Rgn: HRgn; X, Y: Integer): Bool;

Description

Determines whether a point lies within the specified region.

Parameters

Rgn	Region identifier

X, Y	A point

Return Value

Non-zero if the point lies within Rgn;

0 if not


PtVisible (API function)
PtVisible (Windows API function)

Declaration

function PtVisible(DC: HDC; X, Y: Integer): Bool;

Description

Determines whether a point lies within the specified device's clipping region.

Parameters

DC	Device context identifier

X, Y	A point

Return Value

Non-zero if the point lies within the clipping region of DC;

0 if not


ReadComm (API function)
ReadComm (Windows API function)

Declaration

function ReadComm(Cid: Integer; Buf: PChar, Size: Integer): Integer;

Description

Reads Cid copying up to Size characters into Buf.

Parameters

Cid	Communications device

Buf	Receiving buffer

Size	Size of Buf

Return Value

Actual number of characters read;

0 for no characters in receive queue;

negative value if error

See Also

GetCommError

OpenComm


RealizePalette (API function)
RealizePalette (Windows API function)

Declaration

function RealizePalette(DC: HDC): Word;

Description

Maps the selected logical palette to entries in the system palette.

Parameters

DC	Device context identifier

Return Value

Number of entries in logical palette mapped to different entries system palette since last realized


Rectangle (API function)
Rectangle (Windows API function)

Declaration

function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Bool;

Description

Draws a rectangle using the currently selected pen and fills its interior with the currently selected brush.

Parameters

DC	Device context identifier

X1, Y1	Upper-left corner of rectangle

X2, Y2	Lower-right corner of rectangle

Return Value

Non-zero if rectangle drawn;

0 if not


RectInRegion (API function)
RectInRegion (Windows API function)

Declaration

function RectInRegion(Region: HRgn; var Rect: TRect): Bool;

Description

Determines whether any part of Rect lies within the specified region.

Parameters

Region	HRgn region identifier

Rect	TRect structure

Return Value

Non-zero if within region boundaries;

0 if not


RectVisible (API function)
RectVisible (Windows API function)

Declaration

function RectVisible(DC: HDC; var Rect: TRect): Bool;

Description

Determines whether any part of Rect lies within the specified device context clipping region.

Parameters

DC	Device context identifier.

Rect	TRect structure

Return Value

Non-zero if within the clipping region;

0 if not


RegisterClass (API function)
RegisterClass (Windows API function)

Declaration

function RegisterClass(var WndClass: TWndClass): Bool;

Description

Registers a window class whose attributes are specified by WndClass, for subsequent use. A window class can only be registered once.

Parameters

WndClass	TWndClass structure

Return Value

Non-zero if class registered;

0 if not


RegisterClipboardFormat (API function)
RegisterClipboardFormat (Windows API function)

Declaration

function RegisterClipboardFormat(FormatName: PChar): Word;

Description

Registers a clipboard format, incrementing the format's reference count if it had been previously registered.

Parameters

FormatName	Format name (null-terminated)

Return Value

Registered format identifier ($C000 to $FFFF) if successful;

0 if not


RegisterWindowMessage (API function)
RegisterWindowMessage (Windows API function)

Declaration

function RegisterWindowMessage(Str: PChar): Word;

Description

Defines a unique system-wide window message.

Parameters

Str	Register string (null-terminated)

Return Value

Message identifier ($C000 to $FFFF) if successful;

0 if not


ReleaseCapture (API procedure)
ReleaseCapture (Windows API procedure)

Declaration

procedure ReleaseCapture;

Description

Releases mouse capture restoring normal input processing.

See Also

SetCapture


ReleaseDC (API function)
ReleaseDC (Windows API function)

Declaration

function ReleaseDC(Wnd: HWnd; DC: HDC): Integer;

Description

Releases a common or window (has no affect on class or private) device context making it available to other applications.

Parameters

Wnd	Window identifier

DC	Device context identifier

Return Value

1 if device context released;

0 if not

See Also

GetDC

GetWindowDC


RemoveFontResource (API function)
RemoveFontResource (Windows API function)

Declaration

function RemoveFontResourc(FileName: PChar): Bool;

Description

Removes a font from Windows font table. The font is not removed until all outstanding references to the resource are deleted.

Parameters

FileName	Font-resource filename (null terminated) or module instance handle

Return Value

Non-zero if successful;

0 if not

See Also

DeleteObject

wm_FontChange


RemoveMenu (API function)
RemoveMenu (Windows API function)

Declaration

function RemoveMenu(Menu: HMenu; Position, Flags: Word): Bool;

Description

Non-destructively removes a menu item and associated popup from the specified menu. The popup may be reused in subsequent operations.

Parameters

Menu	Menu identifier

Position	Command ID or position of menu item

Flags	One of the mf_ Menu flags, mf_ByCommand or mf_ByPosition specifying the nature of the Position argument

Return Value

Non-zero if successful,

0 if not

See Also

DrawMenuBar

GetSubMenu


RemoveProp (API function)
RemoveProp (Windows API function)

Declaration

function RemoveProp(Wnd: HWnd; Str: PChar): THandle;

Description

Removes an entry specified by Str, from a window's property list. It is the applications responsibility to free the returned data handle.

Parameters

Wnd	Window identifier

Str	String (null-terminated) or an atom

Return Value

Data handle to string;

0 if string not found

See Also

AddAtom


ReplyMessage (API procedure)
ReplyMessage (Windows API procedure)

Declaration

procedure ReplyMessage(Reply: Longint);

Description

Replies to a message sent by a SendMessagecall allowing both the caller of the SendMessage and ReplyMessageto continue executing.

Parameters

Reply	Message dependent return result


ResizePalette (API function)
ResizePalette (Windows API function)

Declaration

function ResizePalette(Palette: HPalette; NumEntries: Word): Bool;

Description

Changes the size of a logical palette to NumEntries. If enlarged, the additional entries are set to black.

Parameters

Palette	Logical palette identifier

NumEntries	New size of palette

Return Value

Non-zero if successful;

0 if not


RestoreDC (API function)
RestoreDC (Windows API function)

Declaration

function RestoreDC(DC: HDC; SaveDC: Integer): Bool;

Description

Restores a device context to the previous state specified by SaveDC from the context stack. State information is deleted if SaveDC is not at top of stack.

Parameters

DC	Device context identifier

SaveDC	Return value of a previous SaveDC call or -1 for most recently saved device context

Return Value

Non-zero if restored;

0 if not


RGB (API function)
RGB (Windows API function)

Declaration

function RGB(Red, Green, Blue: Byte): Longint;

Description

Produces an RGB color value from three primary color values ranging from 0 to 255.

Parameters

Red	The red intensity value

Green	The green intensity value

Blue	The blue intensity value

Return Value

The resulting RGB color


RoundRect (API function)
RoundRect (Windows API function)

Declaration

function RoundRect(DC: HDC; X1, Y1, X2, Y2, X3, Y3: Integer): Bool;

Description

Draws a rectangle with rounded corners using the selected pen and filled using the selected

brush.

Parameters

DC	Device context identifier

X1, Y1	Upper-left corner of rectangle

X2, Y2	Lower-right corner of rectangle

X3	Ellipse width used to draw rounded corners

Y3	Ellipse height used to draw rounded corners

Return Value

Non-zero if drawn;

0 if not


SaveDC (API function)
SaveDC (Windows API function)

Declaration

function SaveDC(DC: HDC): Integer;

Description

Saves the current state of DC on the context stack.

Parameters

DC	Device context identifier

Return Value

Saved device context if successful;

0 if not

See Also

RestoreDC


ScaleViewportExt (API function)
ScaleViewportExt (Windows API function)

Declaration

function ScaleViewportExt(DC: HDC; Xnum, Xdenom, Ynum, Ydenom: Integer): Longint;

Description

Modifies the current viewport extents.

Parameters

DC	Device context identifier

Xnum	Value to multiply current x-extent

Xdenom	Value to divide current x-extent

Ynum	Value to multiply current y-extent

Ydenom	Value to divide current y-extent

Return Value

Previous y-extent in high-order word;

Previous x-extent in low-order word.


ScaleWindowExt (API function)
ScaleWindowExt (Windows API function)

Declaration

function ScaleWindowExt(DC: HDC; Xnum, Xdenom, Ynum, Ydenom: Integer): Longint;

Description

Modifies the current window extents.

Parameters

Xnum	Value to multiply current x-extent

Xdenom	Value to divide current x-extent

Ynum	Value to multiply current y-extent

Ydenom	Value to divide current y-extent

Return Value

Previous y-extent in high-order word;

Previous x-extent in low-order word.


ScreenToClient (API procedure)
ScreenToClient (Windows API procedure)

Declaration

procedure ScreenToClient(Wnd: HWnd; var Point);

Description

Converts and replaces the screen coordinate values in Point with the client coordinates of the specified window.

Parameters

Wnd	Window identifier

Point	TPoint structure


ScrollDC (API function)
ScrollDC (Windows API function)

Declaration

function ScrollDC(DC: HDC; dx, dy: Integer; var Scroll, Clip: TRect; UpdateRgn: HRgn; UpdateRect: LPRect): Bool;

Description

Scrolls a rectangle of bits by dx and dy units.

Parameters

DC	Device context identifier

dx	Horizontal scroll units

dy	Vertical scroll units

Scroll	TRect containing scrolling rectangle

Clip	TRect containing clipping rectangle

UpdateRgn	ScrollDC region uncovered by the scrolling process; if nil, update region is not computed

UpdateRect	Receiving TRect containing the bounding rectangle of the scroll update region; if nil, update rectangle is not computed

Return Value

Non-zero if successful;

0 if not


ScrollWindow (API procedure)
ScrollWindow (Windows API procedure)

Declaration

procedure ScrollWindow(Wnd: HWnd; XAmount, YAmount: Integer; Rect, ClipRect: LPRect);

Description

Scrolls a window's client area by XAmount and YAmount. The uncovered area is combined with the window's update region.

Parameters

Wnd	Window identifier

XAmount	Device units to scroll in x-direction

YAmount	Device units to scroll in y-direction

Rect	Client area TRect to be scrolled or nil for entire client area

ClipRect	Clipping TRect to be scrolled or nil for entire window

See Also

UpdateWindow

wm_Paint


SelectClipRgn (API function)
SelectClipRgn (Windows API function)

Declaration

function SelectClipRgn(DC: HDC; Rgn: HRgn): Integer;

Description

Uses a copy of Rgn as the current clipping region for the device context.

Parameters

DC	Device context identifier

Rgn	Region to be selected

Return Value

One of the Region flags constants


SelectObject (API function)
SelectObject (Windows API function)

Declaration

function SelectObject(DC: HDC; hObject: THandle): THandle;

Description

Selects a logical object for DC. Only one object can be selected at any one time and should be deleted when no longer being used.

Parameters

DC	Device context identifier

hObject	One of: bitmap, brush, font, pen, or region

Return Value

Object being replaced or non-zero if metafile DC;

0 or 0 if error

See Also

DeleteObject

SelectClipRgn

SelectPalette


SelectPalette (API function)
SelectPalette (Windows API function)

Declaration

function SelectPalette(DC: HDC; Palette: HPalette; ForceBackground: Bool): HPalette;

Description

Selects Palette as the device context's selected palette object which is used by GDI to control displayed colors.

Parameters

DC	Device context identifier

Palette	Logical palette to select

ForceBackground	If non-zero then background palette or if 0 foreground palette when window has input focus

Return Value

Replaced logical palette if successful;

0 if not

See Also

CreatePalette


SendDlgItemMessage (API function)
SendDlgItemMessage (Windows API function)

Declaration

function SendDlgItemMessage(Dlg: HWnd; IDDlgItem: Integer; Msg, wParam: Word; lParam: Longint): Longint;

Description

Sends a message to a dialog box control specified by IDDlgItem. The function returns after the message is processed.

Parameters

Dlg	Dialog box identifier

IDDlgItem	Integer ID of destination dialog item

Msg	Message type

wParam	Additional message information

lParam	Additional message information

Return Value

Value returned by control's window function;

0 if invalid IDDlgItem


SendMessage (API function)
SendMessage (Windows API function)

Declaration

function SendMessage(Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Longint;

Description

Sends a message to the window function of the specified window. The function does not return until the message is processed.

Parameters

Wnd	Window to receive message or $FFFF to send to all popup windows in system

Msg	Message type

wParam	Additional message information

lParam	Additional message information

Return Value

Value returned by receiving window function


SetActiveWindow (API function)
SetActiveWindow (Windows API function)

Declaration

function SetActiveWindow(Wnd: HWnd): HWnd;

Description

Activates a top-level window.

Parameters

Wnd	Window identifier

Return Value

Previously active window


SetBitmapBits (API function)
SetBitmapBits (Windows API function)

Declaration

function SetBitmapBits(Bitmap: HBitmap; Count: Longint; Bits: Pointer): Longint;

Description

Sets the bits of Bitmap to the bit values in Bits.

Parameters

Bitmap	HBitmap to set

Count	Size (in bytes) of Bits

Bits	Byte array of bitmap bits

Return Value

Number of bytes used to set bitmap bits;

0 if error


SetBitmapDimension (API function)
SetBitmapDimension (Windows API function)

Declaration

function SetBitmapDimension(ABitmap: HBitmap; X, Y: Integer): Longint;

Description

Sets a bitmap's height and width in 0.1-millimeter units.

Parameters

Bitmap	Bitmap identifier

X	Bitmap width (in 0.1-millimeter units)

Y	Bitmap height (in 0.1-millimeter units)

Return Value

Height of previous dimensions in high-order word;

Width of previous dimensions in low-order word.

See Also

GetBitmapDimension


SetBkColor (API function)
SetBkColor (Windows API function)

Declaration

function SetBkColor(DC: HDC; Color: TColorRef): Longint;

Description

Sets the current background to Color or the nearest physical color supported by the device.

Parameters

DC	Device context identifier

Color	New background TColorRef

Return Value

Previous RGB background color if successful;

$80000000 if not

See Also

BitBlt

SetBkMode

StretchBlt


StretchDIBits (API function)
StretchDIBits (Windows API function)

Declaration

function StretchDIBits(DC: HDC; DestX, DestY, DestWidth, DestHeight, SrcX, SrcY, SrcWidth, SrcHeight: Word; Bits: Pointer; var BitsInfo: TBitmapInfo; Usage: Word; Rop: DWord): Integer;

Description

Moves a device-independent bitmap (DIB), stretching or compressing as required, from a source rectangle to a destination rectangle. The source and destination are combined as specified by Rop.

Parameters

DC	Receiving device context

DestX, DestY	Destination rectangle origin (in logical units)

DestWidth	Destination rectangle x-extent (in logical units)

DestHeight	Destination rectangle y-extent (in logical units)

SrcX, SrcY	Source rectangle origin (in pixels) in the DIB

SrcWidth	Source rectangle width (in pixels)

SrcHeight	Source rectangle height (in pixels)

Bits	Byte array containing DIB bits

Usage	DIB_RGB_Colors specifies BitsInfo.bmiColors field contains RGB values or DIB_Pal_Colors specifies indexes to currently realized logical palette (see DIB_ Color table identifiers)

Rop	One of the Ternary raster operations constants

Return Value

Number of scan lines copied


SetBkMode (API function)
SetBkMode (Windows API function)

Declaration

function SetBkMode(DC: HDC; BkMode: Integer): Integer;

Description

Sets the background mode which specifies whether or not GDI should remove existing background colors before drawing text, hatched brushes, or using non-solid pen styles.

Parameters

DC	Device context identifier

BkMode	One of the Background modes constants

Return Value

Previous mode if successful;

0 if not


SetBrushOrg (API function)
SetBrushOrg (Windows API function)

Declaration

function SetBrushOrg(DC: HDC; X, Y: Integer): Longint;

Description

Sets the origin of the selected brush. The brush should not be a stock object.

Parameters

DC	Device context identifier

X, Y	New origin (in device units), ranging from 0 to 7

Return Value

Previous origin where x-coordinate is in low-order word;

y-coordinate is in high-order word.


SetCapture (API function)
SetCapture (Windows API function)

Declaration

function SetCapture(Wnd: HWnd): HWnd;

Description

Causes all cursor input to be sent to Wnd, regardless of the position of the mouse.

Parameters

Wnd	Window identifier

Return Value

Previous window that received all mouse input;

0 if no such window

See Also

ReleaseCapture


SetCaretBlinkTime (API procedure)
SetCaretBlinkTime (Windows API procedure)

Declaration

procedure SetCaretBlinkTime(MSeconds: Word);

Description

Sets the elapsed time between caret flashes.

Parameters

MSeconds	Blink rate (in milliseconds)


SetCaretPos (API procedure)
SetCaretPos (Windows API procedure)

Declaration

procedure SetCaretPos(X, Y: Integer);

Description

Moves the caret to the specified position.

Parameters

X, Y	New position (in logical coordinates)


SetClassLong (API function)
SetClassLong (Windows API function)

Declaration

function SetClassLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint;

Description

Replaces the long value specified by Index in the window's TWndClass structure.

Parameters

Wnd	Window identifier

Index	One of the gcl_ Class field offsets or positive byte offset to set extra four-byte values

NewLong	Replacement value

Return Value

Previous value


SetClassWord (API function)
SetClassWord (Windows API function)

Declaration

function SetClassWord(Wnd: HWnd; Index: Integer; NewWord: Word): Word;

Description

Replaces the word value specified by Index in the window's TWndClass structure.

Parameters

Wnd	Window identifier

Index	One of the gcw_ Class field offsetsor positive byte offset to set extra two-byte value

NewWord	Replacement value

Return Value

Previous value


SetClipboardData (API function)
SetClipboardData (Windows API function)

Declaration

function SetClipboardData(Format: Word; Mem: THandle): THandle;

Description

Sets a data handle to the clipboard in Format. In most cases the data handle is freed before the function returns.

Parameters

Format	One of the cf_ Clipboard formats constants

Mem	Handle to global memory block containing data in Format or 0 for wm_RenderFormat message

Return Value

Data identifier assigned by clipboard


SetClipboardViewer (API function)
SetClipboardViewer (Windows API function)

Declaration

function SetClipboardViewer(Wnd: HWnd): HWnd;

Description

Adds a window to the chain of windows to be notified by a wm_DrawClipboard message whenever the clipboard changes.

Parameters

Wnd	Window identifier

Return Value

Next window in clipboard-viewer chain

See Also

ChangeClipboardChain

wm_ChangeCBChain

wm_DrawClipboard

wm_Destroy


SetCommBreak (API function)
SetCommBreak (Windows API function)

Declaration

function SetCommBreak(Cid: Integer): Integer;

Description

Suspends character transmission and places the device's transmission line in a break state.

Parameters

Cid	Communications device

Return Value

0 if successful;

negative if invalid Cid

See Also

ClearCommBreak

OpenComm


SetCommEventMask (API function)
SetCommEventMask (Windows API function)

Declaration

function SetCommEventMask(Cid: Integer; EvtMask: Word): PWord;

Description

Enables and retrieves the current state of a device's event mask.

Parameters

Cid	Communications device

EvtMask	Any combination of ev_ Comm event constants

Return Value

Pointer to an event mask; each bit set indicates an occurrence of the event

See Also

OpenComm


SetCommState (API function)
SetCommState (Windows API function)

Declaration

function SetCommState(var DCB: TDCB): Integer;

Description

Re-initializes a communications device specified by the Id field of DCB, to the state specified by DCB. Transmit and receive queues are not affected.

Parameters

DCB	TDCB structure

Return Value

0 if successful;

negative if not


SetCursor (API function)
SetCursor (Windows API function)

Declaration

function SetCursor(Cursor: HCursor): HCursor;

Description

Sets the cursor shape to the specified cursor resource.

Parameters

Cursor	Cursor resource identifier (previously returned by LoadCursor)

Return Value

Previous cursor shape;

0 if no previous cursor


SetCursorPos (API procedure)
SetCursorPos (Windows API procedure)

Declaration

procedure SetCursorPos(X, Y: Integer);

Description

Moves the cursor to the specified screen coordinates. The position is adjusted if lies outside the ClipCursor rectangle.

Parameters

X, Y	New position (in screen coordinates) of the cursor


SetDIBits (API function)
SetDIBits (Windows API function)

Declaration

function SetDIBits(DC: HDC; Bitmap: THandle; StartScan, NumScans: Word; Bits: Pointer; var BitsInfo: TBitmapInfo; Usage: Word): Integer;

Description

Sets a bitmap's bits to the given values of a device-independent bitmap (DIB) specification.

Parameters

DC	Device context identifier

Bitmap	Bitmap identifier

StartScan	Scan line number corresponding to first scan line in Bits

NumScans	Number of scan lines in Bits

Bits	Array of bytes containing the DIB bits whose format is specified by the biBitCount field of BitsInfo

BitsInfo	TBitmapInfo containing DIB information

Usage	Describes contents of bmiColors fields of BitsInfo; either one of the DIB_ Color table identifiers

Return Value

Actual number of scan lines copied if successful;

0 if not


SetDIBitsToDevice (API function)
SetDIBitsToDevice (Windows API function)

Declaration

function SetDIBitsToDevice(DC: HDC; DestX, DestY, Width, Height, SrcX, SrcY, StartScan, NumScans: Word; Bits: Pointer; var BitsInfo: TBitmapInfo; Usage: Word): Integer;

Description

Sets the bits on a device surface directly from a device-independent bitmap (DIB).

Parameters

DC	Device context identifier

DestX, DestY	Device destination rectangle origin

Width	DIB rectangle x-extent

Height	DIB rectangle y-extent

SrcX, SrcY	DIB source position

StartScan	DIB Scan line number corresponding to first scan line in Bits

NumScans	DIB scan lines in Bits

Bits	Array of bytes containing the DIB bits whose format is specified by the biBitCount field of BitsInfo

BitsInfo	TBitmapInfo containing DIB information

Usage	Describes contents of bmiColors fields of BitsInfo; either one of DIB_ Color table identifiers

Return Value

Number of set scan lines


SetDlgItemInt (API procedure)
SetDlgItemInt (Windows API procedure)

Declaration

procedure SetDlgItemInt(Dlg: HWnd; IDDlgItem: Integer; Value: Word; Signed: Bool);

Description

Sets the text of a dialog box control to the converted string value specified by Value.

Parameters

Dlg	Dialog box identifier

IDDlgItem	Control's integer ID

Value	Set value

Signed	Non-zero if Value is signed

See Also

wm_SetText


SetDlgItemText (API procedure)
SetDlgItemText (Windows API procedure)

Declaration

procedure SetDlgItemText(Dlg: HWnd; IDDlgItem: Integer; Str: PChar);

Description

Sets the caption or text of a dialog box control to the value specified by Str.

Parameters

Dlg	Dialog box identifier

IDDlgItem	Control's integer ID

Str	String (null-terminated)

See Also

wm_SetText


SetDoubleClickTime (API procedure)
SetDoubleClickTime (Windows API procedure)

Declaration

procedure SetDoubleClickTime(Count: Word);

Description

Sets maximum elapsed time allowed between the first and second clicks of a mouse double click.

Parameters

Count	Milliseconds between double clicks or 0 to use default (500) value


SetEnvironment (API function)
SetEnvironment (Windows API function)

Declaration

function SetEnvironment(PortName, Environ: PChar; Count: Word): Integer;

Description

Creates or replaces a device's environment.

Parameters

PortName	System port name (null-terminated)

Environ	Buffer containing new environment

Count	Number of bytes in Environ to copy or 0 to delete current environment

Return Value

Actual number of bytes copied;

0 if error;

-1 if environment is deleted


SetErrorMode (API function)
SetErrorMode (Windows API function)

Declaration

function SetErrorMode(Mode: Word): Bool;

Description

Specifies whether Windows displays an error box on DOS INT 24H errors. If not, Windows fails the original INT 21H call allowing the application to handle the error.

Parameters

Mode	(0) Windows displays error box, (1) Windows fails to the application

Return Value

Non-zero if set;

0 if not


SetFocus (API function)
SetFocus (Windows API function)

Declaration

function SetFocus(Wnd: HWnd): HWnd;

Description

Assigns input focus to a window directing all keyboard input to the window.

Parameters

Wnd	Window identifier or 0 to ignore key strokes

Return Value

Previous window having input focus;

0 if no such window


SetHandleCount (API function)
SetHandleCount (Windows API function)

Declaration

function SetHandleCount(Number: Word): Word;

Description

Changes the number of file handles available to task to the value specified by Number.

Parameters

Number	Number of required file handles (maximum of 255)

Return Value

Actual number of file handles made available (may be less than Number)


SetKeyboardState (API procedure)
SetKeyboardState (Windows API procedure)

Declaration

procedure SetKeyboardState(var KeyState: Byte);

Description

Copies KeyState into Windows keyboard-state table.

Parameters

KeyState	Array of 255 bytes containing key states

See Also

GetKeyboardState


SetMapMode (API function)
SetMapMode (Windows API function)

Declaration

function SetMapMode(DC: HDC; MapMode: Integer): Integer;

Description

Sets the device context mapping mode which defines logical to device units transformations for GDI and x- and y-axis orientation.

Parameters

DC	Device context identifier

MapMode	One of the mm_ Mapping modes constants

Return Value

Previous mapping mode


SetMapperFlags (API function)
SetMapperFlags (Windows API function)

Declaration

function SetMapperFlags(DC: HDC; Flag: Longint): Longint;

Description

Alters the font-mapper algorithm as specified by Flag, for mapping logical to physical fonts.

Parameters

DC	Device context identifier

Flag	If first bit set to 1, only fonts whose x- and y-aspect exactly match the device are selected

Return Value

Previous font-mapper flag


SetMenu (API function)
SetMenu (Windows API function)

Declaration

function SetMenu(Wnd: HWnd; Menu: HMenu): Bool;

Description

Sets and redraws a window's menu to the menu specified by Menu. The previous menu is not destroyed.

Parameters

Wnd	Window identifier

Menu	New menu or 0 to remove current menu

Return Value

Non-zero if successful;

0 if not

See Also

DestroyMenu


SetMenuItemBitmaps (API function)
SetMenuItemBitmaps (Windows API function)

Declaration

function SetMenuItemBitmaps(Menu: HMenu; Position, Flags: Word; BitmapUnchecked, BitmapChecked: HBitmap): Bool;

Description

Associates two bitmaps with a menu item, one is displayed when the item is checked and another when the item is unchecked.

Parameters

Menu	Menu identifier

Position	Command ID or position of menu item

Flags	One of the mf_ Menu flags constants, mf_ByCommand or mf_ByPosition

BitmapUnchecked	HBitmap to be displayed when item not checked or 0 to display nothing

BitmapChecked	HBitmap to be displayed when item checked or 0 to display nothing; if BitmapUnchecked and BitmapChecked are 0, Windows uses default checkmark

Return Value

Non-zero if successful;

0 if not


SetMessageQueue (API function)
SetMessageQueue (Windows API function)

Declaration

function SetMessageQueue(Msg: Integer): Bool;

Description

Creates a new application message queue of the specified size. The old queue is deleted.

Parameters

Msg	Size of queue

Return Value

Non-zero if successful;

0 if not


SetMetaFileBits (API function)
SetMetaFileBits (Windows API function)

Declaration

function SetMetaFileBits(Mem: THandle): THandle;

Description

Creates a memory metafile from the data specified by Mem.

Parameters

Mem	Global memory block containing metafile data previously created by GetMetaFileBits

Return Value

Memory metafile identifier if successful;

0 if not


SetPaletteEntries (API function)
SetPaletteEntries (Windows API function)

Declaration

function SetPaletteEntries(Palette: HPalette; StartIndex, NumEntries: Word; var PaletteEntries): Word;

Description

Sets logical palette entries in the specified range, to the values in PaletteEntries.

Parameters

Palette	Logical palette identifier

StartIndex	First entry to set

NumEntries	Number of entries to set

PaletteEntries	Array of TPaletteEntry structure

Return Value

Actual number of entries set;

0 if error


SetParent (API function)
SetParent (Windows API function)

Declaration

function SetParent(WndChild, WndNewParent: HWnd): HWnd;

Description

Changes the parent of a child window to WndNewParent.

Parameters

WndChild	Child window identifier

WndNewParent	Parent window identifier

Return Value

Previous parent window


SetPixel (API function)
SetPixel (Windows API function)

Declaration

function SetPixel(DC: HDC; X, Y: Integer; Color: TColorRef): Longint;

Description

Paints the pixel at the specified point.

Parameters

DC	Device context identifier

X, Y	Logical coordinates of point

Color	TColorRef specifying the color to paint the point

Return Value

Actual TColorRef used to paint;

-1 if point outside clipping region


SetPolyFillMode (API function)
SetPolyFillMode (Windows API function)

Declaration

function SetPolyFillMode(DC: HDC; PolyFillMode: Integer): Integer;

Description

Sets the polygon filling mode used by GDI functions which use the polygon algorithm for computing interior points.

Parameters

DC	Device context identifier

PolyFillMode	One of the PolyFill modes constants

Return Value

Previous filling mode if successful;

0 if not


SetProp (API function)
SetProp (Windows API function)

Declaration

function SetProp(Wnd: HWnd; Str: PChar; Data: THandle): Bool;

Description

Adds or changes an entry specified by Str, to a window's property list.

Parameters

Wnd	Window identifier

Str	String (null-terminated) or atom value created by calling AddAtom

Data	Associated property data handle

Return Value

Non-zero if added;

0 if not


SetRect (API procedure)
SetRect (Windows API procedure)

Declaration

procedure SetRect(var Rect: TRect; X1, Y1, X2, Y2: Integer);

Description

Fills Rect with the specified coordinates.

Parameters

Rect	Receiving TRect structure

X1, Y1	Upper-left corner of rectangle

X2, Y2	Lower-left corner of rectangle


SetRectEmpty (API procedure)
SetRectEmpty (Windows API procedure)

Declaration

procedure SetRectEmpty(var Rect: TRect);

Description

Sets all Rect coordinates to 0.

Parameters

Rect	Receiving TRect structure


SetRectRgn (API procedure)
SetRectRgn (Windows API procedure)

Declaration

procedure SetRectRgn(Rgn: HRgn; X1, Y1, X2, Y2: Integer);

Description

Uses the space allocated for Rgn to create a rectangular region with the specified size.

Parameters

Rgn	Region identifier

X1, Y1	Upper-left corner of rectangle region

X2, Y2	Lower-left corner of rectangle region

See Also

CreateRectRgn


SetResourceHandler (API function)
SetResourceHandler (Windows API function)

Declaration

function SetResourceHandler(Instance: THandle; ResType: Pointer; LoadFunc: TFarProc): TFarProc;

Description

Sets up a callback which is called by Windows when a resource is being locked (i.e. LockResource). The callback is passed a Mem to the stored resource, Instance, and ResInfo (from FindResource).

Parameters

Instance	Module instance whose executable file contains the resource

ResType	Pointer to short integer specifying a resource type

LoadFunc	Callback function's procedure-instance address

Return Value

Pointer to callback function


SetROP2 (API function)
SetROP2 (Windows API function)

Declaration

function SetROP2(DC: HDC; DrawMode: Integer): Integer;

Description

Sets the current drawing mode to the value specified by DrawMode. This mode specifies how object interiors and pens are combined with colors already on the display surface.

Parameters

DC	Device context identifier

DrawMode	Any one of the r2_ Binary raster operations constants

Return Value

Previous drawing mode


SetScrollPos (API function)
SetScrollPos (Windows API function)

Declaration

function SetScrollPos(Wnd: HWnd; Bar, Pos: Integer; Redraw: Bool): Integer;

Description

Sets a scroll bar's thumb to Pos.

Parameters

Wnd	Window identifier or scroll bar control identifier if Bar set to sb_Ctl

Bar	One of the sb_ Scroll bar constants

Pos	New position

Redraw	Non-zero to redraw scroll bar

Return Value

Previous position of scroll bar thumb


SetScrollRange (API procedure)
SetScrollRange (Windows API procedure)

Declaration

procedure SetScrollRange(Wnd: HWnd; Bar, MinPos, MaxPos: Integer; Redraw: Bool);

Description

Sets a scroll bar's minimum and maximum position values.

Parameters

Wnd	Window identifier or scroll bar control identifier if Bar set to sb_Ctl

Bar	One of sb_ Scroll bar constants

MinPos	Minimum scrolling position

MaxPos	Maximum scrolling position or 0 and MinPos set to 0 to hide scroll bar

Redraw	Non-zero to redraw scroll bar


SetSoundNoise (API function)
SetSoundNoise (Windows API function)

Declaration

function SetSoundNoise(Source, Duration: Integer): Integer;

Description

Sets a noise source and duration values for the play device.

Parameters

Source	Any one of the SetSoundNoise constants

Duration	Noise duration (in clock ticks)

Return Value

0 if successful;

s_SerDSR if invalid Source

See Also

s_SoundConstants


SetStretchBltMode (API function)
SetStretchBltMode (Windows API function)

Declaration

function SetStretchBltMode(DC: HDC; StretchMode: Integer): Integer;

Description

Sets the stretching mode used by StretchMode to contract a bitmap.

Parameters

DC	Device context identifier

StretchMode	One of the StretchBlt modes constants

Return Value

Previous stretching mode


SetSwapAreaSize (API function)
SetSwapAreaSize (Windows API function)

Declaration

function SetSwapAreaSize(Size: Word): Longint;

Description

Increases the amount of memory, up to one-half of remaining space after Windows is loaded, available to an application for its code segments.

Parameters

Size	Number of 16-byte paragraphs

Return Value

Actual number of paragraphs obtained in low-order word;

Maximum size available in high-order word.


SetSysColors (API procedure)
SetSysColors (Windows API procedure)

Declaration

procedure SetSysColors(Changes: Integer; var SysColor; var ColorValues);

Description

Globally sets the system colors for the display elements specified in SysColor.

Parameters

Change	Number of system colors to change

SysColor	Integer array whose indexes are color_ System color codes

ColorValues	Longint array containing corresponding RGB color value for each color index in SysColor


SetSysModalWindow (API function)
SetSysModalWindow (Windows API function)

Declaration

function SetSysModalWindow(Wnd: HWnd): HWnd;

Description

Makes a Wnd a system-modal window. The system-modal state is ended when the window is destroyed.

Parameters

Wnd	Window identifier

Return Value

Previous system-modal window


SetSystemPaletteUse (API function)
SetSystemPaletteUse (Windows API function)

Declaration

function SetSystemPaletteUse(DC: HDC; Usage: Word): Word;

Description

Allows full system palette usage by an application whose window currently has the input focus.

Parameters

DC	Device context identifier

Usage	One of the syspal_ System palette flags

Return Value

Previous system palette usage

See Also

GetSysColor

SetSysColors

UnrealizeObject

wm_SysColorChange


SetTextAlign (API function)
SetTextAlign (Windows API function)

Declaration

function SetTextAlign(DC: HDC; Flags: Word): Word;

Description

Sets text-alignment flags used by TextOutand ExtTextOut for positioning text in relationship to its bounding rectangle.

Parameters

DC	Device or display context

Flags	A combination of the ta_ Text alignment options constants

Return Value

Previous horizontal alignment in low-order byte;

previous vertical alignment in high-order byte.


SetTextCharacterExtra (API function)
SetTextCharacterExtra (Windows API function)

Declaration

function SetTextCharacterExtra(DC: HDC; CharExtra: Integer): Integer;

Description

Sets the amount of space added to each character when GDI writes a line of text.

Parameters

DC	Device context identifier

CharExtra	Amount (in logical units) of inter-character spacing

Return Value

Previous inter-character spacing


SetTextColor (API function)
SetTextColor (Windows API function)

Declaration

function SetTextColor(DC: HDC; Color: TColorRef): Longint;

Description

Sets the text color or nearest device supported color used by TextOut and ExtTextOut to draw a character's face. Also used by GDI to convert bitmaps from color to monochrome and vice versa.

Parameters

DC	Device context identifier

Color	Text TColorRef

Return Value

Previous text RGB color value

See Also

SetBkColor

SetBkMode


SetTextJustification (API function)
SetTextJustification (Windows API function)

Declaration

function SetTextJustification(DC: HDC; BreakExtra, BreakCount: Integer): Integer;

Description

Defines justification parameters used by GDI to justify a line of text.

Parameters

DC	Device context identifier

BreakExtra	Extra line space (in logical units) to be added

BreakCount	Number of break characters (usually space character) in line

Return Value

1 if successful;

0 if not

See Also

GetTextExtent

GetTextMetrics

TextOut


SetTimer (API function)
SetTimer (Windows API function)

Declaration

function SetTimer(Wnd: HWnd; IDEvent: Integer; Elapse: Word; TimerFunc: TFarProc): Word;

Description

Creates a system timer which causes a wm_Timer message to be sent to an application at the interval specified by Elapse.

Parameters

Wnd	Window identifier or 0 for no associated window

IDEvent	Non-zero timer-event identifier or ignored if Wnd is 0

Elapse	Number of milliseconds between timer events

TimerFunc	Callback function's procedure-instance address or nil to place wm_Timer messages in application queue

Return Value

IDEvent if Wnd is not 0;

new timer event if otherwise;

0 if error


SetViewportExt (API function)
SetViewportExt (Windows API function)

Declaration

function SetViewportExt(DC: HDC; X, Y: Integer): Longint;

Description

Sets a viewport's x- and y-extents which defines how GDI stretches or compresses logical units to fit device units.

Parameters

DC	Device context identifier

X, Y	New viewport extents (in device units)

Return Value

Previous x-extent in low-order words;

previous y-extents in high-order words.


SetViewportOrg (API function)
SetViewportOrg (Windows API function)

Declaration

function SetViewportOrg(DC: HDC; X, Y: Integer): Longint;

Description

Sets a viewport's origin which defines how GDI maps logical coordinates to points in device coordinates.

Parameters

DC	Device context identifier

X, Y	New viewport origin (in device units)

Return Value

X-coordinates of previous origin in low-order word;

Y-coordinates of previous origin in high-order word.


SetVoiceAccent (API function)
SetVoiceAccent (Windows API function)

Declaration

function SetVoiceAccent(Voice, Tempo, Volume, Mode, Pitch: Integer): Integer;

Description

Replaces the envelope in a voice queue.

Parameters

Voice	A voice queue (starting from 1)

Tempo	Quarter notes played per minute (default, 120)

Volume	Volume level (0 to 255)

Mode	One of the SetVoiceAccent sound constants

Pitch	Pitch of played notes (0 to 83)

Return Value

0 if successful;

one of these negative constants if not:

s_SerDMD

s_SerDTP

s_SerDVL

s_SerQFUL


SetVoiceEnvelope (API function)
SetVoiceEnvelope (Windows API function)

Declaration

function SetVoiceEnvelope(Voice, Shape, RepeatCount: Integer): Integer;

Description

Places a voice envelope in the voice queue, replacing the existing one.

Parameters

Voice	A voice queue

Shape	OEM wave-shape table index

RepeatCount	Number of repetitions of wave-shape per note

Return Value

0 if successful;

one of these negative constants if not:

s_SerQFUL

s_SerDSH

See Also

s_SoundConstants


SetVoiceNote (API function)
SetVoiceNote (Windows API function)

Declaration

function SetVoiceNote(Voice, Value, Length, Cdots: Integer): Integer;

Description

Places a note on a voice queue with the specified qualities.

Parameters

Voice	A voice queue

Value	A note (1 of 84) or 0 for rest

Length	Reciprocal of note duration

Cdots	Note duration in dots: (Length * (Cdots * 3/2))

Return Value

0 if successful;

one of these negative constants if not:

s_SerDCC

s_SerDLN

s_SerBDNT

s_SerQFUL

See Also

s_SoundConstants


SetVoiceQueueSize  (API function)
SetVoiceQueueSize (Windows API function)

Declaration

function SetVoiceQueueSize(Voice, Bytes: Integer): Integer;

Description

Sets the size of non-playing voice queue. The default is 192 bytes or approximately 32 notes.

Parameters

Voice	A voice queue

Bytes	Size (in bytes) of voice queue

Return Value

0 if successful;

one of these negative constants if not:

s_SerMACT

s_SerOFM

See Also

s_SoundConstants


SetVoiceSound (API function)
SetVoiceSound (Windows API function)

Declaration

function SetVoiceSound(Voice: Longint; Frequency: Longint; Duration: Integer): Integer;

Description

Places the specified sound frequency and duration on a voice queue.

Parameters

Voice	A voice queue

Frequency	Hertz and fractional frequency in high- and low-order words, respectively

Duration	Sound duration (in clock ticks)

Return Value

0 if successful;

one of these negative constants if not:

s_SerDDR

s_SerDFQ

s_SerDVL

s_SerQFUL

See Also

s_SoundConstants


SetVoiceThreshold (API function)
SetVoiceThreshold (Windows API function)

Declaration

function SetVoiceThreshold(Voice, Notes: Integer): Integer;

Description

Sets the threshold level for a voice queue. If the number of notes in queue drop below the threshold the threshold flag is set.

Parameters

Voice	A voice queue

Notes	Number of notes specifying the threshold level

Return Value

0 if successful;

1 if Notes out of range

See Also

GetThresholdStatus


SetWindowExt (API function)
SetWindowExt (Windows API function)

Declaration

function SetWindowExt(DC: HDC; X, Y: Integer): Longint;

Description

Sets a window's x- and y-extents. This, along with the viewport extents, defines how GDI stretches or compresses logical units to fit device units.

Parameters

DC	Device context identifier

X, Y	Window extents

Return Value

Previous x-extents in low-order words;

previous y-extents in high-order words;

0 if error


SetWindowLong (API function)
SetWindowLong (Windows API function)

Declaration

function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint;

Description

Replaces an attribute of a window's window-class structure with a new value.

Parameters

Wnd	Window identifier

Index	One of the gwl_ Window field offsets or positive byte offset to access extra four-byte values

NewLong	Replacement value

Return Value

Previous value


SetWindowOrg (API function)
SetWindowOrg (Windows API function)

Declaration

function SetWindowOrg(DC: HDC; X, Y: Integer): Longint;

Description

Sets a window's origin within the viewport of the specified device context.

Parameters

DC	Device context identifier

X, Y	New window origin

Return Value

Previous x-coordinate in low-order word;

previous y-coordinate in high-order word.


SetWindowPos (API procedure)
SetWindowPos (Windows API procedure)

Declaration

procedure SetWindowPos(Wnd, WndInsertAfter: HWnd; X, Y, cx, cy: Integer; Flags: Word);

Description

Changes the size, position, and ordering of a window.

Parameters

Wnd	Window identifier

WndInsertAfter	Preceding window in window-manager's list

X, Y	Upper left corner

cx	New window width

cy	New window height

Flags	One of the swp_ Set window position flags


SetWindowsHook (API function)
SetWindowsHook (Windows API function)

Declaration

function SetWindowsHook(FilterType: Integer; FilterFunc: TFarProc): TFarProc;

Description

Installs a filter function in the chain of filter functions specified by FilterType. The filter function is passed an Code, wParam, and lParam whose values are filter type dependent.

Parameters

FilterType	One of the wh_ Windows hook codes

FilterFunc	Filter function's procedure-instance address

Return Value

Procedure-instance address of previously installed filter function;

nil if no previous filter

See Also

DefHookProc


SetWindowText  (API procedure)
SetWindowText (Windows API procedure)

Declaration

procedure SetWindowText(Wnd: HWnd; Str: PChar);

Description

Sets the caption title for a window or text of a control with the string specified by Str.

Parameters

Wnd	Window or control identifier

Str	String (null-terminated)


SetWindowWord (API function)
SetWindowWord (Windows API function)

Declaration

function SetWindowWord(Wnd: HWnd; Index: Integer; NewWord: Word): Word;

Description

Changes the value of an attribute specified by Index, in a window's window-class structure.

Parameters

Wnd	Window identifier

Index	One of the gww_ Window field offsets or positive byte offset to access extra two-byte values

NewWord	Replacement value

Return Value

Previous value


ShowCaret (API procedure)
ShowCaret (Windows API procedure)

Declaration

procedure ShowCaret(Wnd: HWnd);

Description

Shows a caret which is owned by Wnd on the display.

Parameters

Wnd	Window identifier or 0 for a window in the current task


ShowCursor (API function)
ShowCursor (Windows API function)

Declaration

function ShowCursor(Show: Bool): Integer;

Description

Shows the cursor if its display count (initially set to 0) is greater or equal to 0. Otherwise the cursor is hidden.

Parameters

Show	Non-zero to increment display count or 0 to decrement display count

Return Value

New display count


ShowOwnedPopups (API procedure)
ShowOwnedPopups (Windows API procedure)

Declaration

procedure ShowOwnedPopups(Wnd: HWnd; Show: Bool);

Description

Shows or hides, as specified by Show, all popup windows associated with the given window.

Parameters

Wnd	Window identifier

Show	Non-zero to show all hidden popups or 0 to hide all visible popups


ShowScrollBar (API procedure)
ShowScrollBar (Windows API )procedure

Declaration

procedure ShowScrollBar(Wnd: HWnd; Bar: Word; Show: Bool);

Description

Shows or hides a scroll bar as specified by Show.

Parameters

Wnd	Window identifier or scroll bar control if Bar set to sb_Ctl

Bar	One of the sb_ Scroll bar constants

Show	Non-zero to show scroll bar or 0 to hide scroll bar


ShowWindow (API function)
ShowWindow (Windows API function)

Declaration

function ShowWindow(Wnd: HWnd; CmdShow: Integer): Bool;

Description

Shows or hides a window in the manner specified by CmdShow.

Parameters

Wnd	Window identifier

CmdShow	One of the sw_ Show window constants

Return Value

Non-zero if window was previously visible;

0 if previously hidden


SizeofResource (API function)
SizeofResource (Windows API function)

Declaration

function SizeofResource(Instance, ResInfo: THandle): Word;

Description

Retrieves the size of a resource. The returned size may larger due to alignment factors.

Parameters

Instance	Module instance whose executable file contains the resource

ResInfo	Desired resource, returned by FindResource

Return Value

Size (in bytes) of resource;

0 if not found

See Also

AccessResource


StartSound (API function)
StartSound (Windows API function)

Declaration

function StartSound: Integer;

Description

Non-destructively plays all voice queue.

Return Value

Not used


StopSound (API function)
StopSound (Windows API function)

Declaration

function StopSound: Integer;

Description

Stops playing all voice queues, flushes queue contents, and turns off voice sound drivers.

Return Value

Not used


StretchBlt (API function)
StretchBlt (Windows API function)

Declaration

function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Rop: Longint): Bool;

Description

Moves a bitmap, stretching or compressing as required, from a source rectangle to a destination rectangle. The source and destination are combined as specified by Rop.

Parameters

DestDC	Receiving device context

X, Y	Upper-left corner of destination rectangle

Width	Destination rectangle width (in logical units)

Height	Destination rectangle height (in logical units)

SrcDC	Source bitmap device context

XSrc, YSrc	Upper-left corner of source rectangle

SrcWidth	Source rectangle width (in logical units)

SrcHeight	Source rectangle height (in logical units)

Rop	Ternary raster operations to be performed

Return Value

Non-zero if bitmap is drawn;

0 if not

See Also

SetStretchBltMode


SwapMouseButton (API function)
SwapMouseButton (Windows API function)

Declaration

function SwapMouseButton(Swap: Bool): Bool;

Description

Reverses or restores the meaning of the left and right mouse button as specified by Swap.

Parameters

Swap	Non-zero to swap button meanings or 0 to restore original meanings

Return Value

Non-zero if meanings reversed;

0 if not


SwapRecording (API procedure)
SwapRecording (Windows API procedure)

Declaration

procedure SwapRecording(Flag: Word);

Description

Used to begin or end analyzing swapping behavior when running Windows Swap program.

Parameters

Flag	(0) stop analyzing, (1) record swap calls and discard swap returns, (2) same as 1 and calls through thunks


SwitchStackBack (API procedure)
SwitchStackBack (Windows API procedure)

Declaration

procedure SwitchStackBack;

Description

Restores the current task's stack to its data segment preserving the contents of AX:DX registers.

See Also

SwitchStackTo


SwitchStackTo (API procedure)
SwitchStackTo (Windows API procedure)

Declaration

procedure SwitchStackTo(StackSegment, StackPointer, StackTop: Word);

Description

Changes the stack of the current task to StackSegment. Can be used to set the stack of a DLL to its data segment if it has functions that assume DS=SS.

Parameters

StackSegment	Data segment to contain the stack

StackPointer	Beginning stack offset into StackSegment

StackTop	Top of stack offset from StackPointer

See Also

SwitchStackBack


SyncAllVoices (API function)
SyncAllVoices (Windows API function)

Declaration

function SyncAllVoices: Integer;

Description

Places a sync mark in all voice queues.

Return Value

0 if successful;

s_SerQFUL if voice queue full

See Also

s_ Sound constants


TabbedTextOut (API function)
TabbedTextOut (Windows API function)

Declaration

function TabbedTextOut(DC: HDC; X, Y: Integer; Str: PChar; Count, TabPositions: Integer; var TabStopPositions; TabOrigin: Integer): Longint;

Description

Draws a line of text with tabs expanded as specified in TabStopPositions, using the selected font.

Parameters

DC	Device context identifier

X, Y	String starting point

Str	String to be drawn

Count	Size (in characters) of Str

TabPositions	Number of tab-stop positions in TabStopPositions or 0 if tab-stops are expanded eight average character widths

TabStopPositions	Integer array containing ascending tab-stop positions (in pixels)

TabOrigin	Starting position (in logical units) from which tabs are expanded

Return Value

Not used


TextOut (API function)
TextOut (Windows API function)

Declaration

function TextOut(DC: HDC; X, Y: Integer; Str: PChar; Count: Integer): Bool;

Description

Draws a line of text using the currently selected font.

Parameters

DC	Device context identifier

X, Y	String starting point

Str	String to be drawn

Count	Size (in characters) of Str

Return Value

Non-zero if drawn;

0 if not

See Also

SetTextAlign


Throw (API procedure)
Throw (Windows API procedure)

Declaration

procedure Throw(var CatchBuf: TCatchBuf; ThrowBack: Integer);

Description

Restores an application's execution environment. Execution continues at the Catch function that originally saved the environment to CatchBuf.

Parameters

CatchBuf	TCatchBuf containing the execution environment

ThrowBack	Value returned to Catch function


ToAscii (API function)
ToAscii (Windows API function)

Declaration

function ToAscii(VirtKey, ScanCode: Word; KeyState: PChar; CharBuff: Pointer; Flags: Word): Integer;

Description

Translates VirtKey and current keyboard state into corresponding ANSI characters.

Parameters

VirtKey	Virtual-key code

ScanCode	Raw key scan code, high bit set if key up

KeyState	Array of 256 Bytes containing the state of each key, high bit set if key up

CharBuff	Pointer to a 32-bit receiving buffer

Flags	Not used

Return Value

(2) accent and dead key copied to CharBuff,

(1) one ANSI character copied to CharBuff,

(0) translation not possible with current keyboard state


TrackPopupMenu (API function)
TrackPopupMenu (Windows API function)

Declaration

function TrackPopupMenu(Menu: HMenu; Flags: Word; x, y, cx: Integer; Wnd: HWnd; var Rect: TRect): Bool;

Description

Displays a floating popup menu and tracks item selection. Floating popup menus may appear anywhere on the screen.

Parameters

Menu	Popup menu identifier

Flags	Set to 0, not used

x, y	Upper-left position (in screen coordinates) of menu

cx	Menu width (in screen units) or 0 for default

Wnd	Owning window of the popup menu, to receive wm_Command messages

Rect	TRect defining mouse area where menu remains visible if the user releases the mouse button

Return Value

Non-zero if successful;

0 if not

See Also

CreatePopupMenu

GetSubMenu


TranslateAccelerator (API function)
TranslateAccelerator (Windows API function)

Declaration

function TranslateAccelerator(Wnd: HWnd; AccTable: THandle; var Msg: TMsg): Integer;

Description

Translates keyboard accelerators (wm_KeyUp and wm_KeyDown) into menu command messages, wm_Command and wm_SysCommand, which are then sent directly to the window.

Parameters

Wnd	Window identifier

AccTable	Accelerator table identifier (returned by LoadAccelerators)

Msg	TMsg information retrieved from GetMessage or PeekMessage

Return Value

Non-zero if translation occurred;

0 if not


TranslateMDISysAccel (API function)
TranslateMDISysAccel (Windows API function)

Declaration

function TranslateMDISysAccel(Wnd: HWnd; var Msg: TMsg): Bool;

Description

Translates keyboard accelerators for MDI child window System-menu wm_SysCommand messages which are then sent directly to the window.

Parameters

Wnd	MDI client parent window

Msg	TMsg information retrieved from GetMessage or PeekMessage

Return Value

Non-zero if translation occurred;

0 if not


TranslateMessage (API function)
TranslateMessage (Windows API function)

Declaration

function TranslateMessage(var Msg: TMsg): Bool;

Description

Translates wm_KeyDown/wm_KeyUp combinations to wm_Charor wm_DeadChar and wm_SysKeyDown/wm_SysKeyUp combinations to wm_SysChar or wm_SysDeadChar and posts the character message to the application queue.

Parameters

Msg	TMsg information retrieved from GetMessage or PeekMessage

Return Value

Non-zero if translation occurred;

0 if not


TransmitCommChar (API function)
TransmitCommChar (Windows API function)

Declaration

function TransmitCommChar(Cid: Integer; AChar: Char): Integer;

Description

Places AChar at the head of the communications device's transmit queue for immediate transmission.

Parameters

Cid	Communications device

AChar	Character to transmit

Return Value

0 if successful;

negative if cannot transmit because previous character has not been sent yet.

See Also

OpenComm


UngetCommChar (API function)
UngetCommChar (Windows API function)

Declaration

function UngetCommChar(Cid: Integer; AChar: Char): Integer;

Description

Places AChar back into communications device's receiving queue.

Parameters

Cid	Communications device

AChar	Character to unget

Return Value

0 if successful;

negative if not

See Also

OpenComm


UnhookWindowsHook (API function)
UnhookWindowsHook (Windows API function)

Declaration

function UnhookWindowsHook(Hook: Integer; HookFunc: TFarProc): Bool;

Description

Removes a hook function from the chain of hook functions specified by Hook.

Parameters

Hook	One of wh_ Windows hook codes

HookFunc	Hook function's procedure-instance address

Return Value

Non-zero if successful;

0 if not


UnionRect (API function)
UnionRect (Windows API function)

Declaration

function UnionRect(var DestRect, Src1Rect, Src2Rect: LPRect): Integer;

Description

Creates a union of two rectangles and stores the result in DestRect.

Parameters

DestRect	Result TRect structure

Src1Rect	Source TRect structure 1

Src2Rect	Source TRect structure 2

Return Value

Non-zero if union not empty;

0 if empty


UnlockData (API function)
UnlockData (Windows API function)

Declaration

function UnlockData(Dummy: Integer): THandle;

Description

Unlocks the current, moveable data segment.

Parameters

Dummy	Not used; set to 0

Return Value

Identifier for the unlocked segment,

0 if unsuccessful


UnlockResource (API function)
UnlockResource (Windows API function)

Declaration

function UnlockResource(RezData: THandle): Bool;

Description

Unlocks the RezData resource and decrements its reference counter.

Parameters

RezData	Global memory block Identifier

Return Value

0 if the reference counter is 0;

non-zero if not


UnlockSegment (API function)
UnlockSegment (Windows API function)

Declaration

function UnlockSegment(Segment: Word): THandle;

Description

Unlocks a segment specified by Segment.

Parameters

Segment	Segment address or -1 to unlock current data segment

Return Value

0 if reference count decremented to 0;

non-zero if not

See Also

LockSegment


UnrealizeObject (API function)
UnrealizeObject (Windows API function)

Declaration

function UnrealizeObject(hObject: HBrush): Bool;

Description

Directs GDI to reset the origin the next time selected if hObject is a brush or realize the palette if hObject is a logical palette.

Parameters

hObject	Object to be reset

Return Value

Non-zero if successful;

0 if not


UnregisterClass (API function)
UnregisterClass (Windows API function)

Declaration

function UnregisterClass(ClassName: PChar; Instance: THandle): Bool;

Description

Deletes a window class from the window-class table and frees all associated memory.

Parameters

ClassName	Class name (null-terminated) of a previously registered class

Instance	Module instance that created the class

Return Value

Non-zero if successful;

0 if invalid ClassName or a window of the class exits

See Also

RegisterClass


UpdateColors (API function)
UpdateColors (Windows API function)

Declaration

function UpdateColors(DC: HDC): Integer;

Description

Updates the client area by matching the current colors of the client area pixel-by-pixel with the system palette.

Parameters

DC	Device context identifier

Return Value

Not used


UpdateWindow (API procedure)
UpdateWindow (Windows API procedure)

Declaration

procedure UpdateWindow(Wnd: HWnd);

Description

Sends a wm_Paint message directly the given window's window function if the update region of the window is not empty.

Parameters

Wnd	Window identifier


ValidateFreeSpaces (API function)
ValidateFreeSpaces (Windows API function)

Declaration

function ValidateFreeSpaces: Pointer;

Description

Checks all free memory segments for valid contents. This function works only in the debugging version of Windows.

Return Value

Not used


ValidateCodeSegments (API procedure)
ValidateCodeSegments (Windows API procedure)

Declaration

procedure ValidateCodeSegments;

Description

Outputs debugging information to a terminal if any code segments have been altered by random memory overwrites.

Only available in the debugging version of Windows.

To disable the function, set the EnableSegmentChecksum flag in the [kernel] section of WIN.INI to 0.

Not used in Standard and 386-Enhanced modes of Windows.


ValidateRect (API procedure)
ValidateRect (Windows API procedure)

Declaration

procedure ValidateRect(Wnd: HWnd; Rect: LPRect);

Description

Validates the client area by removing Rect from the window's update region.

Parameters

Wnd	Window identifier

Rect	TRect (in client coordinates) to be removed from update region or nil for entire client area

See Also

BeginPaint


ValidateRgn (API procedure)
ValidateRgn (Windows API procedure)

Declaration

procedure ValidateRgn(Wnd: HWnd; Rgn: HRgn);

Description

Validates the client area by removing the region specified by Rgn from the window's update region.

Parameters

Wnd	Window identifier

Rgn	Region identifier (in client coordinates)


VkKeyScan (API function)
VkKeyScan (Windows API function)

Declaration

function VkKeyScan(AChar: Word): Word;

Description

Translates AChar into its corresponding virtual-key code and shift state.

Parameters

AChar	ANSI character to find corresponding virtual-key code

Return Value

Virtual-key code in the low-order byte;

the following shift states in the high-order byte:

(0) no shift,

(1) shifted,

(2) control char,

(6) Control+Alt,

(7) Shift+Control+Alt,

or (3), (4), or (5), which are not used for characters.

In the case of an error, both bytes hold -1


WaitMessage (API procedure)
WaitMessage (Windows API procedure)

Declaration

procedure WaitMessage;

Description

Yields control to other applications and does not return until a message becomes available in the application queue.


WaitSoundState (API function)
WaitSoundState (Windows API function)

Declaration

function WaitSoundState(State: Integer): Integer;

Description

Waits for the play driver to enter the state specified by State.

Parameters

State	One of the WaitSoundState constants

Return Value

0 if successful;

s_SerDST if invalid State

See Also

s_SoundConstants


WindowFromPoint (API function)
WindowFromPoint (Windows API function)

Declaration

function WindowFromPoint(Point: TPoint): HWnd;

Description

Determines the window that contains the specified point.

Parameters

Point	TPoint to be checked (in screen coordinates)

Return Value

Window identifier;

0 if no window at specified point


WinExec (API function)
WinExec (Windows API function)

Declaration

function WinExec(CmdLine: PChar; CmdShow: Word): Word;

Description

Executes a application specified by CmdLine.

Parameters

CmdLine	Command line to execute the application (null-terminated)

CmdShow	Specifies how application window is to be initially shown (see ShowWindow)

Return Value

Value greater than 32 if successful;

if not, returns one of the following:

(0) no memory

(5) attempted to dynamically link to a task

(6) library has multiple data segments

(10) Windows version incorrect

(11) invalid EXE file

(12) OS/2 application

(13) DOS 4.0 application

(14) unknown EXE type

(15) not a protected-mode application


WinHelp (API function)
WinHelp (Windows API function)

Declaration

function WinHelp(Wnd: HWnd; HelpFile: PChar; Command: Word; Data: Longint): Bool;

Description

Invokes Windows help engine with a command specified by Command.

Parameters

Wnd	Window identifier

HelpFile	Name (null-terminated) of help file including path, if needed

Command	One of the help_ Help commands

Data	Context identifier number if Command set to help_Context or help topic keyword (null-terminated) if Command set to help_Key

Return Value

Non-zero if successful;

0 if not


WriteComm (API function)
WriteComm (Windows API function)

Declaration

function WriteComm(Cid: Integer; Buf: PChar; Size: Integer): Integer;

Description

Outputs the buffer specified by Buf to a communications device.

Parameters

Cid	Communications device

Buf	Buffer containing characters to be written

Size	Number of characters to output

Return Value

Actual number of characters written;

negative value if error whose absolute value is the number characters written before the error occurred


WritePrivateProfileString (API function)
WritePrivateProfileString (Windows API function)

Declaration

function WritePrivateProfileString(ApplicationName, KeyName, Str, FileName: PChar): Bool;

Description

Searches FileName for the specified application heading and key name replacing the value with Str.

Parameters

ApplicationName	Application heading name

KeyName	Key name appearing under the application heading name or nil to delete entire section

Str	New key value string or nil to delete key name

FileName	Initialization file name (null-terminated)

Return Value

Non-zero if successful;

0 if not


WriteProfileString (API function)
WriteProfileString (Windows API function)

Declaration

function WriteProfileString(ApplicationName, KeyName, Str: PChar): Bool;

Description

Searches WIN.INI for the specified application heading and key name replacing the value with Str.

Parameters

ApplicationName	Application heading

KeyName	Key name appearing under the application heading name or nil to delete entire application section

Str	New key name value or nil to delete key name

Return Value

Non-zero if successful;

0 if not


wvsprintf (API function)
wvsprintf (Windows API function)

Declaration

function wvsprintf(Output, Format, ArgList: PChar): Integer;

Description

Formats and stores a series of characters in a buffer.

Parameters

Output	Buffer to receive formatted characters

Format	Format control string

ArgList	An array of arguments to the format control string

Return Value

If successful, the number of characters in Output, (not counting 0).

If not successful, the number of characters returned is less than the length of Format.


Yield (API function)
Yield (Windows API function)

Declaration

function Yield: Bool;

Description

Halts the current task and starts a waiting task.

Return Value

Not used


Index to Compiler Directives
Index of Compiler Directives

Compiler Directives

Switch Directives

$A	(Align Data)

$B	(Boolean Evaluation)

$D	(Debug Information)

$F	(Force Far Calls)

$G	(Generate 80286 Code)

$I	(Input/Output-Checking)

$L	(Local Symbol Information)

$N	(80x87 Numeric Coprocessor)

$R	(Range-Checking)

$S	(Stack-Overflow Checking)

$V	(Var-String Checking)

$W	(Windows Stack Frame)

$X	(Extended Syntax)

Parameter Directives

$C xxx	(Code Segment Attribute)

$D xxx	(Description)

$I xxx	(Include File)

$L xxx	(Link Object File)

$M xxx	(Memory Allocation Sizes)

$R xxx	(Resource File)

Conditional Directives

DEFINE

ELSE

ENDIF

IFDEF

IFNDEF

IFOPT

Conditional Compilation Constructs

Directives and IDE Equivalents


Turbo Pascal's Standard Units

A unit is a collection of constants, data types, variables, procedures, and functions.

Turbo Pascal provides the following standard units:

Strings

System

WinCrt

WinDOS

WinProcs

WinTypes

These standard units provide support for your Turbo Pascal programs and are all stored in TPW.TPL.

Each unit is almost like a separate Pascal program: It can have a main body that is called before your program starts and does whatever initialization is necessary.


Turbo Pascal Language Elements

Character strings

Comments

Constant declarations

Expressions

Functions

Identifiers

Labels

Numbers

Operators

Procedures

Reserved words

Rules of scope

Special symbols

Statements

Typed constants

Type declarations

Units

Variables


Turbo Pascal Types

When you write a program, you're working with information that generally falls into one of five basic types: integers, real numbers, characters and strings, Boolean, and pointers.

Integers are the whole numbers you learned to count with (1, 5, -21, and 752, for example).

Real numbers have fractional portions (3.14159) and exponents (2.579x1024). These are also sometimes known as floating-point numbers.

Characters are letters of the alphabet, symbols, and the numbers 0-9. They can be used individually (a, Z, !, 3) or combined into character strings ('This is only a test.').

Boolean expressions have one of two possible values: True or False. They are used in conditional expressions, which we'll discuss later.

Pointers hold the addresses of locations in the computer's memory, which in turn hold information.

See Also

type declarations


Type declarations

When you declare a variable, you must state its type.

A variable's type circumscribes the set of values it can have and the operations that can be performed on it. A type declaration specifies the identifier that denotes a type.

When an identifier occurs on the left side of a type declaration, it is declared as a type identifier for the block in which the type declaration occurs.

A type identifier's scope does not include itself, except for pointer types.

There are six major classes of types:

1.	Simple types define ordered sets of values.

Ordinal types

Integer types

Boolean types

Char type

Enumerated types

Subrange types

Real types

2.	String types are a sequence of characters with a dynamic length attribute and a constant size attribute.

3.	Structured types hold more than one value.

Array types

Record types

Object types

Set types

File types

4.	Pointer types define a set of values that point to dynamic variables of a specified type.

5.	Procedural types allow procedures and functions to be treated as objects.

6.	Object types are structures consisting of a fixed number of components.


Procedural types

Standard Pascal regards procedures and functions strictly as program parts that can be executed through procedure or function calls.

Turbo Pascal has a much broader view of procedures and functions. Through procedural types, it allows procedures and functions to be treated as objects that can be assigned to variables and passed as parameters.

A procedural type declaration specifies the parameters and, for a function, the result type.

The syntax for a procedural type declaration is exactly the same as for a procedure or function header, except that the identifier after the procedure or function keyword is omitted.

Examples

type

  Proc = procedure;

  SwapProc = procedure(var X, Y: Integer);

  StrProc = procedure(S: string);

  MathFunc = function(X: Real): Real;

  DeviceFunc = function(var F: text): Integer;

  MaxFunc = function(A, B: Real; F: MathFunc): Real;

The parameter names in a procedural type declaration have no effect on the meaning of the declaration.

Turbo Pascal does not allow you to declare functions that return procedural type values.

A function result value must be a string, Real, Integer, Char, Boolean, Pointer, or a user-defined enumeration.

See Also

Procedural-type constants


Structured types

A structured type holds more than one value. Structured types consist of

array types

file types

object types

record types

set types

If a component type is structured, the resulting structured type has more than one level of structuring. A structured type can have unlimited levels of structuring.

The maximum permitted size of any structured type in Turbo Pascal is 65,520 bytes.

The reserved word packed in a structured type's declaration tells the compiler to compress data storage.

See Also

Structured-type constants


Software floating point

In the {$N-} state (on by default), the code generated performs all real type calculations in software by calling run-time library routines.

For reasons of speed and code size, only operations on variables of type real are allowed in this state.

Any attempt to compile statements that operate on the Single, Double, Extended, and Comp types generates an error.


80x87 floating point

In the {$N+} state, the code generated performs all real type calculations using 80x87 instructions and can use all five real types.


Scope of a component identifier

The scope of a component identifier extends over the domain of its object type, and over procedure, function, constructor, and destructordestructor blocks that implement methods of the object type and its descendants.

Because of this, the spelling of a component identifier must be unique within an object type and all its descendants and all its methods.

The scope of a component identifier declared in the private section of an object type declaration is restricted to the module (program or unit) that contains the object type declaration.

private component identifiers act like normal public component identifiers within the module that contains the object type declaration.

Outside the module, any private component identifiers are unknown and inaccessible.

If you place related object types in the same module, these object types can gain access to each others private components without making the private components known to other's modules.


Variable declarations

A variable declaration embodies a list of identifiers that designate new variables (var) and their type.

Examples

var

  X, Y, Z; Real;

  I, J, K: Integer;

  Digit: 0..9;

  C: Color;

  Done,Error: Boolean

  Operator: (Plus, Minus, Times);

  Hue1, Hue2: set of Color;

  Today: Date;

  Matrix: array[1..10, 1..10] of Real;

The type given for the variable(s) can be a type identifier previously declared

 -	in a type declaration part in the same block, or

 -	in an enclosing block, or

 -	in a unit

It can also be a new type definition.

When an identifier is specified within the identifier list of a variable declaration, that identifier is a variable identifier for the block in which the declaration occurs.

The variable can then be referred to throughout the block, unless the identifier is redeclared in an enclosed block.

Redeclaration causes a new variable using the same identifier, without affecting the value of the original variable.

See Also

var (reserved word)

Global and local variables


Global and local variables

Global variables are declared outside procedures and functions and reside in the data segment.

Local variables are declared within procedures and functions, and reside in the stack segment.


Typed constants

Typed constants are similar to initialized variables (variables whose values are defined on entry to their block).

Unlike an untyped constant, the declaration of a typed constant specifies both the type and the value of the constant.

Typed constants can be used exactly like variables of the same type, and can appear on the left-hand side in an assignment statement.

Note: Typed constants are initialized only once--at the beginning of a program. For each entry to a procedure or function, the locally declared typed constants are not reinitialized.

In addition to a normal constant expression, the value of a typed constant can be specified with a constant address expression.

Examples

(* Typed Constant Declarations *)

type

  Point = record X, Y: real end;

const

  Minimum: Integer = 0;

  Maximum: Integer = 9999;

  Factorial: array[1..7] of Integer = (1, 2, 6, 24, 120, 720, 5040);

  HexDigits: set of Char = ['0'..'9', 'A'..'Z', 'a'..'z'];

  Origin: Point = (X: 0.0; Y: 0.0);

See Also

Array-type constants

Object-type constants

Pointer-type constants

Procedural-type constants

Record-type constants

Set-type constants

Simple-type constants

String-type constants

Structured-type constants


Array-type constants

The declaration of an array-type constant specifies the values of the components.

The component type of an array constant can be any type except a file type.

Example

type

  Status = (Active, Passive, Waiting);

  StatusMap = array[Status] of string[7];

const

  StatStr: StatusMap = ('Active', 'Passive', 'Waiting');

{ These are the components of StatStr:

  StatStr[Active] = 'Active'

  StatStr[Passive] = 'Passive'

  StatStr[Waiting] = 'Waiting' }

Character arrays

Packed string-type constants (character arrays) can be specified both as single characters and as strings. For example, this definition:

  const

    Digits: array[0..9] of Char = ('0', '1', '2', '3', '4', '5',

      '6', '7', '8', '9');

can be expressed more conveniently as:

  const

    Digits: array[0..9] of Char = '0123456789';

Zero-based character arrays

A zero-based character array is one where the first element is 0 and the last element is a positive non-zero integer. For example:

  array[0..X] of Char

When you enable the extended syntax (with a {$X+} compiler directive), a zero-based character array can be initialized with a string that is shorter than the declared length of the array. For example:

  const

    FileName = array[0..79] of Char = 'TEST.PAS';

When the string is shorter than the array's length, the remaining characters are set to NULL (#0) and the array will effectively contain a null-terminated string.

Multidimensional array constants

Multidimensional array constants are defined by enclosing the constants of each dimension in separate sets of parentheses, separated by commas.

The innermost constants correspond to the rightmost dimensions.

For example, this declaration:

  type

    Cube = array[0..1, 0..1, 0..1] of Integer;

  const

    Maze: Cube = (((0, 1), (2, 3)), ((4, 5), (6, 7)));

provides an initialized array Maze with the following values:

  Maze[0, 0, 0] = 0

  Maze[0, 0, 1] = 1

  Maze[0, 1, 0] = 2

  Maze[0, 1, 1] = 3

  Maze[1, 0, 0] = 4

  Maze[1, 0, 1] = 5

  Maze[1, 1, 0] = 6

  Maze[1, 1, 1] = 7


Object-type constants

The declaration of an object-type constant uses the same syntax as the declaration of a record-type constant.

No value is, or can be, specified for method components.

Examples

const

  ZeroPoint: Point = (X: 0; Y: 0);

  ScreenRect: Rect = (A: (X: 0; Y: 0); B: (X: 80; Y: 25));

  CountField: NumField = (X: 5; Y: 20; Len: 4; Name: nil;

    Value: 0; Min: -999; Max: 999);

Constants of an object type that contains virtual methods do not need to be initialized through a constructor call--this initialization is handled automatically by the compiler.


Pointer-type constants

The declaration of a pointer-type constant typically uses a constant address expression to specify the pointer value.

When you enable the extended syntax (with a {$X+} compiler directive), a typed constant of type PChar can be initialized with a string constant.

Examples

  type

    Direction = (Left, Right, Up, Down);

    StringPtr = ^String;

    NodePtr = ^Node;

    Node = record

      Next: NodePtr;

      Symbol: StringPtr;

      Value: Direction;

    end;

  const

    S1: string[4] = 'DOWN';

    S2: string[2] = 'UP';

    S3: string[5] = 'RIGHT';

    S4: string[4] = 'LEFT';

    N1: Node = (Next: nil; Symbol: @S1; Value: Down);

    N2: Node = (Next: @N1; Symbol: @S2; Value: Up);

    N3: Node = (Next: @N2; Symbol: @S3; Value: Right);

    N4: Node = (Next: @N3; Symbol: @S4; Value: Left);

    DirectionTable: NodePtr = @N4;


Procedural-type constants

A procedural-type constant must specify the identifier of a procedure or function that is assignment compatible with the type of the constant.

Example

type

  ErrorProc = procedure(ErrorCode: Integer);

procedure DefaultError(ErrorCode: Integer); far;

begin

  WriteLn('Error ', ErrorCode, '.');

end;

const

  ErrorHandler: ErrorProc = DefaultError;

See Also

Typed constants


Record-type constants

The declaration of a record-type constant specifies the identifier and value of each field.

The fields must be specified in the same order as they appear in the definition of the record type.

 -	If a record contains fields of file types, the constants of that record type cannot be declared.

 -	If a record contains a variant, only fields of the selected variant can be specified.

 -	If the variant contains a tag field, its value must be specified.

Examples

type

  Point = record

    X, Y: Real;

  end;

  Vector = array[0..1] of Point;

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

  Date = record

    D: 1..31;

    M: Month;

    Y: 1900..1999;

  end;

const

  Origin: Point = (X: 0.0; Y: 0.0);

  Line: Vector = ((X: -3.1; Y: 1.5), (X: 5.8; Y: 3.0));

  SomeDay: Date = (D: 2; M: Dec; Y: 1960);


Set-type constants

The declaration of a set-type constant specifies the value of the set using a constant expression.

Examples

type

  Digits = set of 0..9;

  Letters = set of 'A'..'Z';

const

  EvenDigits: Digits = [0, 2, 4, 6, 8];

  Vowels: Letters = ['A', 'E', 'I', 'O', 'U', 'Y'];

  HexDigits: set of '0'..'z' = ['0'..'9', 'A'..'F', 'a'...f'];


Simple-type constants

Declaring a typed constant as a simple type specifies the value of the constant.

The value of a typed constant may be specified using a constant address expression.

Because a typed constant is actually a variable with a constant value, it cannot be interchanged with ordinary constants.

Examples

const

  Maximum: Integer = 9999;

  Factor: Real = -0.1;

  Breakchar: Char = #3;


String-type constants

The declaration of a typed constant of a string type specifies the maximum length of the string and its initial value:

Examples

const

  Heading: string[7] = 'Section';

  NewLine: string[2] = #13#10;

  TrueStr: string[5] = 'Yes';

  FalseStr: string[5] = 'No';


Structured-type constants

The declaration of a structured-type constant specifies the value of each of the structure's components.

Turbo Pascal supports the declaration of type array, record, set, and pointer constants.

Not allowed

Type file constants

Constants of array and record types that contain type file components


Constant address expression

A constant address expression is an expression that involves taking the address, offset, or segment of a global variable, a typed constant, a procedure, or a function.

Constant address expressions cannot reference local variables or dynamic (heap based) variables, since their addresses cannot be computed at compile-time.


Assignment statements

Assignment statements do either of the following:

 1.	Replace the current value of a variable with a new value specified by an expression.

 2.	Specify an expression whose value is to be returned by a function.

The assignment operator is :=.

Examples

X := Y + Z;

Done := (I >= 1) and (I < 100);

Hue1 := [Blue, Succ(C)];

I := Sqr(J) - I * K;


Rules of scope

The presence of an identifier or label in a declaration defines the identifier or label.

Each time the identifier or label occurs again, it must be within the scope of this declaration.

The scope of an identifier or label encompasses its declaration to the end of the current block, including all blocks enclosed by the current block.

Exceptions

1) Redeclaration in an enclosed block:

Suppose that Exterior is a block that encloses another block, Interior.

If Exterior and Interior both have an identifier with the same name (for example, J), Interior can only access the J it declared, and Exterior can only access the J it declared.

2) Position of declaration within its block:

Identifiers and labels cannot be used until after they are declared.

With one exception, an identifier or label's declaration must come before any occurrence of that identifier or label in the program text.

The exception to this: The base type of a pointer type can be an identifier that has not yet been declared.

However, the identifier must eventually be declared in the same type declaration part that the pointer type occurs in.

3) Redeclaration within a block:

With one exception, an identifier or label can only be declared once in the outer level of a given block.

The exception to this: When it is declared within a contained block or is in a record's field list.

A record field identifier is declared within a record type and is significant only in combination with a reference to a variable of that record type.

You can redeclare a field identifier (with the same spelling) within the same block but not at the same level within the same record type.

However, an identifier that has been declared can be redeclared as a field identifier in the same block.

4) An object component's identifier:

The scope of an object component's identifier extends over the domain of the object type.


Scope of interface and standard identifiers

Programs or units containing uses clauses have access to the identifiers belonging to the interface parts of the units in those uses clauses.


Special symbols

Special symbols and reserved words are characters that have one or more fixed meanings.

These single characters are special symbols:

 +	 -	 *	 /	 =	 <	 >

 [	 ]	 ,	 (	 )	 :	 ;

 ^	 .	 @	 {	 }	 $	 #

These character pairs are also special symbols:

 <=	 >=	 :=	 ..

 (*	 *)	 (.	 .)

Some special symbols are also operators.

 -	A left bracket [ is equivalent to the character pair of a left parenthesis and a period (.

 -	A right bracket ] is equivalent to the character pair of a period and a right parenthesis .)


Numbers

Ordinary decimal notation is used for numbers that are constants of type integer and real.

A hexadecimal integer constant uses a  dollar sign ($) as a prefix.

Engineering notation (E or e, followed by an exponent) is read as "times 10 to the power of" in real types. For example:

7E-2  means  7 x 10-2

12.25e+6  or  12.25e6  both mean  12.25 x 10+6.

Numbers with decimals or exponents denote real-type constants.

Other decimal numbers denote integer-type constants; they must be within the range

-2,147,483,648 to 2,147,483,647.

Hexadecimal numbers

Hexadecimal numbers denote integer-type constants; they must be within the range $00000000 to $FFFFFFFF.

The resulting value's sign is implied by the hexadecimal notation.


Character strings

A character string is a sequence of zero or more characters from the extended ASCII character set, written on one line in the program and enclosed by apostrophes.

A character string with nothing between the apostrophes is a null string.

Two sequential apostrophes in a character string denote a single character, an apostrophe.

The length attribute of a character string is the actual number of characters within the apostrophes.

Control characters

As an extension to standard Pascal, Turbo Pascal allows control characters to be embedded in character strings.

The # character followed by an unsigned integer constant in the range 0 to 255 denotes a character of the corresponding ASCII value.

There must be no separators between the # character and the integer constant.

Likewise, if several control characters are part of a character string, there must be no separators between them.

 -	A character string of length 0 (the null string) is compatible only with string types.

 -	A character string of length 1 is compatible with any Char and string type.

 -	A character string of length N, where N is greater than or equal to 2, is compatible with the following:

 -	any string type

 -	packed arrays of N characters

 -	the PChar type when extended syntax is enabled with the {$X+}compiler directive.


Comments

The following constructs are comments and are ignored by the compiler:

  { Any text not containing right brace }

  (* Any text not containing star/right parenthesis *)

A comment that contains a dollar sign ($) immediately after the opening { or (* is a compiler directive. A mnemonic of the compiler command follows the $ character.


Index of Turbo Pascal's MS-Windows API

Constants

Alphabetical index

Functional (categorical) index

button constants

capabilities constants

class constants

colors constants

combo-box constants

communication constants

device constants

dialog box constants

edit-control constants

error constants

field offset constants

flag constants

font constants

list-box constants

message constants

mode constants

MS-Windows constants

notification code constants

raster constants

scroll bar constants

style constants

window constants

miscellaneous constants

Functions

Window manager interface

GDI routines

System services interface routines

Messages

button messages

combo-box messages

DDE messages

dialog-box messages

edit messages

list-box messages

window messages

Units

WinProcs.TPU

WinTypes.TPU


Dialog boxes, Windows API

Constants

Messages

Procedures and Functions


Index of Windows API Messages

This index is a functional (categorical) listing of the Turbo Pascal Windows API messages.

These messages fall into several categories:

button messages

combo-box messages

DDE messages

dialog-box messages

edit messages

list-box messages

window messages.


Button Messages (Windows API)

bm_GetCheck

bm_GetState

bm_SetCheck

bm_SetState

bm_SetStyle


Combo-Box Messages (Windows API)

cb_AddString

cb_DeleteString

cb_Dir

cb_FindString

cb_GetCount

cb_GetCurSel

cb_GetEditSel

cb_GetItemData

cb_GetLBText

cb_GetLBTextLen

cb_InsertString

cb_LimitText

cb_ResetContent

cb_SelectString

cb_SetCurSel

cb_SetEditSel

cb_SetItemData

cb_ShowDropDown


DDE Messages (Windows API)

wm_dde_Ack

wm_dde_Advise

wm_dde_Data

wm_dde_Execute

wm_dde_Initiate

wm_dde_Poke

wm_dde_Request

wm_dde_Terminate

wm_dde_Unadvise


Dialog-Box Messages (Windows API)

dm_GetDefID

dm_SetDefID


Edit Messages (Windows API)

em_CanUndo

em_EmptyUndoBuffer

em_FmtLines

em_GetHandle

em_GetLine

em_GetLineCount

em_GetModify

em_GetRect

em_GetSel

em_LimitText

em_LineFromChar

em_LineIndex

em_LineLength

em_LineScroll

em_ReplaceSel

em_SetHandle

em_SetModify

em_SetPasswordChar

em_SetRect

em_SetRectNP

em_SetSel

em_SetTabStops

em_SetWordBreak

em_Undo


List-Box Messages (Windows API)

lb_AddString

lb_DeleteString

lb_Dir

lb_FindString

lb_GetCount

lb_GetCurSel

lb_GetHorizontalExtent

lb_GetItemData

lb_GetItemRect

lb_GetSel

lb_GetSelCount

lb_GetSelItems

lb_GetText

lb_GetTextLen

lb_GetTopIndex

lb_InsertString

lb_ResetContent

lb_SelectString

lb_SelItemRange

lb_SetColumnWidth

lb_SetCurSel

lb_SetHorizontalExtent

lb_SetItemData

lb_SetSel

lb_SetTabStops

lb_SetTopIndex


Window Messages (Windows API)

wm_Activate

wm_ActivateApp

wm_AskCBFormatName

wm_CancelMode

wm_ChangeCBChain

wm_Char

wm_ChartoItem

wm_ChildActivate

wm_Clear

wm_Close

wm_Command

wm_Compacting

wm_CompareItem

wm_Copy

wm_Create

wm_CtlColor

wm_Cut

wm_DeadChar

wm_DeleteItem

wm_Destroy

wm_DestroyClipboard

wm_DevModeChange

wm_DrawClipboard

wm_DrawItem

wm_Enable

wm_EndSession

wm_EnterIdle

wm_EraseBkgnd

wm_FontChange

wm_GetDlgCode

wm_GetFont

wm_GetMinMaxInfo

wm_GetText

wm_GetTextLength

wm_HScroll

wm_HScrollClipboard

wm_IconEraseBkgnd

wm_InitDialog

wm_InitMenu

wm_InitMenuPopup

wm_KeyDown

wm_KeyUp

wm_KillFocus

wm_LButtonDblClk

wm_LButtonDown

wm_LButtonUp

wm_MButtonDblClk

wm_MButtonDown

wm_MButtonUp

wm_MDIActivate

wm_MDICascade

wm_MDICreate

wm_MDIDestroy

wm_MDIGetActive

wm_MDIIconArrange

wm_MDIMaximize

wm_MDINext

wm_MDIRestore

wm_MDISetMenu

wm_MDITile

wm_MeasureItem

wm_MenuChar

wm_MenuSelect

wm_MouseActivate

wm_MouseMove

wm_Move

wm_NCActivate

wm_NCCalSize

wm_NCCreate

wm_NCDestroy

wm_NCHitTest

wm_NCLButtonDbClk

wm_NCLButtonDown

wm_NCLButtonUp

wm_NCMButtonDblClk

wm_NCMButtonDown

wm_NCMButtonUp

wm_NCMouseMove

wm_NCPaint

wm_NCRButtonDblClk

wm_NCRButtonDown

wm_NCRButtonUp

wm_NextDlgCtl

wm_Paint

wm_PaintClipboard

wm_PaintIcon

wm_PaletteChanged

wm_ParentNotify

wm_Paste

wm_QueryDragIcon

wm_QueryEndSession

wm_QueryNewPalette

wm_QueryOpen

wm_Quit

wm_RButtonDblClk

wm_RButtonDown

wm_RButtonUp

wm_RenderAllFormats

wm_RenderFormat

wm_SetCursor

wm_SetFocus

wm_SetFont

wm_SetRedraw

wm_SetText

wm_ShowWindow

wm_Size

wm_SizeClipboard

wm_SpoolerStatus

wm_SysChar

wm_SysColorChange

wm_SysCommand

wm_SysDeadChar

wm_SysKeyDown

wm_TimeChange

wm_Timer

wm_Undo

wm_VKeyToItem

wm_VScroll

wm_VScrollClipboard

wm_wininichange


Functional Index of Windows API Constants

This index is a functional (categorical) listing of the Turbo Pascal Windows API constants.

These constants are also organized in strict alphabetical order in the Alphabetical Index of Windows API Constants.

bitmap constants

button constants

capabilities constants

class constants

colors constants

combo-box constants

communication constants

dde constants

dll constants

device constants

dialog box constants

edit-control constants

error constants

field offset constants

flag constants

font constants

list-box constants

message constants

metafile constants

mode constants

mouse constants

notification code constants

object type constants

owner draw constants

raster constants

scroll bar constants

style constants

window constants

windows constants

miscellaneous constants


Bitmap Constants
Bitmap Constants (Windows API)

Bitmap Compression	(bi_...)

CreateDIBitmap	(cbm_Init)

Device Name Length 	(cchDeviceName)

DIB Color Table Identifiers	(dib_...)

Metafile Codes	(meta_...)

Raster Capabilities	(rc_...)

Ternary Raster Operations


Button Constants (Windows API)

Button notification codes 	(bn_...)

Button styles	(bs_...)


Capabilities Constants (Windows API)

Clipping capabilities 	(cp_...)

Curve capabilities 	(cc_...)

Device capabilities 	(dib_...)

Device capabilities index	(dc_...)

Line capabilities 	(lc_...)

Polygonal capabilities 	(pc_...)

Raster capabilities 	(rc_...)

Text capabilities 	(tc_...)


Class Constants (Windows API)

Class field offsets (long) 	gcl_...)

Class field offsets (word) 	gcw_...)

Class styles 	(cs_...)


Color Constants (Windows API)

Color table identifiers	(dib_...)

Control color flags 	(ctlcolor_...)

Palette entry flags 	(pc_...)

System color codes 	(color_...)


Combo-box Constants (Windows API)

Combo box notification codes 	(cbn_...)

Combo box return values	(cb_ ..)

Combo box styles 	(cbs_...)


Communication Constants (Windows API)

Comm configuration

Comm device control block	(dcb_...)

Comm device status flags	(com_...)

Comm error flags 	(ce_...)

Comm event 	(ev_...)

Escape comm constants

Open comm error flags 	(ie_...)


DLL Constants

DLL exit codes	(wep_...)


DDE Constants

DDE Record type flags	(dde_...)

DDE Return codes	(dde...)


Device Constants (Windows API)

Device capabilities 	(dib_...)

Device mode bin	(dmbin_...)

Device mode color	(dmcolor_...)

Device mode duplex 	(dmdup_...)

Device mode field 	(dm_...)

Device mode orientation	(dmorient_...)

Device mode paper type	(dmpaper_...)

Device mode resolution	(dmres_...)

Device mode selections	(dm_...)

Device name length 	(cch_...)

Device technologies 	(dt_...)


Dialog-box Button Constants (Windows API)
Dialog-box Constants (Windows API)

Dialog codes 	(dlgc_...)

Dialog styles 	(ds_...)

Dialog box command IDs 	(id...)

Dialog class constant


Edit Control Constants (Windows API)
Edit Control (Windows API)

Edit control notification codes 	(en_...)

Edit control styles 	(es_...)


Error Constants (Windows API)

Comm error flags 	(ce_...)

Open comm error flags 	(ie_...)

Spooler error codes 	(sp_...)


Field Offset Constants (Windows API)

Class field offsets (long) 	(gcl_...)

Class field offsets (word) 	(gcw_...)

Window field offsets (long) 	(gwl_...)

Window field offsets (word) 	(gww_...)


Flag Constants (Windows API)

Combine region flags 	(rgn_...)

Flood fill style flags

Font output precision flags 	(out_...)

Global memory flags 	(gmem_...)

Local memory flags 	(lmem_...)

Message box flags 	(mb_...)

Menu flags  	(mf_...)

Palette entry flags 	(pc_...)

Region flags

Set window position flags 	(swp_...)

System palette flags 	(syspal_...)

Windows memory config flags 	(wf_...)


Font Constants (Windows API)

Font clipping precision flags 	(clip_...)

Font family flags 	(ff_...)

Font character set flags

Font masks

Font output quality flags

Font output precision flags 	(out_...)

Font pitch flags

Font weight flags 	(fw_...)

Logical font size	(lf_...)


ID Constants (Windows API)

Color table identifiers	(dib_...)

Dialog box command IDs 	(id...)

Standard cursor IDs 	(idc_...)

Standard icon IDs 	(idi_...)


List-box Constants (Windows API)

List box notification codes 	(lbn_...)

List box return values	(lb_...)

List box styles 	(lbs_...)


Message Constants (Windows API)

Enter idle constants 	(msgf_...)

Filter proc codes	(msgf_...)

Peek message options 	(pm_...)


Metafile Constants

Metafile code	(meta_...)


Mode Constants (Windows API)

Background Modes

Mapping modes 	(mm_...)

PolyFill modes

StretchBlt modes


Mouse Constants

Mouse activation codes	(ma_...)


MS-Windows Constants (Windows API)
Windows Constants (Windows API)

Memory configuration flags 	(wf_...)

Hook codes 	(wh_...)


Notification Code Constants (Windows API)

Button notification codes 	(bn_...)

Combo box notification codes 	(cbn_...)

Edit control notification codes 	(en_...)

List box notification codes 	(lbn_...)


Object Type Constants

GDI object type	(obj_...)


Owner Draw Constants

Owner draw actions	(oda_...)

Owner draw states	(ods_...)

Owner draw control types	(odt_...)


Raster Constants (Windows API)

Binary raster operations 	(r2_...)

Raster capabilities 	(rc_...)

Ternary raster operations


Scroll bar constants (Windows API)

Scroll bar commands 	(sb_...)

Scroll bar constants 	(sb_...)

Scroll bar styles 	(sbs_...)


Style Constants (Windows API)

Brush styles 	(bs_...)

Button styles 	(bs_...)

Class styles 	(cs_...)

Combo box styles 	(cbs_...)

Dialog styles 	(ds_...)

Edit control styles 	(es_...)

Extended window styles 	(ws_ex_...)

Hatch styles 	(hs_...)

List box styles 	(lbs_...)

Pen styles  	(ps_...)

Scroll bar styles 	(sbs_...)

Static control styles 	(ss_...)

Window styles 	(ws_...)


Window Constants (Windows API)

Extended window styles 	(ws_ex_...)

Get window constants 	(gw_...)

Old show window constants	(show_...)

Show window constants 	(sw_...)

Show window message 	(sw_...)

Window field offsets (long) 	(gwl_...)

Window field offsets (word) 	(gww_...)

Window styles 	(ws_...)


Miscellaneous constants (Windows API)

Clipboard formats 	(cf_...)

Use Default 	(cw_...)

Drive types 	(drive_...)

Text drawing formatting flags 	(dt_...)

ExtTextOut options 	(eto_...)

GetTempFileName flag	(tf_...)

Help commands 	(help_...)

Hit test codes 	(ht...)

Key state masks 	(mk_...)

LPTx constant

Predefined bitmaps 	(obm_)

Printer escape codes

Proc constants	(proc_...)

Open file constants 	(of_...)

Resource types 	(rt_...)

Sound constants 	(s_...)

Spooler codes	(pr_...)

System command values 	(sc_...)

Size constants 	(size...)

System metrics codes 	(sm_...)

Spooler error codes 	(sp_...)

Stock logical objects

Text alignment options 	(ta_...)

Virtual key codes	(vk_...)


Index of Windows API Constants (alphabetical)
Alphabetical Index of Windows API Constants

This index is an alphabetical listing of the Turbo Pascal Windows API constants.

These constants are also organized by category or function in the Functional Index of Windows API Constants.

AbortDoc

Alternate

ANSI_CharSet

ANSI_Fixed_Font

ANSI_Var_Font

AspectX

AspectXY

AspectY

BandInfo

Begin_Path

bi_RGB

bi_RLE8

bi_RLE4

BitsPixel

Black_Brush

Black_Pen

Blackness

BlackOnWhite

bn_Clicked

bn_DoubleClicked

bs_3State

bs_Auto3State

bs_AutoCheckBox

bs_AutoRadioButton

bs_CheckBox

bs_DefPushButton

bs_DIBPattern

bs_GroupBox

bs_Hatched

bs_Hollow

bs_LeftText

bs_Null

bs_OwnerDraw

bs_Pattern

bs_PushButton

bs_RadioButton

bs_Solid

cb_Err

cb_Okay

cbm_Init

cbn_DblClk

cbn_DropDown

cbn_EditChange

cbn_EditUpdate

cbn_ErrSpace

cbn_KillFocus

cbn_SelChange

cbn_SetFocus

cbs_AutoHScroll

cbs_DropDown

cbs_DropDownList

cbs_HasStrings

cbs_NoIntegralHeight

cbs_OEMConvert

cbs_OwnerDrawFixed

cbs_OwnerDrawVariable

cbs_Simple

cbs_Sort

cc_Chord

cc_Circles

cc_Ellipses

cc_Interiors

cc_None

cc_Pie

cc_Styled

cc_Wide

cc_WideStyled

cchDeviceName

ce_Break

ce_DNS

ce_DSRTO

ce_Frame

ce_IOE

ce_Mode

ce_OOP

ce_Overrun

ce_PTO

ce_RLSDTO

ce_RxOver

ce_RxParity

ce_STSTO

ce_TxFull

cf_Bitmap

cf_DIB

cf_DIF

cf_DSPBitmap

cf_DSPMetaFilePict

cf_DSPText

cf_MetaFilePict

cf_OEMText

cf_OwnerDisplay

cf_Palette

cf_PrivateFirst

cf_PrivateLast

cf_SYLK

cf_Text

cf_TIFF

clip_Character_Precis

clip_Default_Precis

clip_Stroke_Precis

ClipCaps

Clip_To_Path

ClrDTR

ClrRTS

color_ActiveBorder

color_ActiveCaption

color_AppWorkSpace

color_Background

color_BtnFace

color_BtnShadow

color_BtnText

color_CaptionText

color_GrayText

color_Highlight

color_HighlightText

color_InactiveBorder

color_InactiveCaption

color_Menu

color_MenuText

color_ScrollBar

color_Window

color_WindowFrame

color_WindowText

ColorOnColor

ColorRes

com_CtsHold

com_DsrHold

com_Eof

com_RlsdHold

com_Txim

com_XoffHold

com_XoffSent

ComplexRegion

cp_None

cp_Rectangle

cs_ByteAlignClient

cs_ByteAlignWindow

cs_ClassDC

cs_DblClks

cs_GlobalClass

cs_HRedraw

cs_NoClose

cs_OwnDC

cs_ParentDC

cs_SaveBits

cs_VRedraw

ctlcolor_Btn

ctlcolor_Dlg

ctlcolor_Edit

ctlcolor_ListBox

ctlcolor_MsgBox

ctlcolor_ScrollBar

ctlcolor_Static

CurveCaps

cw_UseDefault

dc_BinNames

dc_Bins

dc_Driver

dc_Duplex

dc_Extra

dc_Fields

dc_MaxExtent

dc_MinExtent

dc_Papers

dc_Papersize

dc_Size

dc_Version

dcb_Binary

dcb_RtsDisable

dcb_Parity

dcb_OutxCtsFlow

dcb_OutxDsrFlow

dcb_DtrDisable

dcb_OutX

dcb_InX

dcb_PeChar

dcb_Null

dcb_ChEvt

dcb_Dtrflow

dcb_Rtsflow

dde_Ack

dde_AckReq

dde_AppReturnCode

dde_Busy

dde_DeferUpdt

dde_Response

dde_Release

Default_Palette

Default_Pitch

Default_Quality

DeviceData

Device_Default_Font

Device_FontType

DlgWindowExtra

dib_Pal_Colors

dib_RGB_Colors

DkGray_Brush

dlgc_DefPushButton

dlgc_HasSetSel

dlgc_RadioButton

dlgc_UndefPushButton

dlgc_WantAllKeys

dlgc_WantArrows

dlgc_WantChars

dlgc_WantMessage

dlgc_WantTab

dm_Color

dm_Copies

dm_Copy

dm_DefaultSource

dm_Duplex

dm_Modify

dm_Orientation

dm_PaperLength

dm_PaperSize

dm_PaperWidth

dm_PrintQuality

dm_Prompt

dm_Scale

dm_Update

dmbin_Auto

dmbin_Cassette

dmbin_Envelope

dmbin_EnvManual

dmbin_LargeCapacity

dmbin_LargeFmt

dmbin_Lower

dmbin_Manual

dmbin_Middle

dmbin_OnlyOne

dmbin_SmallFmt

dmbin_Tractor

dmbin_Upper

dmcolor_Color

dmcolor_Monochrome

dmdup_Horizontal

dmdup_Simplex

dmdup_Vertical

dmorient_Landscape

dmorient_Portrait

dmpaper_10X14

dmpaper_11X17

dmpaper_A3

dmpaper_A4

dmpaper_A4Small

dmpaper_A5

dmpaper_B4

dmpaper_B5

dmpaper_CSheet

dmpaper_DSheet

dmpaper_Env_10

dmpaper_Env_11

dmpaper_Env_12

dmpaper_Env_14

dmpaper_Env_9

dmpaper_ESheet

dmpaper_Executive

dmpaper_Folio

dmpaper_Ledger

dmpaper_Legal

dmpaper_Letter

dmpaper_LetterSmall

dmpaper_Note

dmpaper_Quarto

dmpaper_Statement

dmpaper_Tabloid

dmres_Draft

dmres_Low

dmres_Medium

dmres_High

DraftMode

Draft_Quality

DrawPatternRect

drive_Fixed

drive_Remote

drive_Removeable

DriverVersion

ds_AbsAlign

ds_LocalEdit

ds_ModalFrame

ds_NoIdleMsg

ds_SetFont

ds_SysModal

DSTInvert

dt_Bottom

dt_CalcRect

dt_Center

dt_CharStream

dt_DispFile

dt_ExpandTabs

dt_ExternalLeading

dt_Internal

dt_Left

dt_MetaFile

dt_NoClip

dt_NoPrefix

dt_Plotter

dt_RasCamera

dt_RasDisplay

dt_RasPrinter

dt_Right

dt_SingleLine

dt_TabStop

dt_Top

dt_VCenter

dt_WordBreak

en_Change

en_ErrSpace

en_HScroll

en_KillFocus

en_MaxText

en_SetFocus

en_Update

en_VScroll

EnableDuplex

EnablePairKerning

EnableRelativeWidths

End_Path

EndDoc

EnumPaperBins

EnumPaperMetrics

EPSPrinting

Error

es_AutoHScroll

es_AutoVScroll

es_Center

es_Left

es_LowerCase

es_MultiLine

es_NoHideSel

es_OEMConvert

es_Password

es_Right

es_UpperCase

eto_Clipped

eto_Opaque

ev_Break

ev_CTS

ev_DSR

ev_Err

ev_PErr

ev_Ring

ev_RLSD

ev_RxChar

ev_RxFlag

ev_TxEmpty

EvenParity

Ext_Device_Caps

ff_Decorative

ff_DontCare

ff_Modern

ff_Roman

ff_Script

ff_Swiss

Fixed_Pitch

FloodFillBorder

FloodFillSurface

FlushOutput

fw_Black

fw_Bold

fw_DemiBold

fw_DontCare

fw_ExtraBold

fw_ExtraLight

fw_Heavy

fw_Light

fw_Medium

fw_Normal

fw_Regular

fw_SemiBold

fw_Thin

fw_UltraBold

fw_UltraLight

gcl_MenuName

gcl_WndProc

gcw_CBClsExtra

gcw_CBWndExtra

gcw_HBrBackground

gcw_HCursor

gcw_HIcon

gcw_HModule

gcw_Style

GDIExtTextOut

GDIStretchBlt

GetColorTable

GetExtendedTextMetrics

GetExtentTable

GetPairKernTable

GetPhysPageSize

GetPrintingOffset

GetScalingFactor

GetSetPaperBins

GetSetPaperMetrics

GetSetPrintOrient

GetTechnolgy

GetTrackKernTable

GetVectorBrushSize

GetVectorPenSize

gmem_DDEShare

gmem_Discardable

gmem_Discarded

gmem_Fixed

gmem_LockCount

gmem_Lower

gmem_Modify

gmem_Moveable

gmem_NoCompact

gmem_NoDiscard

gmem_Not_Banked

gmem_Notify

gmem_Share

gmem_ZeroInit

Gray_Brush

gw_Child

gw_HWndFirst

gw_HWndLast

gw_HWndNext

gw_HWndPrev

gw_Owner

gwl_ExStyle

gwl_Style

gwl_WndProc

gww_HInstance

gww_HWndParent

gww_ID

help_Context

help_HelpOnHelp

help_Index

help_Key

help_MultiKey

help_Quit

help_SetIndex

hide_Window

Hollow_Brush

HorzRes

HorzSize

hs_BDiagonal

hs_Cross

hs_DiagCross

hs_FDiagonal

hs_Horizontal

hs_Vertical

htBottom

htBottomLeft

htBottomRight

htCaption

htClient

htError

htGrowBox

htHScroll

htLeft

htMenu

htNowhere

htReduce

htRight

htSize

htSysMenu

htTop

htTopLeft

htTopRight

htTransparent

htVScroll

htZoom

idAbort

idc_Arrow

idc_Cross

idc_IBeam

idc_Icon

idc_Size

idc_SizeNESW

idc_SizeNS

idc_SizeNWSE

idc_SizeWE

idc_UpArrow

idc_Wait

idCancel

idi_Application

idi_Asterisk

idi_Exclamation

idi_Hand

idi_Question

idIgnore

idNo

idOk

idRetry

idYes

ie_BadID

ie_BaudRate

ie_ByteSize

ie_Default

ie_Hardware

ie_Memory

ie_NOpen

ie_Open

lb_Err

lb_ErrSpace

lb_Okay

lbn_DblClk

lbn_ErrSpace

lbn_KillFocus

lbn_SelChange

lbn_SetFocus

lbs_ExtendedSel

lbs_HasStrings

lbs_MultiColumn

lbs_MultipleSel

lbs_NoIntegralHeight

lbs_NoRedraw

lbs_Notify

lbs_OwnerDrawFixed

lbs_OwnerDrawFixed

lbs_OwnerDrawVariable

lbs_OwnerDrawVariable

lbs_Sort

lbs_Standard

lbs_UseTabStops

lbs_WantKeyboardInput

lc_Interiors

lc_Marker

lc_None

lc_PolyLine

lc_PolyMarker

lc_Styled

lc_Wide

lc_WideStyled

lf_FaceSize

LineCaps

lmem_Discardable

lmem_Discarded

lmem_Fixed

lmem_LockCount

lmem_Modify

lmem_Moveable

lmem_NoCompact

lmem_NoDiscard

lmem_ZeroInit

LogPixelsX

LogPixelsY

LPTx

LtGray_Brush

ma_Activate

ma_ActivateAndEat

ma_NoActivate

MarkParity

mb_AbortRetryIgnore

mb_ApplModal

mb_DefButton1

mb_DefButton2

mb_DefButton3

mb_IconAsterisk

mb_IconExclamation

mb_IconHand

mb_IconInformation

mb_IconQuestion

mb_IconStop

mb_Ok

mb_OkCancel

mb_RetryCancel

mb_SystemModal

mb_TaskModal

mb_YesNo

mb_YesNoCancel

MergeCopy

MergePaint

meta_AnimatePalette

meta_Arc

meta_BitBlt

meta_Chord

meta_CreateBitmap

meta_CreateBitmapIndirect

meta_CreateBrush

meta_CreateBrushIndirect

meta_CreateFontIndirect

meta_CreatePalette

meta_CreatePatternBrush

meta_CreatePenIndirect

meta_CreateRegion

meta_DeleteObject

meta_DIBBitBlt

meta_DIBCreatePatternBrush

meta_DIBStretchBlt

meta_DrawText

meta_Ellipse

meta_Escape

meta_ExcludeClipRect

meta_ExtTextOut

meta_FillRegion

meta_FloodFill

meta_FrameRegion

meta_IntersectClipRect

meta_InvertRegion

meta_LineTo

meta_MoveTo

meta_OffsetClipRgn

meta_OffsetViewportOrg

meta_OffsetWindowOrg

meta_PaintRegion

meta_PatBlt

meta_Pie

meta_Polygon

meta_PolyLine

meta_PolyPolygon

meta_RealizePalette

meta_Rectangle

meta_ResizePalette

meta_RestoreDC

meta_RoundRect

meta_SaveDC

meta_ScaleViewportExt

meta_ScaleWindowExt

meta_SelectClipRegion

meta_SelectObject

meta_SelectPalette

meta_SetBKColor

meta_SetBKMode

meta_SetDIBToDev

meta_SetMapMode

meta_SetMapperFlags

meta_SetPalEntries

meta_SetPixel

meta_SetPolyFillMode

meta_SetRelAbs

meta_SetROP2

meta_SetStretchBltMode

meta_SetTextAlign

meta_SetTextCharExtra

meta_SetTextColor

meta_SetTextJustification

meta_SetViewportExt

meta_SetViewportOrg

meta_SetWindowExt

meta_SetWindowOrg

meta_StretchBlt

meta_TextOut

mf_Bitmap

mf_ByCommand

mf_ByPosition

mf_Checked

mf_Disabled

mf_Enabled

mf_Grayed

mf_Help

mf_Hilite

mf_MenuBarBreak

mf_MenuBreak

mf_MouseSelect

mf_OwnerDraw

mf_Popup

mf_Separator

mf_String

mf_SysMenu

mf_Unchecked

mf_Unhilite

MFComment

mk_Control

mk_LButton

mk_MButton

mk_RButton

mk_Shift

mm_Anisotropic

mm_HiEnglish

mm_HiMetric

mm_Isotropic

mm_LoEnglish

mm_LoMetric

mm_Text

mm_Twips

msgf_DialogBox

msgf_DialogBoxFilter

msgf_Menu

msgf_MenuFilter

msgf_MessageBoxFilter

NewFrame

NextBand

NoParity

NotSrcCopy

NotSrcErase

Null_Brush

Null_Pen

NullRegion

NumBrushes

NumColors

NumFonts

NumMarkers

NumPens

NumReserved

obj_Pen

obj_Brush

obm_BtnCorners

obm_BtSize

obm_Check

obm_CheckBoxes

obm_Close

obm_Combo

obm_DnArrow

obm_DnArrowD

obm_LfArrow

obm_LfArrowD

obm_MnArrow

obm_Old_Close

obm_Old_DnArrow

obm_Old_LfArrow

obm_Old_Reduce

obm_Old_Restore

obm_Old_RgArrow

obm_Old_UpArrow

obm_Old_Zoom

obm_Reduce

obm_Reduced

obm_Restore

obm_Restored

obm_RgArrow

obm_RgArrowD

obm_Size

obm_UpArrow

obm_UpArrowD

obm_Zoom

obm_ZoomD

oda_DrawEntire

oda_Focus

oda_Select

ods_Checked

ods_Disabled

ods_Focus

ods_Grayed

ods_Selected

odt_Menu

odt_ListBox

odt_ComboBox

odt_Button

OddParity

OEM_CharSet

OEM_Fixed_Font

of_Cancel

of_Create

of_Delete

of_Exist

of_Parse

of_Prompt

of_Read

of_ReadWrite

of_ReOpen

of_Share_Compat

of_Share_Deny_None

of_Share_Deny_Read

of_Share_Deny_Write

of_Share_Exclusive

of_Verify

of_Write

OneStopBit

One5StopBits

Opaque

OpenFile

Out_Character_Precis

Out_Default_Precis

Out_String_Precis

Out_Stroke_Precis

PassThrough

PatCopy

PatInvert

PatPaint

pc_Explicit

pc_Interiors

pc_NoCollapse

pc_None

pc_Polygon

pc_Rectangle

pc_Reserved

pc_ScanLine

pc_Styled

pc_Trapezoid

pc_Wide

pc_WideStyled

pc_WindPolygon

PDeviceSize

Planes

pm_NoRemove

pm_NoYield

pm_Remove

PolygonalCaps

pr_JobStatus

proc_ExtDeviceMode

proc_DeviceCapabilities

proc_OldDeviceMode

Proof_Quality

ps_Dash

ps_DashDot

ps_DashDotDot

ps_Dot

ps_InsideFrame

ps_Null

ps_Solid

QueryEscSupport

r2_Black

r2_CopyPen

r2_MaskNotPen

r2_MaskPen

r2_MaskPenNot

r2_MergeNotPen

r2_MergePen

r2_MergePenNot

r2_No en

r2_Nop

r2_Not

r2_NotCopyPen

r2_NotMaskPen

r2_NotMergePen

r2_White

r2_XorPen

RasterCaps

Raster_FontType

rc_Banding

rc_BigFont

rc_BitBlt

rc_Bitmap64

rc_DI_Bitmap

rc_DIBToDev

rc_FloodFill

rc_GDI20_Output

rc_Palette

rc_Scaling

rc_StretchBlt

rc_StretchDIB

ResetDev

Restore_CTM

rgn_And

rgn_Copy

rgn_Diff

rgn_Or

rgn_Xor

rt_Accelerator

rt_Bitmap

rt_Cursor

rt_Dialog

rt_Font

rt_FontDir

rt_Icon

rt_Menu

rt_RcData

rt_String

s_AllThreshold

s_Legato

s_Normal

s_Period1024

s_Period2048

s_Period512

s_PeriodVoice

s_QueueEmpty

s_SerBDNT

s_SerDCC

s_SerDDR

s_SerDFQ

s_SerDLN

s_SerDMD

s_SerDPT

s_SerDSH

s_SerDSR

s_SerDST

s_SerDTP

s_SerDVL

s_SerDVNA

s_SerMACT

s_SerOFM

s_SerQFUL

s_Staccato

s_Threshold

s_White1024

s_White2048

s_White512

s_WhiteVoice

Save_Ctm

sb_Both

sb_Bottom

sb_Ctl

sb_EndScroll

sb_Horz

sb_LineDown

sb_LineUp

sb_PageDown

sb_PageUp

sb_ThumbPosition

sb_ThumbTrack

sb_Top

sb_Vert

sbs_BottomAlign

sbs_Horz

sbs_LeftAlign

sbs_RightAlign

sbs_SizeBox

sbs_SizeBoxBottomRightAlign

sbs_SizeBoxTopLeftAlign

sbs_TopAlign

sbs_Vert

sc_Close

sc_HScroll

sc_KeyMenu

sc_Maximize

sc_Minimize

sc_MouseMenu

sc_Move

sc_NextWindow

sc_PrevWindow

sc_Restore

sc_Size

sc_TaskList

sc_VScroll

SelectPaperSource

Set_Arc_Direction

Set_Background_Color

Set_Bounds

Set_Clip_Box

Set_Poly_Mode

Set_Screen_Angle

Set_Spread

SetAbortProc

SetAllJustValues

SetColorTable

SetCopyCount

SetDTR

SetKernTrack

SetLineJoin

SetMiterLimit

SetRTS

SetXoff

SetXon

ShiftJIS_CharSet

show_IconWindow

show_FullScreen

show_OpenNoActivate

show_OpenWindow

SimpleRegion

SizeFullScreen

SizeIconic

SizeNormal

SizePalette

SizeZoomHide

SizeZoomShow

sm_CXBorder

sm_CXCursor

sm_CXDlgFrame

sm_CXFrame

sm_CXFullScreen

sm_CXHScroll

sm_CXHThumb

sm_CXIcon

sm_CXMin

sm_CXMinTrack

sm_CXScreen

sm_CXSize

sm_CXVScroll

sm_CYBorder

sm_CYCaption

sm_CYCursor

sm_CYDlgFrame

sm_CYFrame

sm_CYFullScreen

sm_CYHScroll

sm_CYIcon

sm_CYKanjiWindow

sm_CYMenu

sm_CYMin

sm_CYMinTrack

sm_CYScreen

sm_CYSize

sm_CYVScroll

sm_CYVThumb

sm_Debug

sm_MousePresent

sm_SwapButton

sp_AppAbort

sp_Error

sp_OutOfDisk

sp_OutOfMemory

sp_UserAbort

SpaceParity

SrcAnd

SrcCopy

SrcErase

SrcInvert

SrcPaint

ss_BlackFrame

ss_BlackRect

ss_Center

ss_GrayFrame

ss_GrayRect

ss_Icon

ss_Left

ss_LeftNoWordWrap

ss_NoPrefix

ss_Right

ss_Simple

ss_UserItem

ss_WhiteFrame

ss_WhiteRect

StartDoc

sw_Hide

sw_Maximize

sw_Minimize

sw_Normal

sw_OtherZoom

sw_OtherUnzoom

sw_ParentClosing

sw_ParentOpening

sw_Restore

sw_Show

sw_ShowMaximized

sw_ShowMinimized

sw_ShowMinNoActive

sw_ShowNA

sw_ShowNoActivate

sw_ShowNormal

swp_DrawFrame

swp_HideWindow

swp_NoActivate

swp_NoMove

swp_NoRedraw

swp_NoSize

swp_NoZOrder

swp_ShowWindow

Symbol_CharSet

syspal_NoStatic

syspal_Static

System_Fixed_Font

System_Font

ta_BaseLine

ta_Bottom

ta_Center

ta_Left

ta_NoUpdateCP

ta_Right

ta_Top

ta_UpdateCP

tc_cp_Stroke

tc_cr_90

tc_cr_Any

tc_ea_Double

tc_ia_Able

tc_op_Character

tc_op_Stroke

tc_ra_Able

tc_sa_Contin

tc_sa_Double

tc_sa_Integer

tc_sf_X_YIndep

tc_so_Able

tc_ua_Able

tc_va_Able

tf_ForceDrive

Technology

TextCaps

TwoStopBits

Transform_CTM

Transparent

vk_0 to vk_9

vk_A to vk_Z

vk_Add

vk_Back

vk_Cancel

vk_Capita

vk_Clear

vk_Control

vk_Decimal

vk_Delete

vk_Divide

vk_Down

vk_End

vk_Escape

vk_Execute

vk_F1 to vk_F16

vk_Help

vk_Home

vk_Insert

vk_LButton

vk_Left

vk_MButton

vk_Menu

vk_Multiply

vk_Next

vk_NumLock

vk_NumPad0 to vk_NumPad0

vk_Pause

vk_Print

vk_Prior

vk_RButton

vk_Return

vk_Right

vk_Select

vk_Separator

vk_Shift

vk_SnapShot

vk_Space

vk_Subtract

vk_Tab

vk_Up

Variable_Pitch

VertRes

VertSize

wep_Free_DLL

wep_System_Exit

wf_80x87

wf_CPU086

wf_CPU186

wf_CPU286

wf_CPU386

wf_CPU486

wf_Enhanced

wf_LargeFrame

wf_PMode

wf_SmallFrame

wf_Standard

wf_Win286

wf_Win386

wh_CallWndProc

wh_GetMessage

wh_JournalPlayback

wh_JournalRecord

wh_Keyboard

wh_MsgFilter

wh_SysMsgFilter

White_Brush

White_Pen

Whiteness

WhiteOnBlack

Winding

ws_Border

ws_Caption

ws_Child

ws_ChildWindow

ws_ClipChildren

ws_ClipSiblings

ws_Disabled

ws_DlgFrame

ws_ex_DlgModalFrame

ws_ex_NoParentNotify

ws_Group

ws_HScroll

ws_Iconic

ws_Maximize

ws_MaximizeBox

ws_Minimize

ws_MinimizeBox

ws_Overlapped

ws_OverlappedWindow

ws_Popup

ws_PopupWindow

ws_SizeBox

ws_SysMenu

ws_TabStop

ws_ThickFrame

ws_Tiled

ws_TiledWindow

ws_Visible

ws_VScroll


Index of Windows API Procedures and Functions
Alphabetical Index of Windows API Procedures and Functions

This index is a strictly alphabetical listing of the Windows API routines.

For a categorical (functional) listing of these routines, see the Categorical Index of Windows API Procedures and Functions.

AccessResource

AddAtom

AddFontResource

AdjustWindowRect

AdjustWindowRectEx

AllocDStoCSAlias

AllocResource

AllocSelector

AnimatePalette

AnsiLower

AnsiLowerBuff

AnsiNext

AnsiPrev

AnsiToOem

AnsiToOemBuff

AnsiUpper

AnsiUpperBuff

AnyPopup

AppendMenu

Arc

ArrangeIconicWindows

BeginDeferWindowPos

BeginPaint

BitBlt

BringWindowToTop

BuildCommDCB

CallMsgFilter

CallWindowProc

Catch

ChangeClipboardChain

CheckDlgButton

CheckMenuItem

CheckRadioButton

ChildWindowFromPoint

Chord

ClearCommBreak

ClientToScreen

ClipCursor

CloseClipboard

CloseComm

CloseMetaFile

CloseSound

CloseWindow

CombineRgn

CopyMetaFile

CopyRect

CountClipboardFormats

CountVoiceNotes

CreateBitmap

CreateBitmapIndirect

CreateBrushIndirect

CreateCaret

CreateCompatibleBitmap

CreateCompatibleDC

CreateCursor

CreateDC

CreateDialog

CreateDialogIndirect

CreateDialogIndirectParam

CreateDialogParam

CreateDIBitmap

CreateDIBPatternBrush

CreateDiscardableBitmap

CreateEllipticRgn

CreateEllipticRgnIndirect

CreateFont

CreateFontIndirect

CreateHatchBrush

CreateIC

CreateIcon

CreateMenu

CreateMetaFile

CreatePalette

CreatePatternBrush

CreatePen

CreatePenIndirect

CreatePolygonRgn

CreatePolyPolygonRgn

CreatePopupMenu

CreateRectRgn

CreateRectRgnIndirect

CreateRoundRectRgn

CreateSolidBrush

CreateWindow

CreateWindowEx

DebugBreak

DefDlgProc

DeferWindowPos

DefFrameProc

DefHookProc

DefMDIChildProc

DefWindowProc

DeleteAtom

DeleteDC

DeleteMenu

DeleteMetaFile

DeleteObject

DestroyCaret

DestroyCursor

DestroyIcon

DestroyMenu

DestroyWindow

DialogBox

DialogBoxIndirect

DialogBoxIndirectParam

DialogBoxParam

DispatchMessage

DlgDirList

DlgDirListComboBox

DlgDirSelect

DlgDirSelectComboBox

DPtoLP

DrawFocusRect

DrawIcon

DrawMenuBar

DrawText

Ellipse

EmptyClipboard

EnableHardwareInput

EnableMenuItem

EnableWindow

EndDeferWindowPos

EndDialog

EndPaint

EnumChildWindows

EnumClipboardFormats

EnumFonts

EnumMetaFile

EnumObjects

EnumProps

EnumTaskWindows

EnumWindows

EqualRect

EqualRgn

Escape

EscapeCommFunction

ExcludeClipRect

ExcludeUpdateRgn

ExitWindows

ExtFloodFill

ExtTextOut

FatalExit

FillRect

FillRgn

FindAtom

FindResource

FindWindow

FlashWindow

FloodFill

FlushComm

FrameRect

FrameRgn

FreeLibrary

FreeModule

FreeProcInstance

FreeResource

GetActiveWindow

GetAspectRatioFilter

GetAsyncKeyState

GetAtomHandle

GetAtomName

GetBitmapBits

GetBitmapDimension

GetBkColor

GetBkMode

GetBrushOrg

GetBValue

GetCapture

GetCaretBlinkTime

GetCaretPos

GetCharWidth

GetClassInfo

GetClassLong

GetClassName

GetClassWord

GetClientRect

GetClipboardData

GetClipboardFormatName

GetClipboardOwner

GetClipboardViewer

GetClipBox

GetCodeHandle

GetCodeInfo

GetCommError

GetCommEventMask

GetCommState

GetCurrentPDB

GetCurrentPosition

GetCurrentTask

GetCurrentTime

GetCursorPos

GetDC

GetDCOrg

GetDesktopWindow

GetDeviceCaps

GetDialogBaseUnits

GetDIBits

GetDlgCtrlID

GetDlgItem

GetDlgItemInt

GetDlgItemText

GetDOSEnvironment

GetDoubleClickTime

GetDriveType

GetEnvironment

GetFocus

GetFreeSpace

GetGValue

GetInputState

GetInstanceData

GetKBCodePage

GetKeyboardState

GetKeyboardType

GetKeyNameText

GetKeyState

GetLastActivePopup

GetMapMode

GetMenu

GetMenuCheckMarkDimensions

GetMenuItemCount

GetMenuItemID

GetMenuState

GetMenuString

GetMessage

GetMessagePos

GetMessageTime

GetMetaFile

GetMetaFileBits

GetModuleFileName

GetModuleHandle

GetModuleUsage

GetNearestColor

GetNearestPaletteIndex

GetNextDlgGroupItem

GetNextDlgTabItem

GetNextWindow

GetNumTasks

GetObject

GetPaletteEntries

GetParent

GetPixel

GetPolyFillMode

GetPriorityClipboardFormat

GetPrivateProfileInt

GetPrivateProfileString

GetProcAddress

GetProfileInt

GetProfileString

GetProp

GetRgnBox

GetROP2

GetRValue

GetScrollPos

GetScrollRange

GetStockObject

GetStretchBltMode

GetSubMenu

GetSysColor

GetSysModalWindow

GetSystemDirectory

GetSystemMenu

GetSystemMetrics

GetSystemPaletteEntries

GetSystemPaletteUse

GetTabbedTextExtent

GetTempDrive

GetTempFileName

GetTextAlign

GetTextCharacterExtra

GetTextColor

GetTextExtent

GetTextFace

GetTextMetrics

GetThresholdEvent

GetThresholdStatus

GetTickCount

GetTopWindow

GetUpdateRect

GetUpdateRgn

GetVersion

GetViewportExt

GetViewportOrg

GetWindow

GetWindowDC

GetWindowExt

GetWindowLong

GetWindowOrg

GetWindowRect

GetWindowsDirectory

GetWindowTask

GetWindowText

GetWindowTextLength

GetWindowWord

GetWinFlags

GlobalAddAtom

GlobalAlloc

GlobalCompact

GlobalDeleteAtom

GlobalFindAtom

GlobalFix

GlobalFlags

GlobalFree

GlobalGetAtomName

GlobalHandle

GlobalLock

GlobalLRUNewest

GlobalLRUOldest

GlobalNotify

GlobalPageLock

GlobalPageUnlock

GlobalReAlloc

GlobalSize

GlobalUnfix

GlobalUnlock

GlobalUnWire

GlobalWire

GrayString

HideCaret

HiliteMenuItem

HiWord

InflateRect

InitAtomTable

InSendMessage

InsertMenu

IntersectClipRect

IntersectRect

InvalidateRect

InvalidateRgn

InvertRect

InvertRgn

IsCharAlpha

IsCharAlphaNumeric

IsCharLower

IsCharUpper

IsChild

IsClipboardFormatAvailable

IsDialogMessage

IsDlgButtonChecked

IsIconic

IsRectEmpty

IsWindow

IsWindowEnabled

IsWindowVisible

IsZoomed

KillTimer

_lclose

_lcreat

LimitEmsPages

LineDDA

LineTo

_llseek

LoadAccelerators

LoadBitmap

LoadCursor

LoadIcon

LoadLibrary

LoadMenu

LoadMenuIndirect

LoadModule

LoadResource

LoadString

LocalAlloc

LocalCompact

LocalFlags

LocalFree

LocalHandle

LocalInit

LocalLock

LocalReAlloc

LocalShrink

LocalSize

LocalUnlock

LockData

LockResource

LockSegment

_lopen

LoWord

LPtoDP

_lread

lstrcat

lstrcmp

lstrcmpi

lstrcpy

lstrlen

_lwrite

MakeLong

MakeProcInstance

MapDialogRect

MapVirtualKey

MessageBeep

MessageBox

ModifyMenu

MoveTo

MoveWindow

MulDiv

OemKeyScan

OemToAnsi

OemToAnsiBuff

OffsetClipRgn

OffsetRect

OffsetRgn

OffsetViewportOrg

OffsetWindowOrg

OpenClipboard

OpenComm

OpenFile

OpenIcon

OpenSound

OutputDebugString

PaintRgn

PaletteRGB

PatBlt

PeekMessage

Pie

PlayMetaFile

PlayMetaFileRecord

Polygon

Polyline

PolyPolygon

PostAppMessage

PostMessage

PostQuitMessage

PtInRect

PtInRegion

PtVisible

ReadComm

RealizePalette

Rectangle

RectInRegion

RectVisible

RegisterClass

RegisterClipboardFormat

RegisterWindowMessage

ReleaseCapture

ReleaseDC

RemoveFontResource

RemoveMenu

RemoveProp

ReplyMessage

ResizePalette

RestoreDC

RGB

RoundRect

SaveDC

ScaleViewportExt

ScaleWindowExt

ScreenToClient

ScrollDC

ScrollWindow

SelectClipRgn

SelectObject

SelectPalette

SendDlgItemMessage

SendMessage

SetActiveWindow

SetBitmapBits

SetBitmapDimension

SetBkColor

SetBkMode

SetBrushOrg

SetCapture

SetCaretBlinkTime

SetCaretPos

SetClassLong

SetClassWord

SetClipboardData

SetClipboardViewer

SetCommBreak

SetCommEventMask

SetCommState

SetCursor

SetCursorPos

SetDIBits

SetDIBitsToDevice

SetDlgItemInt

SetDlgItemText

SetDoubleClickTime

SetEnvironment

SetErrorMode

SetFocus

SetHandleCount

SetKeyboardState

SetMapMode

SetMapperFlags

SetMenu

SetMenuItemBitmaps

SetMessageQueue

SetMetaFileBits

SetPaletteEntries

SetParent

SetPixel

SetPolyFillMode

SetProp

SetRect

SetRectEmpty

SetRectRgn

SetResourceHandler

SetROP2

SetScrollPos

SetScrollRange

SetSoundNoise

SetStretchBltMode

SetSwapAreaSize

SetSysColors

SetSysModalWindow

SetSystemPaletteUse

SetTextAlign

SetTextCharacterExtra

SetTextColor

SetTextJustification

SetTimer

SetViewportExt

SetViewportOrg

SetVoiceAccent

SetVoiceEnvelope

SetVoiceNote

SetVoiceQueueSize

SetVoiceSound

SetVoiceThreshold

SetWindowExt

SetWindowLong

SetWindowOrg

SetWindowPos

SetWindowsHook

SetWindowText

SetWindowWord

ShowCaret

ShowCursor

ShowOwnedPopups

ShowScrollBar

ShowWindow

SizeofResource

StartSound

StopSound

StretchBlt

StretchDIBits

SwapMouseButton

SwapRecording

SwitchStackBack

SwitchStackTo

SyncAllVoices

TabbedTextOut

TextOut

Throw

ToAscii

TrackPopupMenu

TranslateAccelerator

TranslateMDISysAccel

TranslateMessage

TransmitCommChar

UngetCommChar

UnhookWindowsHook

UnionRect

UnlockData

UnlockResource

UnlockSegment

UnrealizeObject

UnregisterClass

UpdateColors

UpdateWindow

ValidateCodeSegments

ValidateFreeSpaces

ValidateRect

ValidateRgn

VkKeyScan

WaitMessage

WaitSoundState

WindowFromPoint

WinExec

WinHelp

WriteComm

WritePrivateProfileString

WriteProfileString

wvsprintf

Yield


Index of Windows API Procedures and Functions (categorical)
Categorical Index of Windows API Procedures and Functions

Turbo Pascal's Windows API routines fall into three general categories: window manager interface, graphics device interface (GDI), and system services interface.

Window manager interface routines do the following:

 -	create, move, or alter windows

 -	process messages

 -	create system output

GDI routines perform device-independent graphics operations.

System services interface routines do the following:

 -	access code and data in modules

 -	allocate and manage memory

 -	create and open files

 -	create sounds

 -	load program resources

 -	manage tasks

 -	modify the Windows initialization file

 -	perform I/O port communications

 -	translate strings

You can also look up the API routines by name in the Alphabetical Index of Windows API procedures and functions.


Window Manager Interface Procedures and Functions

Caret

Clipboard

Cursor

Dialog-Box

Display and Movement

Error

Hardware

Hook

Information

Input

Menu

Message

Painting

Property

Scrolling

System

Window-Creation


Graphics Device Interface Functions
GDI (Graphics Device Interface) Procedures and Functions

The Windows set of functions called the Graphics Device Interface, or GDI, provides graphics functionality to applications.

You can think of the GDI as the graphics engine that Windows applications use to display and manipulate graphics.

Through the device drivers that translate GDI function calls into commands meaningful to the output device, GDI functions give your application drawing capabilities that are independent of the display device used.

Bitmap

Clipping

Color Palette

Coordinate Translation

Device Context

Device-Independent Bitmap

Drawing-Attribute

Drawing-Tool

Environment

Escape

Font

Line-Drawing

Mapping

Metafile

Printer-Control

Rectangle

Region

Shape-drawing

Text-drawing


System Services Interface Functions
System Services Interface Procedures and Functions

Application-Execution

Atom-Management

Communication

File I/O

Initialization-File

Memory-Management

Module-Management

Operating-System Interrupt

Resource-Management

Segment

Sound

String-Manipulation

Task

Utility Macros


Device-Context Procedures and Functions

A device context represents the device driver, output device, and (sometimes) the communications port.

Your application performs graphics operations within the context of a specific device.

CreateCompatibleDC

CreateDC

CreateIC

DeleteDC

GetDCOrg

RestoreDC

SaveDC


Drawing-Tool Procedures and Functions

The display context manages the display of graphics on the screen. To display graphics in different ways, you can modify the drawing tools you use to render the graphics.

 -	Pens dictate the appearance of drawn lines.

 -	Brushes dictate the appearance of filled shapes.

 -	Fonts dictate the appearance of drawn text.

To assign the attributes of a drawing tool, a Windows program selects a logical or stock tool into a display context.

 -	A logical tool is one your program creates by filling the fields of a particular record (TLogPen, TLogBrush, or TLogFont).

 -	A stock tool is an existing, Windows-defined tool representing the most common attribute choices.

General

DeleteObject

GetBrushOrg

GetObject

SelectObject

SetBrushOrg

UnrealizeObject

Logical Brushes

CreateBrushIndirect

CreateDIBPatternBrush

CreateHatchBrush

CreatePatternBrush

CreateSolidBrush

EnumObjects

Logical Pens

CreatePen

CreatePenIndirect

EnumObjects

Logical Fonts

CreateFont

CreateFontIndirect

Stock Tools

GetStockObject


Color Palette Procedures and Functions

Some display devices can show many colors, but only a few at once.

The system or physical palette is the group or selection of colors currently available on the device for simultaneous display.

Windows gives your application partial control over what colors go into the device's system palette. If your applications use only simple colors, you don't need to use a palette directly.

AnimatePalette

CreatePalette

GetNearestPaletteIndex

GetPaletteEntries

GetSystemPaletteEntries

GetSystemPaletteUse

RealizePalette

SelectPalette

SetPaletteEntries

SetSystemPaletteUse

UpdateColors

Modifying the system palette affects everything drawn on the screen, including other applications. One application could make all the others appear with the incorrect colors.

The Windows palette manager solves this problem by mediating among applications trying to change the system palette. Windows provides each application with a logical palette (the group of colors needed by the application).

The palette manager maps the requested colors from the logical palette to the available colors in the system palette.

 -	If the requested color is not currently listed in the system palette, the palette manager can add the color to the system palette.

 -	If the logical palette specifies more colors than the system palette can hold, additional colors are matched to the closest available color in the system palette.

Windows reserves 20 permanent colors in the system palette to generally preserve the color scheme of every application, and of Windows itself.


Drawing-Attribute Procedures and Functions

Windows programs write to a logical entity called a display context (a virtual surface with associated attributes). The display context manages the display of graphics on the screen. You do not have control of the display context attributes.

You can, however, adjust certain drawing attributes, including background color and mode, polygon-filling mode, drawing (color-combining) mode, bitmap-stretching mode, and foreground color for text,

To change the attributes of displayed graphics, you can also modify the drawing tools you use to render the graphics. The attributes of these tools dictate the appearance of graphics drawn with GDI functions.

(See Drawing-Tool Procedures and Functions for more information)

GetBkColor

GetBkMode

GetPolyFillMode

GetROP2

GetStretchBltMode

GetTextColor

SetBkColor

SetBkMode

SetPolyFillMode

SetROP2

SetStretchBltMode

SetTextColor


Mapping Procedures and Functions

Mapping modes describe the relative size, position, and orientation of logical coordinates vs. device coordinates:

GetMapMode

GetViewportExt

GetViewportOrg

GetWindowExt

GetWindowOrg

OffsetViewportOrg

OffsetWindowOrg

ScaleViewportExt

ScaleWindowExt

SetMapMode

SetViewportExt

SetViewportOrg

SetWindowExt

SetWindowOrg

The eight different mapping modes are explained in the mm_ Mapping modes Help screen.


Coordinate Procedures and Functions
Coordinate-Translation Procedures and Functions

Sometimes you need  to translate between the logical coordinates (used to draw with) and physical bitmap coordinates (which the current mapping mode translates logical coordinates to).

GDI provides these functions to handle such coordinate translations:

ChildWindowFromPoint

ClientToScreen

DPtoLP

LPtoDP

ScreenToClient

WindowFromPoint


Region Procedures and Functions

A region is an area (a polygon or an ellipse) within a window. Regions can be filled with graphical output.

Region procedures and functions create, modify, and get information about regions.

CombineRgn

CreateEllipticRgn

CreateEllipticRgnIndirect

CreatePolygonRgn

CreatePolyPolygonRgn

CreateRectRgn

CreateRectRgnIndirect

CreateRoundRectRgn

EqualRgn

FillRgn

FrameRgn

GetRgnBox

InvertRgn

OffsetRgn

PaintRgn

PtInRegion

RectInRegion

SetRectRgn


Clipping Procedures and Functions

To prevent drawing outside of the intended area, every display context has a clipping region attribute.

For most applications, the default clipping region (the window's client area) will suffice. Only applications that produce special visual effects need to alter the clipping region.

ExcludeClipRect

GetClipBox

IntersectClipRect

OffsetClipRgn

PtVisible

RectVisible

SelectClipRgn


Line-Output Procedures and Functions
Line-Drawing Procedures and Functions

Line drawing procedures and functions use the specified display context's current pen to draw.

Arc

LineDDA

LineTo

MoveTo

Polyline


Shape-Drawing Procedures and Functions

Shape-drawing functions use the specified display context's current pen to draw the perimeter and the current brush to fill the interior. They do not affect the current position.

Chord

DrawFocusRect

Ellipse

Pie

Polygon

PolyPolygon

Rectangle

RoundRect


Bitmap Procedures and Functions

The actual surface of a display context is called a bitmap. Because bitmaps represent the memory configuration of a particular device, they are dependent on the kind of device being addressed.

GDI provides some techniques to address this problem, including device-independent bitmaps.

BitBlt

CreateBitmap

CreateBitmapIndirect

CreateCompatibleBitmap

CreateDiscardableBitmap

ExtFloodFill

FloodFill

GetBitmapBits

GetBitmapDimension

GetPixel

LoadBitmap

PatBlt

SetBitmapBits

SetBitmapDimension

SetPixel

StretchBlt


Device-Independent Bitmap Procedures and Functions

Because bitmaps represent the memory configuration of a particular device, they are dependent on the kind of device being addressed.

This dependence means that bitmaps saved from one device might be incompatible with another device.

GDI provides device-independent ("DI") bitmaps to address this problem. The following routines handle DI bitmaps:

CreateDIBitmap

GetDIBits

SetDIBits

SetDIBitsToDevice

StretchDIBits


Text Procedures and Functions
Text-Drawing Procedures and Functions

Text-drawing functions use the specified display context's current font to draw.

ExtTextOut

GetTabbedTextExtent

GetTextAlign

GetTextExtent

GetTextFace

GetTextMetrics

SetTextAlign

SetTextJustification

TabbedTextOut

TextOut


Font Procedures and Functions

A font is a subset of a particular typeface. Font procedures and functions create, select, remove, and get information about fonts.

AddFontResource

CreateFont

CreateFontIndirect

EnumFonts

GetCharWidth

RemoveFontResource

SetMapperFlags


Metafile Procedures and Functions

A metafile is a set of GDI commands that creates text or images. Metafile functions create, copy, close, delete, retrieve, play, and get information about about metafiles.

CloseMetaFile

CopyMetaFile

CreateMetaFile

DeleteMetaFile

EnumMetaFile

GetMetaFile

GetMetaFileBits

PlayMetaFile

PlayMetaFileRecord

SetMetaFileBits


Printer-Control Procedures and Functions

DeviceCapabilities


Environment Procedures and Functions

GetEnvironment

SetEnvironment


Module-Management Procedures and Functions

FreeLibrary

FreeModule

FreeProcInstance

GetCodeHandle

GetInstanceData

GetModuleFileName

GetModuleHandle

GetModuleUsage

GetProcAddress

GetVersion

LoadLibrary

MakeProcInstance


Memory-Management Procedures and Functions

DefineHandleTable

GetFreeSpace

GetWinFlags

GlobalAlloc

GlobalCompact

GlobalDiscard

GlobalDosAlloc

GlobalDosFree

GlobalFlags

GlobalFree

GlobalHandle

GlobalLock

GlobalLRUNewest

GlobalLRUOldest

GlobalNotify

GlobalReAlloc

GlobalSize

GlobalUnlock

GlobalUnwire

GlobalWire

LimitEMSPages

LocalAlloc

LocalCompact

LocalDiscard

LocalFlags

LocalFree

LocalHandle

LocalInit

LocalLock

LocalReAlloc

LocalShrink

LocalSize

LocalUnlock

LockData

LockSegment

SetSwapAreaSize

SwitchStackBack

SwitchStackTo

UnlockData

UnLockSegment


Segment Procedures and Functions

AllocDStoCSAlias

AllocSelector

ChangeSelector

DefineHandleTable

FreeSelector

GetCodeInfo

GlobalFix

GlobalPageLock

GlobalPageUnlock

GlobalUnfix

LockSegment

UnlockSegment


Operating-System Interrupt Procedures and Functions

DOS3Call

NetBIOSCall


Task Procedures and Functions

Catch

ExitWindows

GetCurrentPDB

GetCurrentTask

GetDOSEnvironment

GetNumTasks

SetErrorMode

Throw

Yield


Resource-Management Procedures and Functions

AccessResource

AllocResource

FindResource

FreeResource

LoadAccelerators

LoadBitmap

LoadCursor

LoadIcon

LoadMenu

LoadResource

LoadString

LockResource

SetResourceHandler

SizeofResource

UnlockResource


String-Manipulation Procedures and Functions

AnsiLower

AnsiLowerBuff

AnsiNext

AnsiPrev

AnsiToOem

AnsiToOemBuff

AnsiUpper

AnsiUpperBuff

IsCharAlpha

IsCharAlphaNumeric

IsCharLower

IsCharUpper

lstrcat

lstrcmp

lstrcmpi

lstrcpyb

lstrlen

OemToAnsi

OemToAnsiBuff

ToAscii

wvsprintf


Atom-Management Procedures and Functions

AddAtom

DeleteAtom

FindAtom

GetAtomHandle

GetAtomName

GlobalAddAtom

GlobalDeleteAtom

GlobalFindAtom

GlobalGetAtomName

InitAtomTable

MakeIntAtom


Initialization-File Procedures and Functions

GetPrivateProfileInt

GetPrivateProfileString

GetProfileInt

GetProfileString

WritePrivateProfileString

WriteProfileString


Communication Procedures and Functions

BuildCommDCB

ClearCommBreak

CloseComm

EscapeCommFunction

FlushComm

GetCommError

GetCommEventMask

GetCommState

OpenComm

ReadComm

SetCommBreak

SetCommEventMask

SetCommState

TransmitCommChar

UngetCommChar

WriteComm


Sound Procedures and Functions

CloseSound

CountVoiceNotes

GetThresholdEvent

GetThresholdStatus

OpenSound

SetSoundNoise

SetVoiceAccent

SetVoiceEnvelope

SetVoiceNote

SetVoiceQueueSize

SetVoiceSound

SetVoiceThreshold

StartSound

StopSound

SyncAllVoices

WaitSoundState


Utility Macros
Utility Procedures and Functions

GetNearestPaletteIndex

HiByte

HiWord

LoByte

LoWord

MakeIntAtom

MakeIntResource

MakeLong

MakePoint

MulDiv

PaletteRGB

RGB


File I/O Procedures and Functions

GetDriveType

GetSystemDirectory

GetTempDrive

GetTempFileName

GetWindowsDirectory

_lclose

_lcreat

_llseek

_lopen

_lread

_lwrite

OpenFile

SetHandleCount


Application-Execution Procedures and Functions

LoadModule

WinExec

WinHelp


Message Procedures and Functions

CallWindowProc

DispatchMessage

GetMessage

GetMessagePos

GetMessageTime

InSendMessage

PeekMessage

PostAppMessage

PostMessage

PostQuitMessage

ReplyMessage

SendMessage

SetMessageQueue

TranslateAccelerator

TranslateMDISysAccel

TranslateMessage

WaitMessage


Window-Creation Procedures and Functions

AdjustWindowRect

AdjustWindowRectEx

CreateWindow

CreateWindowEx

DefDlgProc

DefFrameProc

DefMDIChildProc

DefWindowProc

DestroyWindow

GetClassInfo

GetClassLong

GetClassName

GetClassWord

GetLastActivePopup

GetWindowLong

GetWindowWord

RegisterClass

SetClassLong

SetClassWord

SetWindowLong

SetWindowWord

UnregisterClass


Display and Movement Procedures and Functions

ArrangeIconicWindows

BeginDeferWindowPos

BringWindowToTop

CloseWindow

DeferWindowPos

EndDeferWindowPos

GetClientRect

GetWindowRect

GetWindowText

GetWindowTextLength

IsIconic

IsWindowVisible

IsZoomed

MoveWindow

OpenIcon

SetWindowPos

SetWindowText

ShowOwnedPopups

ShowWindow


Input Procedures and Functions

EnableWindow

GetActiveWindow

GetCapture

GetCurrentTime

GetDoubleClickTime

GetFocus

GetTickCount

IsWindowEnabled

KillTimer

ReleaseCapture

SetActiveWindow

SetCapture

SetDoubleClickTime

SetFocus

SetSysModalWindow

SetTimer

SwapMouseButton


Hardware Procedures and Functions

EnableHardwareInput

GetAsyncKeyState

GetInputState

GetKeyboardState

GetKeyNameText

GetKeyState

GetKBCodePage

OemKeyScan

SetKeyboardState

MapVirtualKey

VkKeyScan


Painting Procedures and Functions

BeginPaint

DrawFocusRect

DrawIcon

DrawText

EndPaint

ExcludeUpdateRgn

FillRect

FrameRect

GetDC

GetUpdateRect

GetUpdateRgn

GetWindowDC

GrayString

InvalidateRect

InvalidateRgn

InvertRect

ReleaseDC

UpdateWindow

ValidateRect

ValidateRgn


Dialog-Box Procedures and Functions

CheckDlgButton

CheckRadioButton

CreateDialog

CreateDialogIndirect

CreateDialogIndirectParam

CreateDialogParam

DefDlgProc

DialogBox

DialogBoxIndirect

DialogBoxIndirectParam

DialogBoxParam

DlgDirList

DlgDirListComboBox

DlgDirSelect

DlgDirSelectComboBox

EndDialog

GetDialogBaseUnits

GetDlgCtrlID

GetDlgItem

GetDlgItemInt

GetDlgItemText

GetNextDlgGroupItem

GetNextDlgTabItem

IsDialogMessage

IsDlgButtonChecked

MapDialogRect

SendDlgItemMessage

SetDlgItemInt

SetDlgItemText


Scrolling Procedures and Functions

GetScrollPos

GetScrollRange

ScrollDC

ScrollWindow

SetScrollPos

SetScrollRange

ShowScrollBar


Menu Procedures and Functions

AppendMenu

CheckMenuItem

CreateMenu

CreatePopupMenu

DeleteMenu

DestroyMenu

DrawMenuBar

EnableMenuItem

GetMenu

GetMenuCheckMarkDimensions

GetMenuItemCount

GetMenuItemID

GetMenuState

GetMenuString

GetSubMenu

GetSystemMenu

HiliteMenuItem

InsertMenu

LoadMenuIndirect

ModifyMenu

RemoveMenu

SetMenu

SetMenuItemBitmaps

TrackPopupMenu


Information Procedures and Functions

AnyPopup

ChildWindowFromPoint

EnumChildWindows

EnumTaskWindows

EnumWindows

FindWindow

GetNextWindow

GetParent

GetTopWindow

GetWindow

GetWindowTask

IsChild

IsWindow

SetParent

WindowFromPoint


System Procedures and Functions

GetCurrentTime

GetSysColor

GetSystemMetrics

SetSysColors


Clipboard Procedures and Functions

ChangeClipboardChain

CloseClipboard

EmptyClipboard

EnumClipboardFormats

GetClipboardData

GetClipboardFormatName

GetClipboardOwner

GetClipboardViewer

GetPriorityClipboardFormat

IsClipboardFormatAvailable

OpenClipboard

RegisterClipboardFormat

SetClipboardData

SetClipboardViewer


Error Procedures and Functions

FlashWindow

MessageBeep

MessageBox


Caret Procedures and Functions

CreateCaret

DestroyCaret

GetCaretBlinkTime

GetCaretPos

HideCaret

SetCaretBlinkTime

SetCaretPos

ShowCaret


Cursor Procedures and Functions

ClipCursor

CreateCursor

DestroyCursor

GetCursorPos

LoadCursor

SetCursor

SetCursorPos

ShowCursor


Hook Procedures and Functions

CallMsgFilter

DefHookProc

SetWindowsHook

UnhookWindowsHook


Property Procedures and Functions

EnumProps

GetProp

RemoveProp

SetProp


Rectangle Procedures and Functions

In Windows, a rectangle is defined by a data structure. (See TRect).

Rectangle functions modify and get information about rectangles.

CopyRect

EqualRect

InflateRect

IntersectRect

OffsetRect

PtInRect

SetRectEmpty

UnionRect


Index of Turbo Pascal Procedures and Functions

Abs	Func	Returns the absolute value of the argument.

Addr	Func	Returns the address of a specified object.

Append	Proc	Opens an existing file for appending.

ArcTan	Func	Returns the arctangent of the argument.

Assign	Proc	Assigns the name of an external file to a file variable.

BlockRead	Proc	Reads one or more records into a variable.

BlockWrite	Proc	Writes one or more records from a variable.

ChDir	Proc	Changes the current directory.

Chr	Func	Returns a character with a specified ordinal number.

Close	Proc	Closes an open file.

Concat	Func	Concatenates a sequence of strings.

Copy	Func	Returns a substring of a string.

Cos	Func	Returns the cosine of the argument (x is an angle, in radians).

CSeg	Func	Returns the current value of the CS register.

Dec	Proc	Decrements a variable.

Delete	Proc	Deletes a substring from a string.

Dispose	Proc	Disposes a dynamic variable.

DSeg	Func	Returns the current value of the DS register.

Eof	Func	Returns the end-of-file status.

Eoln	Func	Returns the end-of-line status of a text file.

Erase	Proc	Erases an external file.

Exit	Proc	Exits immediately from the current block.

Exp	Func	Returns the exponential of the argument.

FilePos	Func	Returns the current file position of a file.

FileSize	Func	Returns the current size of a file.

FillChar	Proc	Fills a specified number (count) of contiguous bytes with a specified value (can be type Byte or Char).

Flush	Proc	Flushes the buffer of a text file open for output.

Frac	Func	Returns the fractional part of the argument.

FreeMem	Proc	Disposes a dynamic variable of a given size.

GetDir	Proc	Returns the current directory of specified drive.

GetMem	Proc	Creates a dynamic variableof the specified size and puts the address of the block in a pointer variable.

Halt	Proc	Stops program execution and returns to the operating system.

Hi	Func	Returns the high-order byte of the argument.

Inc	Proc	Increments a variable.

Insert	Proc	Inserts a substring into a string.

Int	Func	Returns the Integer part of the argument.

IOResult	Func	Returns the status of the last I/O operation performed.

Length	Func	Returns the dynamic length of a string.

Ln	Func	Returns the natural logarithm of the argument.

Lo	Func	Returns the low-order Byte of the argument.

MaxAvail	Func	Returns the size of the largest contiguous free block in the heap.

MemAvail	Func	Returns the amount of all free memory in the heap.

MkDir	Proc	Creates a subdirectory.

Move	Proc	Copies bytes from source to dest.

New	Proc	Creates a new dynamic variable and sets a pointer variable to point to it.

Odd	Func	Tests if the argument is an odd number.

Ofs	Func	Returns the offset of a specified object.

Ord	Func	Returns the ordinal number of an ordinal-type value.

ParamCount	Func	Returns the number of parameters passed to the program on the command line.

ParamStr	Func	Returns a specified command-line parameter.

Pi	Func	Returns the value of Pi.

Pos	Func	Searches for a substring in a string.

Pred	Func	Returns the predecessor of the argument.

Ptr	Func	Converts a segment base and an offset address to a pointer-type value.

Random	Func	Returns a random number.

Randomize	Proc	Initializes the built-in random number generator with a random value (obtained from the system clock).

Read	Proc	For typed files, reads a file component into a variable. For text files, reads one or more values into one or more variables

ReadLn	Proc	Executes the Read procedure, then skips to the next line of the file.

Rename	Proc	Renames an external file.

Reset	Proc	Opens an existing file.

Rewrite	Proc	Creates and opens a new file.

RmDir	Proc	Removes an empty subdirectory.

Round	Func	Rounds a real-type value to an Integer-type value.

RunError	Proc	Stops program execution.

ScrollTo	Proc	Scrolls the CRT window to show a screen location.

Seek	Proc	Moves the current position of a file to a specified component.

SeekEof	Func	Returns the end-of-file status of a file.

SeekEoln	Func	Returns the end-of-line status of a file.

Seg	Func	Returns the segment of a specified object.

SetTextBuf	Proc	Assigns an I/O buffer to a text file.

Sin	Func	Returns the sine of the argument.

SizeOf	Func	Returns the number of bytes occupied by the argument.

SPtr	Func	Retruns the current value of the SP register.

Sqr	Func	Returns the square of the argument.

Sqrt	Func	Returns the square root of the argument.

SSeg	Func	Returns the current value of the SS register.

Str	Proc	Converts a numeric value to a string.

Succ	Func	Returns the successor of the argument.

Swap	Func	Swaps the high- and low-order bytes of the argument.

Trunc	Func	Truncates a real-type value to an Integer-type value.

Truncate	Proc	Truncates the file at the current file position.

UpCase	Func	Converts a character to uppercase.

Val	Proc	Converts a string value to its numeric representation.

Write	Proc	For typed files, writes a variable into a file component. For text files, writes one or more values to the file

WriteLn	Proc	Executes the Write procedure, then outputs an end-of-line marker to the file.


Compiler Directives

Compiler directives, which are comments with a special syntax, can be used wherever comments are allowed.

Compiler directives

- 	begin with {$ or (*$

- 	are followed by the name of the directive

- 	end with } or *)

Compiler directives come in three varieties:

-	Switch directives turn compiler features on or off when you specify + or - after the directive name.

-	Parameter directives specify parameters that affect the compilation.

-	Conditional directives control conditional compilation of parts of the source text.

For a summary of compiler directives vs. options in the Compiler Options dialog box, see the Directives and IDE Equivalents Help screen.


Switch Directives

Switch directives turn compiler features on or off.

They are local or global:

-	Local variables can appear anywhere in a program unit. They affect only part of the compilation.

-	Global variables must appear before the declaration parrt of the program or unit being compiled. They affect the entire compilation.

Switch	Meaning

$A	Align Data

$B	Boolean Evaluation

$D	Debug Information

$F	Force FAR Calls

$G	Generate 286 Instructions

$I	Input/Output Checking

$L	Local Symbol Information

$N	Numeric Coprocessor

$R	Range Checking

$S	Stack-Overflow Checking

$V	String Var Checking

$W	Windows Stack Frame

$X	Extended Syntax

You can group multiple switch directives, separating them with commas. For example:

$F,$R,$E,$D


Parameter Directives

Parameter directives specify parameters that affect how a program is compiled.

Parameter Directive	Meaning

$C Attribute	Code Segment Attribute

$D Text	Description

$I FileName	Include File

$L FileName	Link Object File

$M StackSize,HeapSize	Memory Allocation Sizes

$R FileName	Resource File

They must have at least one blank space between the directive name and its parameters. For example:

$I TYPES.INC

$O MOONUNIT.TPU


Conditional Compilation Directives
Conditional Compilation: Directives and Symbols

Conditional compilation is based on the evaluation of conditional symbols.

Directive	Meaning

DEFINE	Defines a conditional symbol

ELSE	Compiles or ignores portion of source text

ENDIF	Ends the conditional compilation

IFDEF	Compiles source text if Name is defined

IFNDEF	Compiles source text if Name is NOT defined

IFOPT	Compiles source text if a compiler switch is in a specified state (+ or -)

UNDEF	Undefines previously defined conditional symbol

Symbol	Meaning

CPU86	CPU belongs to 80x86 processor family

CPU87	Only defined if an 80x87 numeric coprocessor is present at compile time

VER10	Turbo Pascal for Windows version number

WINDOWS	Indicates operating enviroment is MS-Windows

See Also

Conditional compilation constructs


Conditional Compliation Constructs
Conditional Compilation Constructs

You can use conditional compilation directives to produce different code from the same source text, based on the state of conditional symbols.

These are the two constructs you can use:

 - 	$IFxxx ... $ENDIF

 - 	$IFxxx ... $ELSE ... $ENDIF

IF ... ENDIF

The $IFxxx ... $ENDIF construct causes the source text between $IFxxx and $ENDIF to be compiled only if the condition specified in $IFxxx is True.

If the condition is False, the source text between the two directives is ignored.

IF ... ELSE ... ENDIF

The $IFxxx ... $ELSE ... $ENDIF construct causes:

 - 	the source text between $IFxxx and $ELSE to be compiled if the $IFxxx condition is True, or

 - 	the source text between $ELSE and $ENDIF to be compiled if the $IFxxx condition is not True.

Conditional constructs can be nested to 16 levels deep.

There must be an equal number of $IFxxx and $ENDIF directives in every source file.

See Also

$ELSE

$ENDIF

$IFDEF

$IFNDEF


Directives and IDE Equivalents

Directive	Equivalent in Compiler Options Dialog Box

$A+	Align Data ..Word

$A-	Align Data..Byte

$B+	Boolean Evaluation..Complete

$B-	Boolean Evaluation..Short Circuit

$D+	Debug Information..On

$D-	Debug Information..Off

$F+	Force Far Calls..On

$F-	Force Far Calls..Off

$G+	286 Code..On

$G-	286 Code..Off

$I+	I/O Checking..On

$I-	I/O Checking..Off

$L+	Local Symbols..On

$L-	Local Symbols..Off

$M	Memory Sizes..(values)

$N+	80x87 Code..On

$N-	80x87 Code..Off

$R+	Range Checking..On

$R-	Range Checking..Off

$S+	Stack Checking..On

$S-	Stack Checking..Off

$V+	String Var Checking..Strict

$V-	String Var Checking..Relaxed

$W+	Windows Stack Frame..On

$W-	Windows Stack Frame..Off

$X+	Extended Syntax..On

$X-	Extended Syntax..Off


DEFINE Conditional Symbol Directive

Defines a conditional symbol of Name

Syntax

$DEFINE Name

The defined symbol is recognized for the remainder of the compilation, or until it appears in an $UNDEF Name directive.

$DEFINE Name has no effect if Name is already defined.


UNDEF Conditional Symbol Directive

Undefines a previously defined conditional symbol of Name

Syntax

$UNDEF Name

The symbol is forgotten for the remainder of the compilation or until it reappears in a $DEFINE directive.

$UNDEF Name directive has no effect if Name is already undefined (not already defined).


IFDER Conditional Compliation Directive
IFDEF Conditional Compilation Directive

Compiles the source text that follows it if Name is defined

Syntax

$IFDEF Name

See Also

$IFNDEF

$IFOPT

$ELSE

$ENDIF


IFNDEF Conditional Compliation Directive
IFNDEF Conditional Compilation Directive

Compiles the source text that follows it if Name is NOT defined

Syntax

$IFNDEF Name

See Also

$IFDEF

$IFOPT

$ELSE

$ENDIF


IFOPT Conditional Compliation Directive
IFOPT Conditional Compilation Directive

Compiles the source text that follows it if Switch is currently in the specified state

Syntax

$IFOPT Switch

Switch is the name of a switch option, followed by + or -:

Switch+	Switch is On

Switch-	Switch is Off

See Also

$IFDEF

$IFNDEF

$ELSE

$ENDIF


ELSE Conditional Compliation Directive
ELSE Conditional Compilation Directive

Compiles or ignores the source text that follows it

Syntax

$ELSE

Within a portion of source text delimited by an $IFDEF (or an $IFNDEF) and an $ENDIF, $ELSE compiles the source code that follows it if the $IFDEF (or $IFNDEF) condition is NOT met.

If the $IFDEF (or $IFNDEF) condition is met, $ELSE ignores the source code that follows it.

See Also

$IFDEF

$IFNDEF

$IFOPT

$ENDIF


ENDIR Conditional Compliation Directive
ENDIF Conditional Compilation Directive

Ends the conditional compilation initiated by the last $IFxxx directive

Syntax

$ENDIF

See Also

$IFDEF

$IFNDEF

$IFOPT

$ELSE


VER10 Conditional Symbol

Turbo Pascal for Windows 1.0 always defines the symbol VER10, which indicates that you're using Turbo Pascal for Windows version 1.0.


WINDOWS Conditional Symbol

Turbo Pascal for Windows always defines the symbol WINDOWS, which indicates that the operating environment is MS-Windows.

Versions of Turbo Pascal for other operating environments or operating systems define a symbolic name for that particular operating environment or operating system, instead.


CPU86 Conditional Symbol

Turbo Pascal always defines the symbol CPU86.

It indicates that the CPU belongs to the 80x86 processor family.


CPU87 Conditional Symbol

Turbo Pascal only defines the symbol CPU87 if an 80x87 numeric coprocessor is present at compile time.

If you place this construct at the start of a compilation,

$IFDEF CPU87 $N+ $ELSE $N- $ENDIF

Turbo Pascal will automatically select the appropriate model of floating-point generation for the computer you're compiling on.


Align Data Switch
$A:  Align Data Switch

Switches between byte- and word-alignment of variables and typed constants.

Syntax:	$A+ or $A-

Default:	A+

Type:	Global

Command-Line:	/$A+ or /$A-

Menu Command:	Options|Compiler|Align Data

Remarks

Word-alignment has no effect on the 8088 CPU.

On all 80x86 CPUs, word-alignment means faster execution.

-	Word-sized items on even addresses are accessed in one memory cycle.

-	Words on odd addresses are accessed in two memory cycles.

The $A+ State

In the $A+ state, all variables and typed constants larger than 1 byte are aligned on a machine-word boundary (an even-numbered address).

If required, unused bytes are inserted between variables to achieve word-alignment.

$A+ does not affect byte-sized variables, fields of record structures, or elements of arrays.

A field in a record will align on a word boundary only if the total size of all fields before it is even.

For every element of an array to align on a word boundary, the size of the elements must be even.

The $A- State

In the $A- state, no alignment measures are taken.

Variables and typed constants are simply placed at the next available address, regardless of their size.

NOTE: Regardless of the state of $A, each global var and const declaration section always starts at a word boundary.

Also, the compiler always keeps the stack pointer (SP) word-aligned, by allocating an extra unused byte in a procedure's stack frame if required.


Boolean Evaluation Switch
$B:  Boolean Evaluation Switch

Switches between the two different models of code generation for the AND and OR Boolean operators.

Syntax:	$B+ or $B-

Default:	$B-

Type:	Local

Command-Line:	/$B+ or /$B-

Menu Command:	Options|Compiler|Boolean Evaluation

The $B+ State

In the $B+ state, the compiler generates code for complete Boolean expression evaluation.

This means that every operand of a Boolean expression built from the AND and OR operators is guaranteed to be evaluated, even when the result of the entire expression is already known.

The $B- State

In the $B- state, the compiler generates code for short-circuit Boolean expression evaluation.

This means evaluation stops as soon as the result of the entire expression becomes evident.


Debug Information Switch
$D:  Debug Information Switch

Enables or disables the generation of debug information

Syntax:	$D+ or $D-

Default:	$D+

Type:	Global

Command-Line:	/$D+ or /$D-

Menu Command:	Options|Compiler|Debug Information

Remarks

Debug information consists of a line-number table for each procedure. The table maps object-code addresses into source-text line numbers.

When Debug Information is On for a given program or unit, you can use Turbo Debugger for Windows to single-step and set breakpoints in that module.

The Options|Linker|Map File radio buttons produce complete line information for a given module only if you've compiled that module in the $D+ state.

For units, the debug information is recorded in the .TPU file, along with the unit's object code.

Debug information increases the size of .TPU files, and takes up additional room when you compile programs that use the unit, but it does not affect the size or speed of the executable program.

The Debug Information switch is usually used with the Local Symbols switch.

NOTE: If you want to use Turbo Debugger for Windows to debug your program, turn on Options|Linker|Debug Info in Exe.


Force Far Calls Switch
$F:  Force Far Calls Switch

Controls which call model to use for subsequently compiled procedures and functions

Syntax:	$F+ or $F-

Default:	$F-

Type:	Local

Command-Line::	/$F+ or /$F-

Menu Command:	Options|Compiler|Force Far Calls

The $F+ State

Procedures and functions compiled in the $F+ state always use the FAR call model.

The $F- State

In the $F- state, Turbo Pascal automatically selects the appropriate model:

-	FAR if the procedure or function is declared in a unit's interface section

-	NEAR if the procedure or function is declared somewhere else

For programs that use procedural variables, all such procedures must use the FAR code model.


Generate 80286 Code Switch
$G:  Generate 80286 Code Switch

Enables or disables 80286 code generation

Syntax:	$G+ or $G-

Default:	$G-

Type:	Local

Command-Line:	/$G+ or /$G-

Menu Command:	Options|Compiler|286 Code

The $G- State

In the $G- state, only generic 8086 instructions are generated.

Programs compiled in this state can run on any 80x86 family processor.

The $G+ State

In the $G+ state, the compiler uses the additional instructions of the 80286 to improve code generation.

Programs compiled in this state cannot run on 8088 and 8086 processors.

Additional instructions used in the $G+ state include

-	ENTER

-	LEAVE

-	PUSH immediate

-	extended IMUL

-	extended SHL

-	extended SHR


Input/Output-Checking Switch
$I:  Input/Output-Checking Switch

Enables or disables the automatic code generation that checks the result of a call to an I/O procedure

Syntax:	$I+ or $I-

Default:	$I+

Type:	Local

Command-Line:	/$I+ or /$I-

Menu Command:	Options|Compiler|I/O Checking

Remarks

If an I/O procedure returns a non-zero I/O result when the $I switch is on, the program terminates, displaying a run-time error message.

When the $I switch is off, you must use the IOResult function to check for I/O errors.


Local Symbol Information Switch
$L:  Local Symbol Information Switch

Enables or disables the generation of local symbol information

Syntax:	$L+ or $L-

Default:	$L+

Type:	Global

Command-Line:	/$L+ or /$L-

Menu Command:	Options|Compiler|Local Symbols

Remarks

Local symbol information consists of

-	the symbols in the module's implementation part (names and types of all local variables and constants in a module), and

- 	the symbols within the module's procedures and functions

When local symbols are on for a given program or unit, you can use the integrated debugger to examine and modify the module's local variables.

$L will not take effect unless you have checked the Options|Linker|Debug Info in Exe chheck box or specified /V on the command line when using TPCW.EXE.

The Options|Debug|Debug Information option and the Options|Linker|Map File option produce local symbol information for a given module only if that module was compiled in the $L+ state.

For units, the local symbol information is recorded in the .TPU file, along with the unit's object code. Local symbol information increases the size of .TPU files, and takes up additional room when you compile programs that use the unit It does not affect the size or speed of the executable program.

The Local Symbol Information switch is usually used with the Debug Information switch $D.

NOTE: The $L directive is ignored if Debug Information is off ($D-).


Numeric Coprocessor Switch
$N:  Numeric Coprocessor Switch

Switches between the two different models of floating-point code generation supported by Turbo Pascal

Syntax:	$N+ or $N-

Default:	$N-

Type:	Global

Command-Line:	/$N+ or /$N-

Menu Command:	Options|Compiler|80x87

The $N- State

In the $N- state, Turbo Pascal generates code to perform all real-type calculations in software by calling run-time library routines.

The $N+ State

In the $N+ state, Turbo Pascal generates code to perform all real-type calculations using the 8087 numeric coprocessor and gives you access to four additional real types: Single, Double, Extended, and Comp.


Range-Checking Switch
$R:  Range-Checking Switch

Enables and disables the generation of range-checking code

Syntax:	$R+ or $R-

Default:	$R-

Type:	Local

Command-Line:	/$R+ or /$R-

Menu Command:	Options|Compiler|Range-checking

The $R+ State

In the $R+ state,

 - 	all array and string-indexing expressions are verified as being within the defined bounds

 - 	all assignments to scalar and subrange variables are checked to be within range

If a range-check fails, the program terminates and displays a run-time error message.

Enabling range-checking slows down your program and makes it larger.

Use this option when debugging, then turn it off once the program is bug-free.


Stack-Overflow Checking Switch
$S:  Stack-Overflow Checking Switch

Enables and disables the generation of stack-overflow checking code

Syntax:	$S+ or $S-

Default:	$S+

Type:	Local

Command-Line:	/$S+ or /$S-

Menu Command:	Options|Compiler|Stack Checking

The $S+ State

In the $S+ state, the compiler generates code at the beginning of each procedure or function to check whether there is sufficient stack space for the local variables and other temporary storage.

When there is not enough stack space, a call to a procedure or function compiled with $S+ causes the program to terminate and display a run-time error message.

The $S- State

In the $S- state, a call to a procedure or function compiled with $S+, when there is not enough stack space, is likely to cause a system crash.


Var-String Checking Switch
$V:  Var-String Checking Switch

Controls type-checking on strings passed as variable parameters

Syntax:	$V+ or $V-

Default:	$V+

Type:	Local

Command-Line:	/$V+ or /$V-

Menu Command:	Options|Compiler|String Var-Checking

The $V+ State

In the $V+ state, strict type-checking is performed, requiring the formal and actual parameters to be of identical string types.

The $V- State

In the $V- state, any string type variable is allowed as an actual parameter, even if the declared maximum length is not the same as that of the formal parameter.


Windows Stack Frame Switch
$W:  Windows Stack Frame Switch

Generates special prolog and epilog code for far procedures and functions.

Syntax:	$W+ or $W-

Default:	$W+

Type:	Local

Command-Line:	/$W+ or /$W-

Menu Command:	Options|Compiler|Windows Stack Frame

The $W+ State

In the $W+ state, the compiler generates special entry and exit code for far procedures and functions.

This code enables the Windows real-mode memory manager to correctly identify far stack frames when it adjusts the call chain after moving a code or data segment.

The $W- State

In the $W- state, the compiler does not generate this special code.

Disable this option if your program will run in protected mode only.


Extended Syntax Switch
$X:  Extended Syntax Switch

Enables or disables Turbo Pascal's extended syntax.

Syntax:	$X+ or $X-

Default:	$X+

Type:	Global

Command-Line:	/$X+ or /$X-

Menu Command:	Options|Compiler|Extended Syntax

The $X+ State

In the $X+ state, function calls can be used as statements; the result of a function call can be discarded.

Generally, computations performed by a function are represented through its result, so it makes little sense to discard the result.

However, in some cases, a function can carry out multiple operations based on its parameters. Some of those cases might not produce a sensible result.

In such cases, the $X+ extensions allow the function to be treated as a procedure.

The $X+ directive does not apply to built-in functions (functions defined in the System unit).

The $X+ mode also enables support for null-terminated strings by activating the special rules that apply to the built-in PChar type and zero-based character arrays. See the Strings unit Help screen for more information.


Include File Directive
$I:  Include File Directive

Instructs the compiler to include the named file in the compilation

Syntax:	$I FileName

Type:	Local

Command-Line:	/I Path

Menu Command:	Options|Directories|Include Directories

Remarks

The default extension for FileName is .PAS.

If FileName does not specify a directory, Turbo Pascal searches for the file

-	first in the current directory

-	then in the directories specified in the Include Directories input box (or in the directories you specified in the /I option the TPCW command line)

The included file is inserted in the compiled text right after the $I FileName directive. You can nest Include files up to 15 levels deep.

NOTE: An Include file can't be specified in the middle of a statement part.

All statements between the begin and end of a statement part must reside in the same source file.


Link Object File Directive
$L:  Link Object File Directive

Instructs the compiler to link the named file with the program or unit being compiled

Syntax:	$L FileName

Type:	Local

Command-Line:	/O Path

Menu Command:	Options|Directories|Object Directories

Remarks

The $L directive is used to link with code written in assembly language for subprograms declared to be external.

The named file must be an Intel relocatable object file (.OBJ file).

The default extension for FileName is .OBJ.

If FileName does not specify a directory, Turbo Pascal searches

-	first in the current directory

-	then in the directories specified in the Options|Directories|Object Directories input box (or in the directories you specify in the /O option on the TPCW command line)


Memory Allocation Sizes Directive
$M:  Memory Allocation Sizes Directive

Specifies a program's memory allocation parameters.

Syntax:	$M StackSize, HeapSize

Default:	$M 8192,8192

Type:	Global

Command-Line:	/$M

Menu Command:	Options|Compiler|Memory Sizes

NOTE: The $M directive has no effect when used in a unit.

See Also

StackSize

HeapSize


Code Segment Attribute
$C:  Code Segment Attribute

Controls the attributes of a code segment.

Syntax:	$C Attribute Attribute

Type:	Global

Remarks

Every code segment in an application or library has a set of attributes that determine its behavior when it is loaded into memory.

The code segment attributes occur in groups of two. Each option has an opposite toggle:

Option	Meaning

MoveAble	Windows can change the location of the code segment in memory.

Fixed	Windows can't change the location of the code segment in memory.

Preload	The code segment loads when your program begins execution.

DemandLoad	The code segment loads only when it is needed.

Permanent	Once Windows loads the code segment, it remains in memory.

Discardable	The code segment can be unloaded when it is no longer needed.

The first option is each group is the default. If both options are specified, only the last one will take effect.


Description Directive
$D:  Description Directive

Inserts the specified text into an EXE file or DLL.

Syntax:	$D Text

Type:	Global


Resource File Directive
$R:  Resource File Directive

Specifies the name of the resource file to be included in an application or library.

Syntax:	$R FileName

Type:	Global

Command-Line:	/R path

Menu Command:	Options|Directories|Resource Directories

Remarks

The default extension for FileName is .RES. It must be a Windows resource file.

If FileName does not specify a directory, Turbo Pascal searches for the file

-	first in the current directory

-	then in the directories specified in the Resource Directories input box (or in the directories you specified in the /R option on the TPCW command line)

When used in a unit, the resource file is simply recorded in the resulting .TPU file. No checks are made to ensure that the file exists.

When an application or library is linked, the resource files specified in all units and in the program or library are processed. Each resource in each resource file is copied to the .EXE or .DLL file being produced.


Inline assembler
The Inline Assembler

With Turbo Pascal's inline assembler, you can write 8086/8087 and 80286/80287 assembler code directly inside your Pascal programs.

Index to Inline Assembler Help

asm

assembler directive

entry and exit code

expression classes

expression operators

expression symbols

expression types

expressions

functions

instruction opcodes

labels

numeric constants

operands

predefined type symbols

prefix opcodes

procedures

register symbols

relocatable expressions

reserved words

special symbols

string constants

Using the Inline Assembler

You access the inline assembler through assembler statements (with the asm directive).

Inline assembler procedures and functions must obey the same rules as external procedures and functions.

Expressions

Turbo Pascal's inline assembler operands are expressions. The basic elements of an expression are constants, registers, symbols, and operators.

The inline assembler divides expressions into three classes:

registers

memory references

immediate values

Symbols

The inline assembler provides access to almost all Pascal symbols in assembler expressions, including labels, constants, types, variables, procedures, and functions.

In addition to any currently declared Pascal types, the inline assembler provides several predefined type symbols.

Constants

Turbo Pascal's inline assembler supports two types of constants:

numeric constants

string constants

Opcodes, Operators, and Directives

Turbo Pascal's inline assembler supports:

-	All 8086/8087 and 80286/80287 instructions

-	Opcodes

-	Most Turbo Assembler expression operators

-	Turbo Assembler's define byte, define word, and define double word directives (DB, DW, and DD)

Most operations implemented through Turbo Assembler directives are matched by corresponding Turbo Pascal constructs.

The inline assembler also implements a large subset of the syntax supported by Turbo Assembler and Microsoft's Macro Assembler.


Inline Assembler Entry and Exit Code

The automatically generated entry and exit code for an assembler procedure or function looks like this:

PUSH  BP         ;Present if Locals <> 0 or Params <> 0

MOV   BP,SP      ;Present if Locals <> 0 or Params <> 0

SUB   SP,Locals  ;Present if Locals <> 0

MOV   SP,BP      ;Present if Locals <> 0

POP   BP         ;Present if Locals <> 0 or Params <> 0

RET   Params     ;Always present

where

-	Locals is the size of the local variables

-	Params is the size of the parameters

If both Locals and Params are 0, there is no entry code and the exit code consists simply of a RET instruction.


Inline Assembler Operands

Inline assembler operands are expressions made up of a combination of constants, registers, symbols, and operators.

Although inline assembler expressions are built using the same basic principles as Pascal expressions, there are some important differences.

The inline assembler:

-	Recognizes its own set of reserved words.

-	Evaluates all expressions as 32-bit integer values.

-	Interprets variable references as the address of the variable. (Pascal interprets them as the variable's contents.)

Also, all inline assembler expressions must resolve to a constant value.


Inline Assembler Expressions

Turbo Pascal's inline assembler operands are expressions.

Inline assembler expressions are built from expression elements (constants, registers, and symbols) and operators. Each expression has an associated expression class and expression type.

Evaluation

The inline assembler evaluates all expressions as 32-bit integer values. It does not support floating-point and string values, except string constants.

NOTE: The most important difference between Pascal expressions and inline assembler expressions is that all inline assembler expressions must resolve to a constant value (a value that can be computed at compile time).


Inline Assembler Expression Classes
Expression Classes

The inline assembler divides expressions into three classes:

registers

memory references

immediate values


Inline Assembler Expression Operators

This table lists the inline assembler's expression operators in decreasing order of precedence.

The operators within each category have equal precedence.

Category	Operator	What it is (or does)

Highest	& 	Identifier override

(...) 	Subexpression

[...] 	Memory reference

 . 	Structure member selector

Unary	HIGH	Returns high-order 8 bits

LOW	Returns low-order 8 bits

+ 	Unary plus

- 	Unary minus

: 	Segment override

OFFSET	Returns offset part

SEG	Returns segment part

TYPE	Returns type (byte size)

PTR	Typecast

* 	Multiplication

/ 	Integer division

MOD	Integer modulus (remainder)

SHL	Logical shift left

SHR	Logical shift right

Additive	+ 	Binary addition

- 	Binary subtraction

Bitwise	NOT	Bitwise negation

AND	Bitwise AND

OR 	Bitwise OR

XOR	Bitwise Exclusive OR


Inline Assembler Expression Types

Every inline assembler expression has an associated type.

This type is a size, because the inline assembler regards the type of an expression as the size of its memory location.

The inline assembler performs type checking whenever possible; an error results if the type check fails.

You can use a typecast to change the type of a memory reference. For example, all of these refer to the first (least significant) byte of the OutBufPtr variable:

asm

  MOV     DL,BYTE PTR OutBufPtr

  MOV     DL,Byte(OutBufPtr)

  MOV     DL,OutBufPtr.Byte

end;

In some cases, a memory reference is untyped (it has no associated type); for example, an immediate value enclosed in square brackets:

asm

  MOV     AL,[100H]

  MOV     BX,[100H]

end;

The inline assembler permits both of these instructions because the expression [100H] has no associated type (it just means "the contents of address 100H in the data segment") and the type can be determined from the first operand (byte for AL, word for BX).

In cases where the type can't be determined from another operand, the inline assembler requires an explicit typecast, like this:

asm

  INC     BYTE PTR [100H]

  IMUL    WORD PTR [100H]

end;


Inline Assembler Predefined Type Symbols

In addition to any currently declared Pascal types, the inline assembler provides these predefined type symbols.

Symbol	Type

BYTE	1

WORD	2

DWORD	4

QWORD	8

TBYTE	10

NEAR	0FFFEH

FAR	0FFFFH


Inline Assembler NEAR and FAR Pseudo-Types
NEAR and FAR

The NEAR and FAR pseudo-types are used by procedure and function symbols to indicate their call model.

You can use NEAR and FAR in typecasts just like other symbols. For example, if Farproc is a FAR procedure:

procedure FarProc; far;

and you're writing inline assembler code in the same module as FarProc, you can use the more efficient NEAR call instruction to call FarProc:

asm

  PUSH    CS

  CALL    NEAR PTR FarProc

end;


Inline Assembler Class Registers
register expressions

An inline assembler expression that consists solely of a register name is a register expression.

Examples of register expressions are AX, CL, DI, and ES.

Used as operands, register expressions direct the assembler to generate instructions that operate on the CPU registers.


Inline Assembler memory reference expressions
memory reference expressions

Inline assembler expressions that denote memory locations are memory references.

Pascal's labels, variables, typed constants, procedures, and functions belong to this category.

Memory references are further classified as either relocatable or absolute expressions.


Inline Assembler Immediate Value Expressions
immediate value expressions

Inline assembler expressions that aren't registers and aren't associated with memory locations are immediate values.

This group includes Pascal's untyped constants and type identifiers.

Immediate values are further classified as either relocatable or absolute expressions.


Inline Assembler Relocatable vs. Absolute Expressions
relocatable vs. absolute expressions

Typically, an expression that refers to a label, variable, procedure, or function is relocatable, and an expression that operates solely on constants is absolute.

A relocatable expression denotes a value that requires relocation at link time. (Relocation is the process by which the linker assigns absolute addresses to symbols.)

An absolute expression denotes a value that requires no such relocation.

At compile time, the compiler does not know the final address of a label, variable, procedure, or function.

The final address does not become known until link time, when the linker assigns a specific absolute address to the symbol.

The inline assembler allows you to carry out any operation on an absolute value, but it restricts operations on relocatable values to addition and subtraction of constants.


Inline Assembler Register Symbols

In Turbo Pascal's inline assembler, the following reserved symbols denote CPU registers:

Symbols	Registers

AX BX CX DX	16-bit general purpose

AL BL CL DL	8-bit low registers

AH BH CH DH	8-bit high registers

SP BP SI DI	16-bit pointer or index

CS DS SS ES	16-bit segment registers

ST	8087 register stack

When an operand consists solely of a register name, it is called a register operand. All registers can be used as register operands.

Register Indexing

The base registers (BX and BP) and the index registers (SI and DI) can be written within square brackets to indicate indexing.

These are valid index register combinations:

[BP]

[BP+DI]

[BP+SI]

[BX]

[BX+DI]

[BX+SI]

[DI]

[SI]

Segment Overriding

The segment registers (ES, CS, SS, and DS) can be used in conjunction with the colon (:) segment override operator to indicate a different segment than the one the processor selects by default.


Inline Assembler Expression Symbols

The inline assembler provides access to almost all Pascal symbols in assembler expressions, including labels, constants, types, variables, procedures, and functions.

The inline assembler also provides several predefined type symbols.

Symbol	Value	Class	Type

Label	Address of label	Memory	Short

Constant	Value of constant	Immediate	0

Type	0	Memory	Size of type

Field	Offset of field	Memory	Size of type

Variable	Address of variable	Memory	Size of type

Procedure	Address of procedure	Memory	Near or Far

Function	Address of function	Memory	Near or Far

Unit	0	Immediate	0

@Code	Code segment addr	Memory	0FFF0H

@Data	Data segment addr	Memory	0FFF0H

@Result	Result var offset	Memory	Size of type

Symbols that can NOT be used

The following symbols can NOT be used in inline assembler expressions:

-	Standard procedures and functions (for  example, WriteLn, Chr)

-	The special arrays Port and PortW

-	String, floating-point, and set constants

-	Procedures and functions declared with the inline directive

-	Labels that aren't declared in the current block

-	The @Result symbol outside a function.

Local Variables

Local variables (variables declared in procedures and functions) are always allocated on the stack and accessed relative to SS:BP.

The value of a local variable symbol is its signed offset from SS:BP.

The inline assembler automatically adds [BP] in references to local variables.

Var Parameter

The inline assembler always treats a var parameter as a 32-bit pointer, and the size of a var parameter is always 4 (the size of a 32-bit pointer).

To access the contents of a var parameter, you must first load the 32-bit pointer and then access the location it points to.

Scope

A scope is provided by type, field, and variable symbols of a record or object type.

In addition, a unit identifier opens the scope of a particular unit, just like a fully qualified identifier in Pascal.

Operator

Some symbols, such as record types and variables, have a scope that can be accessed using the structure member selector (.) operator.

Type Identifier

You can use a type identifier to construct variables "on the fly".

Each of these instructions generates the same machine code, which loads the contents of ES:[DI+4] into AX:

asm

  MOV     AX,(Rect PTR ES:[DI]).B.X

  MOV     AX,Rect(ES:[DI]).B.X

  MOV     AX,ES:Rect[DI].B.X

  MOV     AX,Rect[ES:DI].B.X

  MOV     AX,ES:[DI].Rect.B.X

end;


ST Register Symbol
ST(x) Register Symbol

The symbol ST denotes the topmost register on the 8087 floating-point register stack.

Each of the eight floating-point registers can be referred to using ST(x), where X is a constant between 0 and 7, indicating the distance from the top of the register stack.


String Constants
Inline Assembler String Constants

In inline assembler statements, string constants must be enclosed in single or double quotes.

Two consecutive quotes of the same type as the enclosing quotes count as only one character.

String constants of any length are allowed in DB directives, and cause allocation of a sequence of bytes containing the ASCII values of the characters in the string.

When not in a DB directive, a string constant can be no longer than four characters, and denotes a numeric value which can participate in an expression.

The numeric value of a string constant is calculated as:

Ord(Ch1)

+ Ord(Ch2) shl  8

  + Ord(Ch3) shl 16

    + Ord(Ch4) shl 24

where

-	Ch1 is the rightmost (last) character

-	Ch4 is the leftmost (first) character

If the string is shorter than four characters, the leftmost (first) character(s) are assumed to be 0 (zero).

Here are some examples of string constants and their corresponding numeric values:

String	Numeric

Constant	Value

'a'	00000061H

'ba'	00006261H

'cba'	00636261H

'dcba'	64636261H

'a '	00006120H

'   a'	20202061H

'a'*2	000000E2H

'a'-'A'	00000020H

NOT 'a'	FFFFFF9EH


Numeric Constants
Inline Assembler Numeric Constants

Inline assembler numeric constants must be integers between -2,147,483,648 and 4,294,967,295, and they must start with one of the digits 0 through 9 or a $ character.

By default, numeric constants use decimal (base 10) notation, but the inline assembler supports binary (base 2), octal (base 8), and hexadecimal (base 16) notations as well.

To select

this notation	Write a...

Binary	letter B after the number

Octal	letter O after the number

Hexadecimal	letter H after the number, or a $ before the number

Pascal expressions allow only decimal notation and hexadecimal notation (using a $ prefix); they don't support the B, O, and H suffixes.

When you write a hexadecimal constant using the H suffix, and the first significant digit is one of the hexadecimal digits A through F, an extra zero (0) in front of the number is required.

Examples:

0BAD4H	Hexadecimal constant

$BAD4	Hexadecimal constant

BAD4H	Identifier (it starts with a letter B, not a digit)


Inline Assembler Reserved Words

Within operands, the following reserved words have a predefined meaning to the inline assembler:

Reserved Words Table

AH

AL

AND

AX

BH

BL

BP

BX

BYTE

CH

CL

CS

CX

DH

DI

DL

DS

DWORD

DX

ES

FAR

HIGH

LOW

MOD

NEAR

NOT

OFFSET

OR

PTR

QWORD

SEG

SHL

SHR

SI

SP

SS

ST

TBYTE

TYPE

WORD

XOR

These reserved words always take precedence over user-defined identifiers.

To access a user-defined symbol with the same name as an inline assembler reserved word, you must use the identifier override operator, (&).

NOTE: Avoid defining identifiers with the same names as inline assembler reserved words.


Inline Assembler Prefix Opcodes

The inline assembler supports the following prefix opcodes:

Opcode	What It Means

LOCK	Bus lock

REP	Repeat string operation

REPE	Repeat string operation while equal

REPZ	Repeat string operation while 0

REPNE	Repeat string operation while not equal

REPNZ	Repeat string operation while not 0

SEGCS	CS (code segment) override

SEGDS	DS (data segment) override

SEGES	ES (extra segment) override

SEGSS	SS (stack segment) override

An assembler instruction can be prefixed by zero, one, two, or three of these opcodes. Any more than three prefix opcodes won't make sense.

If you specify a prefix opcode without an instruction opcodes in the same statement, the prefix opcode affects the instruction opcode in the next assembler statement.

Because some 80x86 processors do not handle all combinations correctly, ordering in multiple prefix opcodes is important.


Inline Assembler Instruction Opcodes

The inline assembler supports all 8086/8087 and 80286/80287 instruction opcodes.

These instruction opcodes are only available in the following states:

Opcodes	State	Meaning of State

8087	$N+	Numeric processor enabled

80286	$G+	80286 code generation enabled

80287	$G+,N+	Both enabled

For complete descriptions of the instruction opcodes, refer to your 80x86 and 80x87 reference manuals.

See Also

inline assembler RET instructions

automatic jump sizing


Inline Assembler RET Instructions

Depending on the call model of the current procedure or function, RET generates either a near return or a far return machine-code instruction.

Generates NEAR return	Generates FAR return

procedure NearProc; near;	procedure FarProc; far;

begin	begin

  asm	  asm

    RET	    RET

  end;	  end;

end;	end;

 -	RETN always generates a near return.

 -	RETF always generates a far return.


Inline Assembler Jump Optimization

The inline assembler optimizes jump instructions by automatically selecting the shortest, most efficient form of a jump instruction.

When the target is a label (not a procedure or function), this automatic jump sizing applies to JMP and to all conditional jump instructions.

Opcode	Distance to Target Label	Inline Assembler Generates

JMP	Within -128 to 127 bytes	Short jump

NOT within -127 to 128 bytes	Near jump

Conditional	Within -128 to 127 bytes	Short jump

Jumps	NOT within -127 to 128 bytes	Short inverse jump

Jumps to the entry points of procedures and functions are always either near or far, but never short.

Conditional jumps to procedures and functions are not allowed.


Inline Assembler DB, DW, and DD Directives

The inline assembler supports three assembler directives: DB (define byte), DW (define word), and DD (define double word).

Dir	Operand Type	Value Range	Inline Assembler Generates

DB	Constant expression	    -128 to 255	1 byte

Character string	     Any length	Sequence of bytes corresponding to ASCII code of each character

DW	Constant expression	-32,768 to 65,535	1 word

Address expression	Near pointer (offset word)

DD	Constant expression	  -2,147,483,648	1 double word

to 4,294,967,295

Address expression	Far pointer (offset  word followed by segment word)

The data generated by the DB, DW, and DD directives is always stored in the code segment.

To generate uninitialized or initialized data in the data segment, use normal Pascal var or const declarations.

Here are some examples of DB, DW, and DD directives:

Dir	Operand	Result

DB	0FFH	One byte

DB	0,99	Two bytes

DB	'A'	Ord('A')

DB	'Hello...', 0DH,0AH	String + CR/LF

DB	12,"Turbo Pascal"	Pascal-style string

DW	0FFFFH	One word

DW	0,9999	Two words

DW	'A'	Same as DB 'A',0

DW	'BA'	Same as DB 'A','B'

DW	MyVar	Offset of MyVar

DW	MyProc	Offset of MyProc

DD	0FFFFFFFFH	One double-word

DD	0,999999999	Two double-words

DD	'A'	Same as DB 'A',0,0,0

DD	'DCBA'	Same as DB 'A','B','C','D'

DD	MyVar	Pointer to MyVar

DD	MyProc	Pointer to MyProc

The only kind of symbol that can be defined in an inline assembler statement is a label. All variables must be declared using Pascal syntax.


Assembler Statement
Inline Assembler Statement

The syntax of an assembler statement is

asm AsmStatement < Separator AsmStatement > end

where

-	AsmStatement is an assembler statement

-	Separator is a semicolon; a new line, or a Pascal comment.

You can put multiple assembler statements on one line if they are separated by semicolons. A semicolon is not required between two assembler statements if they are on separate lines.

Comments must be written in Pascal style, using { and } or (* and*).


Inline Assembler Labels

Labels consist of a label identifier and a colon before a statement.

Non-local labels defined in assembler must be declared in a label declaration part in the block containing the asm statement.

Local labels don't have to be declared in a label declaration part before they're used.


Inline Assembler Special Symbols
Inline Assembler @Code, @Data, and @Result

In addition to providing access to almost all Pascal symbols, the inline assembler implements the following special symbols:

Symbol	Meaning

@Code	The current code segment

@Data	The current data segment

@Result	The function result variable within the statement part of a function

@Code and @Data should only be used in conjunction with the SEG operator.


Inline Assembler Indentifier Override Operator
Identifier Override Operator (&)

The identifier immediately following the ampersand is treated as a user-defined symbol, even if the spelling is the same as an inline assembler reserved word.

&Identifier


Inline Assembler Subexpression
Subexpression (...)

The expression within the parentheses is a subexpression.

(Expression)

Subexpressions are evaluated completely before they are treated as a single expression element.

Another expression can precede the expression within the parentheses. In this case, the result becomes the sum of the values of the two expressions, with the type of the first expression.


Inline Assembler Memory Reference
Memory Reference Operator [...]

The expression within brackets refers to a memory location.

[Expression]

This memory reference expression is evaluated completely prior to being treated as a single expression element.

To indicate CPU register indexing, you can use the plus (+) operator to combine the memory reference expression with the BX, BP, SI, or DI registers.

Another expression can precede the memory reference expression. In this case, the result becomes the sum of the values of the two expressions, with the type of the first expression.

Result

Always a memory reference.


Inline Assembler Structure Member
Structure Member Operator (xxx.yyy)

The second expression is a member of the structure identified by the first expression.

Expression1.Expression2

Result

Sum of the two expressions.

Result Type

Type of the second expression.

Symbols belonging to the scope identified by the first expression can be accessed in the second expression.


Inline Assembler High Operator
HIGH Operator

HIGH returns the high-order 8 bits of the word-sized expression following the operator.

HIGH Expression

The expression must be an absolute immediate value.


Inline Assembler Low Operator
LOW Operator

LOW returns the low-order 8 bits of the word-sized expression following the operator.

LOW Expression

The expression must be an absolute immediate value.


Inline Assembler Unary Plus
Unary Plus (+...)

Unary plus returns the expression following the plus with no changes.

+Expression

The expression must be an absolute immediate value.


Inline Assembler Unary Minus
Unary Minus (-...)

Unary minus returns the negated value of the expression following the minus.

-Expression

The expression must be an absolute immediate value.


Inline Assembler Segment Override
Segment Override Operator (:...)

This operator instructs the assembler that the expression after the colon belongs to the segment given by the segment register name before the colon (CS, DS, SS, or ES).

XX:Expression

where XX = CS, DS, SS, or ES.

Result

A memory reference with the value of the expression after the colon.

When a segment override is used in an instruction operand, the instruction will be prefixed by an appropriate segment override prefix instruction.

This ensures that the indicated segment is selected.


Inline Assembler Offset
OFFSET Operator

OFFSET returns the offset part (low-order word) of the expression following the operator.

OFFSET Expression

Result

An immediate value.


Inline Assembler SEG Operator
SEG Operator

SEG returns the segment part (high-order word) of the expression following the operator.

SEG Expression

Result

An immediate value.


Inline Assembler Type Operator
TYPE Operator

TYPE returns the type (size in bytes) of the expression following the operator.

TYPE Expression

The type of an immediate value is 0.


Inline Assembler Typecast Operator
Typecast Operator (...PTR...)

PTR casts the second expression to the type of the first expression.

Expression1 PTR Expression2

Result

A memory reference with the value of the second expression and the type of the first expression.


Inline Assembler Multiplication
Multiplication Operator (...*...)

The * operator multiplies the first expression by the second expression.

Expression1 * Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Integer Division
Integer Division (.../...)

The / operator divides the first expression by the second expression and returns the integer part of the operation.

Expression1 / Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Integer Modulus
Modulus Operator (...MOD...)

MOD divides the first expression by the second expression and returns the remainder part of the operation.

Expression1 MOD Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Operator Shift Left
Shift Left Operator (...SHL...)

SHL shifts the first expression to the left by nnn bits, where nnn is the second expression.

Expression1 SHL Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Operator Shift Right
Shift Right Operator (...SHR...)

SHR shifts the first expression to the right by nnn bits, where nnn is the second expression.

Expression1 SHR Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Addition
Addition (...+...)

The + operator adds the first expression to the second expression (or vice versa).

Expression1 + Expression2

The expressions can be immediate values or memory references, but only one of the expressions can be a relocatable value.

Result

Relocatable value if one of the expressions is a relocatable value.

Memory reference if either of the expressions is a memory reference.


Inline Assembler Subtraction
Subtraction (...-...)

The - operator subtracts the second it from the first expression.

Expression1 - Expression2

The first expression can have any class, but the second expression must be an absolute immediate value.

Result

Has the same class as the first expression.


Inline Assembler Bitwise NOT
Bitwise Negation (NOT)

NOT returns the bitwise negative (1's complement) of the expression after it.

NOT Expression

The expression must be an absolute immediate value.

Result

Absolute immediate value.


Inline Assembler Bitwise AND
Bitwise AND

AND returns the bitwise AND of the two expressions.

Expression1 AND Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Bitwise OR
Bitwise OR

OR returns the bitwise OR of the two expressions.

Expression1 OR Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Bitwise XOR
Bitwise Exclusive OR (XOR)

XOR returns the bitwise exclusive-OR of the two expressions.

Expression1 XOR Expression2

Both expressions must be absolute immediate values.

Result

Absolute immediate value.


Inline Assembler Function Returns
Where Inline Assembler Functions Return

Functions using the inline assembler directive (asm) must return their results as follows:

Result	Returned in	Comment

Ordinal	AL (8-bit values)	Integer, Char, Boolean, and enumerated types

AX (16-bit values)

DX:AX  (32-bit values)

Real	DX:BX:AX 	Real type

8087	ST(0) on the 8087's	Single, Double, Extended, and Comp types

register stack

Pointer	DX:AX

String	The temporary location

 pointed to by @Result


Inline Assembler Short Jump
short jump

1-byte opcode followed by 1-byte displacement.


Inline Assembler Near Jump
near jump

1-byte opcode followed by 2-byte displacement.


Inline Assembler Short Inverse Jump
short inverse jump

A short jump with the inverse condition jumps over a near jump to the target label (5 bytes in total).


Inline Assembler Local Labels
local labels

A local label is a label that is known only within the asm statement that defines it.

Local labels:

-	begin with an at-sign (@)

-	are followed by one or more:

letters (A..Z)

digits (0..9)

underscores (_) or

at-signs (@)

-	end with a colon (:)

Because an at-sign can't be part of a Pascal identifier, local labels are automatically restricted to use within asm statements.

The scope of a local label extends from the "asm" keyword to the "end" keyword of the asm statement that contains it. Because of this limited scope, the same local label name can be used in different asm statements.

A local label does not have to be declared in a label declaration part before it is used.


Error Messages

Turbo Pascal generates two kinds of error messages: compiler error messages and run-time error messages.

Compiler Error Messages

If a compiler error occurs when you're compiling from within the IDE, Turbo Pascal makes the Edit window active and places the cursor at the point of error in your source code.

If the error occurs when you're using the command-line compiler, Turbo Pascal displays the error message and number and the offending source line; a caret (^) in the displayed source line indicates the error's location.

Run-time Error Messages

If your program generates an error at run time, it will terminate and this message will appear:

   Run-time error <nnn> at <xxxx:yyyy>

where

-	nnn is the run-time error number

-	xxxx:yyyy is the run-time error address

See Also

Run-time error messages

Compiler error messages


User error

This error has been reported in a modal dialog box. You must close the dialog box before you can fix the source of the error.

To close this dialog box, click OK (or press Enter).


Title Bar

You can double-click the title bar to zoom the window. You can also drag the title bar to move the window around.


Scroll Bars

Scroll bars are horizontal or vertical bars that show both mouse and keyboard users how far into the file they've gone. You use these bars with a mouse to scroll the contents of the window.

-	Click the arrow at either end to scroll one line at a time. (Keep the mouse button pressed to scroll continuously.)

-	You can click the shaded area at either end of the scroll box to scroll the window one page (windowful) at a time.

-	You can drag the scroll box to any spot on the scroll bar to quickly move to a spot in the window relative to the position of the scroll box.


History List

The history list attached to an input box lists whatever text you typed into the input box the last few times you used the dialog box.

You can get to the history list whenever you see a Down arrow icon to the right of an input box.

You use the history list to re-enter text that you've already entered.

You can also edit an entry in the history list directly.

Press Esc to exit from the history list without making a selection.


Editor description
The Turbo Pascal Editor

There are many ways to get into an open Edit window (make it active):

-	Click it.

-	Press Alt+hyphen to display the active Edit window's Control menu. Then choose the Next command to go to the open Edit window.

-	Press Crtl+F6 to cycle though the open windows.

-	Choose the window from the list of open windows on the Window menu.

Once in the Edit window, you enter text just as if you were using a typewriter. When you want to end a line, press Enter.

The maximum line width in an Edit window is 249 characters; you'll get a beep if you try to type past that. However, the compiler recognizes a maximum of 126 characters per line.

See Also

Editor Commands


There is no Language Help available for this item.

Be sure you have the cursor correctly positioned on the item you want Help on.


There is currently no help available for this item.


Editor Commands

Turbo Pascal's editor commands are summarized in the following tables:

Block commands

Block Commands (CUA and Alternate)

Block Commands (Borland Style )

Extending selected blocks

More about block commands

Other commands

Cursor movement commands

Insert and delete commands

More about editor commands

Miscellaneous keyboard commands


Block commands (CUA and Alternate)

Movement	CUA	Both	Alternate

Delete block	Ctrl+Del	Ctrl+Del	    -----

Copy to Clipboard	Ctrl+Ins	Ctrl+Ins	    -----

Cut to Clipboard	Shift+Del	Shift+Del	    -----

Paste from Clipboard	Shift+Ins	Shift+Ins	    -----

Read block from disk	Shift+Ctrl+R	    -----	Ctrl+K R

Write block to disk	Shift+Ctrl+W	    -----	Ctrl+K W

Indent block	Shift+Ctrl+I	    -----	Ctrl+K I

Unindent block	Shift+Ctrl+U	    -----	Ctrl+K U

See Also

Block commands (Borland-style)

Extending selected blocks

More about block commands


Extending selected blocks

Movement	CUA	Both	Alternate

Left one character	Shift+Left	Shift+Left 	       -----

Right one character	Shift+Right 	Shift+Right 	       -----

End of line	Shift+End	Shift+End	       -----

Beginning of line	Shift+Home	Shift+Home	       -----

Same column on next line	Shift+Down 	Shift+Down 	       -----

Same column on previous line	Shift+Up	Shift+Up 	       -----

One page down	Shift+PgDn	Shift+PgDn	       -----

One page up	Shift+PgUp	Shift+PgUp	       -----

Left one word	Shift+Ctrl+Left	Shift+Ctrl+Left 	       -----

Right one word	Shift+Ctrl+Right	Shift+Ctrl+Right 	       -----

End of file	Shift+Ctrl+End	Shift+Ctrl+End	Shift+Ctrl+PgDn

Beginning of file	Shift+Ctrl+Home	Shift+Ctrl+Home	Shift+Ctrl+PgUp

See Also

Block Commands (CUA and Alternate)

Block Commands (Borland Style )

More about block commands


Borland-style block commands
Block commands (Borland-style)

Note: Turbo Pascal's Borland-style block commands only work with the Alternate command set.

Command	Keys	Function

Text selection  ON	Ctrl+K B	Begins the selection of text. Text selection ends with copying (Ctrl+K K) or cutting (Ctrl+K V) to the Clipboard, or turning text selection off with Ctrl+K H.

Text selection  OFF	Ctrl+K H	Stops the selection of text and the selected text becomes unselected.

Copy text to Clipboard	Ctrl+K K	Copies the selected text to the Clipboard.

Cut text to Clipboard	Ctrl+K V	Cuts the selected text to the Clipboard.

Paste from Clipboard	Ctrl+K C	Pastes the contents of the Clipboard into your active Edit window.

See Also

Block Commands (CUA and Alternate)

Extending selected blocks

More about block commands


More about block commands

Copy block...........	(Ctrl+Ins then Shift+Ins) Copies a previously selected block to the Clipboard and pastes it to the current cursor position.

The original block is unchanged. If no block is selected, nothing happens.

Copy text..............	(Ctrl+Ins) Copies selected text to the Clipboard.

Cut text..................	(Shift+Del) Cuts selected text to the Clipboard.

Delete block........	(Ctrl+Del or Ctrl+K Y) Deletes a selected block. You can "undelete" a block with Undo.

Move block..........	(Shift+Del then Shift+Ins) Moves a previously selected block from its original position to the Clipboard and then pastes it to the cursor position.

The block disappears from its original position. If no block is marked, nothing happens.

Paste from

  Clipboard...........	(Shift+Ins) Pastes the contents of the Clipboard.

Read block

  from disk............	(Shift+Ctrl+R or Ctrl+K R) Reads a disk file into the current text at the cursor position exactly as if it were a block.

The text read is then selected as a block. When this command is issued, you are prompted for the name of the file to read.

You can use wildcards to select a file to read; a directory is displayed. The file specified can be any legal file name.

Write block

  to disk.................	(Shift+Ctrl+W or Ctrl+KW) Writes a selected block to a file. When you give this command, Turbo Pascal prompts for the name of the file to write to.

The file can be given any legal name (the default extension is .PAS).

If you prefer to use a file name without an extension, append a period to the end of its name.

Note: If the file specified already exists, a warning is issued before the existing file is overwritten. If no block is selected, nothing happens.

See Also

Block Commands (CUA and Alternate)

Block Commands (Borland Style )

Extending selected blocks


Cursor Movement Commands
Cursor movement commands (CUA and Alternate)

Movement	CUA	Both	Alternate

Character left	Left	Left	Ctrl+S

Character right	Ctrl+Right	Right	Ctrl+D

Word left	Ctrl+Left	Ctrl+Left	Ctrl+A

Scroll down one line	Ctrl+Z	Ctrl+Z	Ctrl+Z

Line up	Up	Up	Ctrl+E

Line down	Down	Down	Ctrl+X

Scroll up one line	Ctrl+W	Ctrl+W	Ctrl+W

Scroll down one line	Ctrl+Z	Ctrl+Z	Ctrl+Z

Page up	PgUp	PgUp	Ctrl+R

Page down	PgDn	PgDn	Ctrl+C

Last cursor position	 -----	 -----	Ctrl+Q P

Beginning of line	Home	Home	Ctrl+Q S

End of line	End	End	Ctrl+Q D

Top of window	Ctrl+E	 -----	Ctrl+Q E

Bottom of window	Ctrl+X	 -----	Ctrl+Q X

Top of file	Ctrl+Home	Ctrl+Home	Ctrl+Q R, Ctrl+PgUp

Bottom of file	Ctrl+End	Ctrl+End	Ctrl+Q C, Ctrl+PgDn


Insert and delete commands
Insert and delete commands (CUA and Alternate)

Movement	CUA	Both	Alternate

Delete character	Del	Del	Ctrl+G

Delete character to left	Backspace	Backspace	 --------

Delete line	Ctrl+Y	Ctrl+Y	 --------

Delete to end of line	Shift+Ctrl+Y	 --------	Ctrl+Q Y

Delete word	 --------	 --------	Ctrl+T

Insert line	Ctrl+N	 --------	Ctrl+N

Insert mode on/off	Ins	Ins	Ctrl+V


Miscellaneous keyboard commands

Movement	CUA	Both	Alternate

Autoindent mode on/off	 --------	 --------	Ctrl+O I

Current compiler options	 --------	 --------	Ctrl+O O

Cursor through tabs on/off	 --------	 --------	Ctrl+O R

Find place marker N	Ctrl+N*	 --------	Ctrl+Q+N*

Help	F1	F1	 --------

Help index	Shift+F1	Shift+F1	 --------

Maximize window	 --------	 --------	F5

Open file	 --------	 --------	F3

Optimal fill mode on/off	 --------	 --------	Ctrl+O F

Pair matching	Alt+[  , Alt+]	Ctrl+Q [  , Ctrl+Q ]

Save file	 --------	 --------	F2, Ctrl+K S

Search	 --------	 --------	Ctrl+Q F

Search again	F3	F3	 --------

Search and replace	 --------	 --------	Ctrl+Q A

Show last compile error	 --------	 --------	Ctrl+Q W

Set marker	Shift+Ctrl+N*	 --------	Ctrl+K+N*

Tabs mode on/off	 --------	 --------	Ctrl+O T

Topic Help	Ctrl+F1	Ctrl+F1	 --------

Exit	Alt+F4	 --------	Alt+X

Undo	Alt+Backspace	Alt+Backspace	 --------

Unindent mode on/off	 --------	 --------	Ctrl+O U

Insert control character	Ctrl+P **	Ctrl+P **	 --------

 * N represents a number from 0 to 9.

** To enter a control character, first press Ctrl+P, then press the desired control character.


More about editor commands

Auto indent...........	Toggles the automatic indenting of successive lines.

You can also use Options|Preferences|AutoIndent in the IDE to turn automatic indenting on and off.

Current compiler

  options................	Inserts the current compiler option settings at the head of your active Edit window.

Cursor thru tabs...	The arrow keys will move the cursor to the middle of tabs when this option is on; otherwise the cursor jumps several columns when cursoring over multiple tabs. Ctrl+O R is a toggle.

Find place

  marker................	Finds up to ten place markers (N can be any number in the range 0 to 9) in text.

Move the cursor to any previously set marker by pressing Ctrl+Q and the marker number.

Open file...............	Loads an existing file into an Edit window.

Optimal fill............	Optimal fill begins every line with the minimum number of characters possible, using tabs and spaces as necessary.

This produces lines with fewer characters.

Save file...............	Saves the file and returns to the editor.

Set place..............	Mark up to ten places in text by pressing Ctrl+K, followed by a single marker digit (0 to 9).

After marking your location, you can work elsewhere in the file and then easily return to your marked location by using the Find Place Marker command (being sure to use the same marker number).

You can have ten places marked in each window.

Show last

  compile error.....	Highlights the last syntax error the compiler found during the last compile. The error message appears on the status bar.

If you have already closed that file, Turbo Pascal will reopen it and highlight the error.

Tab mode............	You can specify the use of true tab characters in the IDE with the Options|Preferences|Use Tab Character option.

Unindent...............	You can turn Unindent on and off from the IDE with the Options|Preferences|Backspace Unindents option.


Abs.PAS
{Abs.PAS}

{Sample code for the Abs function.}

var

  r: Real;

  i: Integer;

begin

  r := Abs(-2.3);       { 2.3 }

  i := Abs(-157);       { 157 }

end.


Addr.PAS
{Addr.PAS}

{Sample code for the Addr function.}

var

  P: Pointer;

begin

  P := Addr(P);         { Now points to itself }

end.


Append.PAS
{Append.PAS}

{Sample code for the Append procedure.}

uses WinCrt;

var F: Text;

begin

  Assign(F, 'TEST.TXT');

  Rewrite(F);	{ Create new file }

  Writeln(F, 'original text');

  Close(F);	{ Close file, save changes }

  Append(F);	{ Add more text onto end }

  Writeln(F, 'appended text');

  Close(F);	{ Close file, save changes }

end.


ArcTan.PAS
{Arctan.PAS}

{Sample code for the ArcTan function.}

var

  R: Real;

begin

  R := ArcTan(Pi);

end.


Assign.PAS
{Assign.PAS}

{Sample code for the Assign procedure. Try redirecting this program from DOS to PRN to disk file, etc.}

var F: Text;

begin

  Assign(F, '');	{ Standard output }

  Rewrite(F);

  Writeln(F, 'standard output...');

  Close(F);

end.


Blockrd.PAS
{Blockrd.PAS}

{Sample code for the BlockRead and BlockWrite procedures.}

uses WinCrt;

program CopyFile;

{ Simple, fast file copy program with NO error-checking }

var

  FromF, ToF: file;

  NumRead, NumWritten: Word;

  Buf: array[1..2048] of Char;

begin

  Assign(FromF, ParamStr(1));	{ Open input file }

  Reset(FromF, 1);	{ Record size = 1 }

  Assign(ToF, ParamStr(2));	{ Open output file }

  Rewrite(ToF, 1);	{ Record size = 1 }

  Writeln('Copying ', FileSize(FromF), ' bytes...');

  repeat

    BlockRead(FromF, Buf, SizeOf(Buf), NumRead);

    BlockWrite(ToF, Buf, NumRead, NumWritten);

  until (NumRead = 0) or (NumWritten <> NumRead);

  Close(FromF);

  Close(ToF);

end.


Chdir.PAS
{Chdir.PAS}

{Sample code for the ChDir procedure.}

begin

  {$I-}

  { Get directory name from command line }

  ChDir(ParamStr(1));

  if IOResult <> 0 then

    Writeln('Cannot find directory');

end.


Close.PAS
{Close.PAS}

{Sample code for the Close procedure.}

var F: file;

begin

  Assign(F, '\AUTOEXEC.BAT');	{ open file }

  Reset(F, 1);

  Writeln('File size = ', FileSize(F));

  Close(F);	{ Close file }

end.


Concat.PAS
{Concat.PAS}

{Sample code for the Concat function.}

var

  S: String;

begin

  S := Concat('ABC', 'DEF');	{ 'ABCDE' }

end.


Copy.PAS
{Copy.PAS}

{Sample code for the Copy function.}

var S: String;

begin

  S := 'ABCDEF';

  S := Copy(S, 2, 3)	{ 'BCD' }

end.


Cos.PAS
{Cos.PAS}

{Sample code for the Cos function.}

var R: Real;

begin

  R := Cos(Pi);

end.


Dec.PAS
{Dec.PAS}

{Sample code for the Dec procedure.}

var

  IntVar: Integer;

  LongintVar: Longint;

begin

  Dec(IntVar);	{ IntVar := IntVar - 1 }

  Dec(LongintVar, 5);	{ LongintVar := LongintVar - 5 }

end.


Diskfree.PAS
{Diskfree.PAS}

{Sample code for the DiskFree function.}

uses WinDos,WinCrt;

begin

  Writeln(DiskFree(0) div 1024, ' Kbytes free ');

end.


Disksize.PAS
{Disksize.PAS}

{Sample code for the DiskSize function.}

uses WinDos,WinCrt;

begin

  Writeln(DiskSize(0) div 1024, ' Kbytes capacity');

end.


Dispose.PAS
{Dispose.PAS}

{Sample code for the New and Dispose procedures.}

type

  Str18 = string[18];

var

  P: ^Str18;

begin

  New(P);

  P^ := 'Now you see it...';

  Dispose(P);	{ Now you don't... }

end.


DOSVrsn.PAS
{DOSVrsn.PAS}

{Sample code for the DOSVersion function.}

uses WinDos;

var

  Ver: Word;

begin

  Ver := DosVersion;

  Writeln('This is DOS version ', Lo(Ver), '.', Hi(Ver));

end.


Eof.PAS
{Eof.PAS}

{Sampe code for the Eof, Read, and Write functions (text files).}

uses WinCrt,WinDos;

var

  F: Text;

  Ch: Char;

begin

  { Get file to read from command line }

  Assign(F, ParamStr(1));

  Reset(F);

  while not Eof(F) do

  begin

    Read(F, Ch);

    Write(Ch);	{ Dump text file }

  end;

end.


Erase.PAS
{Erase.PAS}

{Sample code for Erase procedure. }

uses WinDos;WinCrt;

var

  F:  file;

  Ch: Char;

begin

  { Get file to delete from command line }

  Assign(F, ParamStr(1));

  {$I-}

  Reset(F);

  {$I+}

  if IOResult <> 0 then

    Writeln('Cannot find ', ParamStr(1))

  else

  begin

    Close(F);

    Write('Erase ', ParamStr(1), '? ');

    Readln(Ch);

    if UpCase(ch) = 'Y' then

      Erase(F);

  end;

end.


Filesize.PAS
{Filesize.PAS}

{Sample code for the FileSize function. }

var

  F: file of Byte;

begin

  { Get file name from command line }

  Assign(F, ParamStr(1));

  Reset(F);

  Writeln('File size in bytes: ', FileSize(F));

  Close(F);

end.


Fillchar.PAS
{Fillchar.PAS}

{Sample code for the FillChar procedure.}

var

  S: string[80];

begin

  { Set a string to all spaces }

  FillChar(S, SizeOf(S), ' ');

  S[0] := #80;	{ Set length byte }

end.


Findfrst.PAS
{Findfrst.PAS}

{Sample code for the FindFirst and FindNext procedures.}

uses WinDos,WinCrt;

var

  DirInfo: TSearchRec;

begin

  FindFirst('*.PAS', Archive, DirInfo);	{ Same as DIR *.PAS }

  while DosError = 0 do

  begin

    Writeln(DirInfo.Name);

    FindNext(DirInfo);

  end;

end.


Frac.PAS
{Frac.PAS}

{Sample code for the Frac function.}

var

  R: Real;

begin

  R := Frac(123.456);    { 0.456 }

  R := Frac(-123.456);   { -0.456 }

end.


Getfattr.PAS
{Getfattr.PAS}

{Sample code for the GetFAttr procedure.}

uses WinDos,WinCrt;

var

  F: file;

  Attr: Word;

begin

  { Get file name from command line }

  Assign(F, ParamStr(1));

  GetFAttr(F, Attr);

  Writeln(ParamStr(1));

  if DosError <> 0 then

    Writeln('DOS error code = ', DosError)

  else

  begin

    Write('Attribute = ', Attr);

    { Determine file attribute type using flags in WinDos unit }

    if Attr and faReadOnly <> 0 then

      Writeln('Read only file');

    if Attr and faHidden <> 0 then

      Writeln('Hidden file');

    if Attr and faSysFile <> 0 then

      Writeln('System file');

    if Attr and faVolumeID <> 0 then

      Writeln('Volume ID');

    if Attr and faDirectory <> 0 then

      Writeln('Directory name');

    if Attr and faArchive <> 0 then

      Writeln('Archive (normal file)');

  end; { else }

end.


Hi.PAS
{Hi.PAS}

{Sample code for the Hi function.}

var W: Word;

begin

  W := Hi($1234);   { $12 }

end.


Inc.PAS
{Inc.PAS}

{Sample code for the Inc procedure.}

var

  IntVar: Integer;

  LongintVar: Longint;

begin

  Inc(IntVar);	{ IntVar := IntVar + 1 }

  Inc(LongintVar, 5);	{ LongintVar := LongintVar + 5 }

end.


Insert.PAS
{Insert.PAS}

{Sample code for the Insert procedure.}

var

  S: String;

begin

  S := 'Honest Lincoln';

  Insert('Abe ', S, 8);	{ 'Honest Abe Lincoln' }

end.


Int.PAS
{Int.PAS}

{Sample code for the Int function.}

var R: Real;

begin

  R := Int(123.456);    { 123.0 }

  R := Int(-123.456);   { -123.0 }

end.


IOResult.PAS
{IOResult.PAS}

{Sample code for the IOResult function.}

uses WinCrt;

var F: file of Byte;

begin

  { Get file name command line }

  Assign(F, ParamStr(1));

  {$I-}

  Reset(F);

  {$I+}

  if IOResult = 0 then

    Writeln('File size in bytes: ', FileSize(F))

  else

    Writeln('File not found');

end.


Length.PAS
{Length.PAS}

{Sample code for the Length function.}

uses WinCrt;

var

  F: Text;

  S: String;

begin

  Assign(F, 'GARY.PAS');

  Reset(F);

  Readln(F, S);

  Writeln('"', S, '"');

  Writeln('length = ', Length(S));

end.


Lo.PAS
{Lo.PAS}

{Sample code for the Lo function.}

var W: Word;

begin

  W := Lo($1234);   { $34 }

end.


Maxavail.PAS
{Maxavail.PAS}

{Sample code for the MaxAvail function.}

type

  FriendRec = record

    Name: string[30];

    Age: Byte;

  end;

var

  P: Pointer;

begin

  if MaxAvail < SizeOf(FriendRec) then

    Writeln('Not enough memory')

  else

  begin

    { Allocate memory on heap }

    GetMem(P, SizeOf(FriendRec));

    { ... }

  end;

end.


Memavail.PAS
{Memavail.PAS}

{Sample code for the MemAvail function.}

begin

  Writeln(MemAvail, ' bytes available');

  Writeln('Largest free block is ', MaxAvail, ' bytes');

end.


Mkdir.PAS
{Mkdir.PAS}

{Sample code for the MkDir procedure.}

begin

  {$I-}

  { Get directory name from command line }

  MkDir(ParamStr(1));

  if IOResult <> 0 then

    Writeln('Cannot create directory')

  else

    Writeln('New directory created');

end.


Move.PAS
{Move.PAS}

{Sample code for the Move procedure.}

var

  A: array[1..4] of Char;

  B: Longint;

begin

  Move(A, B, SizeOf(A));	{ SizeOf = safety! }

end.


Parcount.PAS
{Parcount.PAS}

{Sample code for the ParamCount function.}

begin

  if ParamCount < 1 then

    Writeln('No parameters on command line')

  else

    Writeln(ParamCount, ' parameter(s)');

end.


Parstrng.PAS
{Parstrng.PAS}

{Sample code for the Paramstr function.}

var I: Word;

begin

  for I := 1 to ParamCount do

    Writeln(ParamStr(I));

end.


Pos.PAS
{Pos.PAS}

{Sample code for the Pos function.}

var S: String;

begin

  S := '   123.5';

  { Convert spaces to zeroes }

  while Pos(' ', S) > 0 do

    S[Pos(' ', S)] := '0';

end.


Ptr.PAS
{Ptr.PAS}

{Sample code for the Ptr function.}

var P: ^Byte;

begin

  P := Ptr($40, $49);

  Writeln('Current video mode is ', P^);

end.


Reset.PAS
{Reset.PAS}

{Sample code for the Reset procedure.}

function FileExists(FileName: String): Boolean;

{ Boolean function that returns True if the file exists;otherwise,

   it returns False. Closes the file if it exists. }

var

  F: file;

begin

  {$I-}

  Assign(F, FileName);

  Reset(F);

  Close(F);

  {$I+}

  FileExists := (IOResult = 0) and (FileName <> '');

end;  { FileExists }

begin

  if FileExists(ParamStr(1)) then {Get file name from command line}

    Writeln('File exists')

  else

    Writeln('File not found');

end.


Rewrite.PAS
{Rewrite.PAS}

{Sample code for the Rewrite procedure.}

var F: Text;

begin

  Assign(F, 'NEWFILE.$$$');

  Rewrite(F);

  Writeln(F, 'Just created file with this text in it...');

  Close(F);

end.


Runerror.PAS
{Runerror.PAS}

{Sample code for the RunError procedure.}

begin

{$IFDEF Debug}

  if P = nil then

    RunError(204);

{$ENDIF}

end.


Setfattr.PAS
{Setfattr.PAS}

{Sample code for the SetFAttr procedure.}

uses WinDos;

var

  F: file;

begin

  Assign(F, 'C:\AUTOEXEC.BAT');

  SetFAttr(F, faHidden);	{ Uh-oh }

  Readln;

  SetFAttr(F, faArchive);	{ Whew! }

end.


Settxtbf.PAS
{Settxtbf.PAS}

{Sample code for the SetTextBuf procedure.}

var

  F: Text;

  Ch: Char;

  Buf: array[1..10240] of Char;	{ 10K buffer }

begin

  { Get file to read from command line }

  Assign(F, ParamStr(1));

  { Bigger buffer for faster reads }

  SetTextBuf(F, Buf);

  Reset(F);

  { Dump text file onto screen }

  while not Eof(f) do

  begin

    Read(F, Ch);

    Write(Ch);

  end;

end.


Sin.PAS
{Sin.PAS}

{Sample code for the Sin function.}

var

  R: Real;

begin

  R := Sin(Pi);

end.


Sizeof.PAS
{Sizeof.PAS}

{Sample code for the SizeOf function.}

type

  CustRec = record

    Name: string[30];

    Phone: string[14];

  end;

var

  P: ^CustRec;

begin

  GetMem(P, SizeOf(CustRec));

end.


Str.PAS
{Str.PAS}

{Sample code for the Str procedure.}

function IntToStr(I: Longint): String;

{ Convert any integer type to a string }

var

  S: string[11];

begin

  Str(I, S);

  IntToStr := S;

end;

begin

  Writeln(IntToStr(-5322));

end.


Swap.PAS
{Swap.PAS}

{Sample code for the Swap function.}

var

  X: Word;

begin

  X := Swap($1234);   { $3412 }

end.


Val.PAS
{Val.PAS}

{Sample code for the Val procedure.}

var I, Code: Integer;

begin

{ Get text from command line }

  Val(ParamStr(1), I, Code);

  { Error during cnversion to integer? }

  if code <> 0 then

    Writeln('Error at positon: ', Code)

  else

    Writeln('Value = ', I);

end.


Chr.PAS
{Chr.PAS}

{Sample code for the Chr function.}

uses WinCrt;

var

  I: Integer;

begin

  for I := 32 to 126 do Write(Chr(I));

end.


CSeg.PAS
{CSeg.PAS}

{Sample code for the CSeg, DSeg, SSeg, SPtr, Ofs, and Seg functions.}

uses WinCrt;

procedure WriteHexWord(w: Word);

const

  hexChars: array [0..$F] of Char =

    '0123456789ABCDEF';

begin

  Write(hexChars[Hi(w) shr 4],

        hexChars[Hi(w) and $F],

        hexChars[Lo(w) shr 4],

        hexChars[Lo(w) and $F]);

end;

var

  i: Integer;

begin

  Write('The current code segment is $');

  WriteHexWord(CSeg); Writeln;

  Write('The global data segment is $');

  WriteHexWord(DSeg); Writeln;

  Write('The stack segment is $');

  WriteHexWord(SSeg); Writeln;

  Write('The stack pointer is at $');

  WriteHexWord(SPtr); Writeln;

  Write('i is at offset $');

  WriteHexWord(Ofs(i));

  Write(' in segment $');

  WriteHexWord(Seg(i));

end.


Delete.PAS
{Delete.PAS}

{Sample code for the Delete procedure.}

 uses WinCrt;

 var

   s: string;

 begin

   s := 'Honest Abe Lincoln';

   Delete(s,8,4);

   Writeln(s); { 'Honest Lincoln' }

 end.


Eoln.PAS
{Eoln.PAS}

{Sample code for the Eoln function.}

 uses WinCrt;

 begin

 { Tells program to wait for keyboard input }

   Writeln(Eoln);

 end.


Exit.PAS
{Exit.PAS}

{Sample code for the Exit procedure.}

 uses WinCrt;

 procedure WasteTime;

 begin

   repeat

     if KeyPressed then Exit;

     Write('Xx');

   until False;

 end;

 begin

   WasteTime;

 end.


Exp.PAS
{Exp.PAS}

{Sample code for the Exp function.}

 uses WinCrt;

 begin

   Writeln('e = ',Exp(1.0));

 end.


FilePos.PAS
{FilePos.PAS}

{Sample code for the FilePos and FileSize functions, and the Seek procedure.}

 uses WinCrt;

 var

   f: file of Byte;

   size : Longint;

 begin

   { Get file name from command line }

   Assign(f, ParamStr(1));

   Reset(f);

   size := FileSize(f);

   Writeln('File size in bytes: ',size);

   Writeln('Seeking halfway into file...');

   Seek(f,size div 2);

   Writeln('Position is now ',FilePos(f));

   Close(f);

 end.


Flush.PAS
{Flush.PAS}

{Sample code for the Flush procedure.}

 uses WinDos, WinCrt;

 procedure ReportError(s : String);

   { Redirect output to the DOS standard

    error handle and emit an error message,

    then halt.

    The file "output" must be flushed before

    its handle is changed, or some earlier

    output may appear with the error

    message.}

   begin

   Flush(output); { Must flush current output}

   { Redirect output to standard error handle}

   TTextRec(output).handle := 2;

   Writeln(s);

   Halt(1);

   end;

 begin

 ReportError('An error occurred');

 end.


FreeMem.PAS
{FreeMem.PAS}

{Sample code for the FreeMem and GetMem procedures and the MaxAvail function.}

 uses WinCrt;

 type

   TFriendRec = record

                 Name: string[30];

                 Age : Byte;

               end;

 var

   p: pointer;

 begin

   if MaxAvail < SizeOf(TFriendRec) then

     Writeln('Not enough memory')

   else

   begin

     { Allocate memory on heap }

     GetMem(p, SizeOf(TFriendRec));

     { ...}

     { ...Use the memory... }

     { ...}

     { Then free it when done }

     FreeMem(p, SizeOf(TFriendRec));

   end;

 end.


GetDir.PAS
{GetDir.PAS}

{Sample code for the GetDir procedure.}

 uses WinCrt;

 var

   s : String;

 begin

   GetDir(0,s); { 0 = Current drive }

   Writeln('Current drive and directory: ',

           s);

 end.


Halt.PAS
{Halt.PAS}

{Sample code for the Halt procedure.}

 uses WinCrt;

 begin

   if 1 = 1 then

     begin

       if 2 = 2 then

         begin

           if 3 = 3 then

             begin

               Halt(1); { Halt right here! }

             end;

         end;

     end;

   Writeln('This will not be executed');

 end.


Ln.PAS
{Ln.PAS}

{Sample code for the Ln function.}

 uses WinCrt;

 var

   e : real;

 begin

   e := Exp(1.0);

   Writeln('ln(e) = ',ln(e));

 end.


Odd.PAS
{Odd.PAS}

{Sample code for the Odd function.}

 uses WinCrt;

 begin

   if Odd(5) then

     Writeln('5 is odd')

   else

     Writeln('Something is odd');

 end.


Ord.PAS
{Ord.PAS}

{Sample code for the Ord function.}

 uses WinCrt;

 type

   Colors = (RED,BLUE,GREEN);

 begin

   Writeln('BLUE has an ordinal value of ',

           Ord(BLUE));

   Writeln('The ASCII code for "c" is ',

           Ord('c'), ' decimal');

 end.


Pi.PAS
{Pi.PAS}

{Sample code for the Pi function.}

 uses WinCrt;

 begin

   Writeln('Pi = ',Pi);

 end.


Pred.PAS
{Pred.PAS}

{Sample code for the Pred and Succ functions.}

 uses WinCrt;

 type

   Colors = (RED,BLUE,GREEN);

 begin

   Writeln('The predecessor of 5 is ',

           Pred(5));

   Writeln('The successor of 10 is ',

           Succ(10));

   if Succ(RED) = BLUE then

     Writeln('In the type Colors, RED is ',

             'the predecessor of BLUE.');

 end.


Random.PAS
{Random.PAS}

{Sample code for the Random function and Randomize procedure.}

 uses Crt;

 begin

   Randomize;

   repeat

     { Write text in random colors }

     TextAttr := Random(256);

     Write('!');

   until KeyPressed;

 end.


Readln.PAS
{Readln.PAS}

{Sample code for the Readln and Writeln procedures.}

 uses WinCrt;

 var

   s : String;

 begin

   Write('Enter a line of text: ');

   Readln(s);

   Writeln('You typed: ',s);

   Writeln('Hit <Enter> to exit');

   Readln;

 end.


Rename.PAS
{Rename.PAS}

{Sample code for the Rename procedure.}

 uses WinCrt;

 var

   f : file;

 begin

   { Rename a file. Old and new names

     given on command line. }

   if ParamCount <> 2 then

   begin

     Writeln('Wrong number of parameters');

     Halt(1);

   end;

   Assign(f,ParamStr(1));

   Writeln('Renaming ',ParamStr(1),

           ' to ',ParamStr(2));

   Rename(f,ParamStr(2));

 end.


RmDir.PAS
{RmDir.PAS}

{Sample code for the RmDir procedure.}

 uses WinCrt;

 begin

   {$I-}

   { Get directory name from command line }

   RmDir(ParamStr(1));

   if IOResult <> 0 then

     Writeln('Cannot remove directory')

   else

     Writeln('directory removed');

 end.


Round.PAS
{Round.PAS}

{Sample code for the Round function.}

 uses WinCrt;

 begin

   Writeln(1.4, ' rounds to ', Round(1.4));

   Writeln(1.5, ' rounds to ', Round(1.5));

   Writeln(-1.4, ' rounds to ', Round(-1.4));

   Writeln(-1.5, ' rounds to ', Round(-1.5));

 end.


SeekEof.PAS
{SeekEof.PAS}

{Sample code for the SeekEof and SeekEoln functions.}

 uses WinCrt;

 var

   f : Text;

   i, j : Integer;

 begin

   Assign(f,'TEST.TXT');

   Rewrite(f);

   { Create a file with 8 numbers and some

     whitespace at the ends of the lines }

   Writeln(f,'1 2 3 4 ');

   Writeln(f,'5 6 7 8 ');

   Reset(f);

   { Read the numbers back. SeekEoln returns

     TRUE if there are no more numbers on

     the current line; SeekEof returns TRUE

     if there is no more text (other than

     whitespace) in the file. }

   while not SeekEof(f) do

   begin

     if SeekEoln(f) then

       Readln; { Go to next line }

     Read(f,j);

     Writeln(j);

   end;

 end.


Sqr.PAS
{Sqr.PAS}

{Sample code for the Sqr and Sqrt functions.}

 uses WinCrt;

 begin

   Writeln('5 squared is ', Sqr(5));

   Writeln('The square root of 2 is ',

           Sqrt(2.0));

 end.


Trunc.PAS
{Trunc.PAS}

{Sample code for the Trunc function.}

 uses WinCrt;

 begin

   Writeln(1.4, '  becomes ', Trunc(1.4));

   Writeln(1.5, ' becomes ', Trunc(1.5));

   Writeln(-1.4, ' becomes ', Trunc(-1.4));

   Writeln(-1.5, ' becomes ', Trunc(-1.5));

 end.


Truncate.PAS
{Truncate.PAS}

{Sample code for the Truncate procedure.}

 uses WinCrt;

 var

   f: file of Integer;

   i,j: Integer;

 begin

   Assign(f,'TEST.INT');

   Rewrite(f);

   for i := 1 to 6 do

     Write(f,i);

   Writeln('File before truncation:');

   Reset(f);

   while not Eof(f) do

   begin

     Read(f,i);

     Writeln(i);

   end;

   Reset(f);

   for i := 1 to 3 do

     Read(f,j); { Read ahead 3 records }

   Truncate(f); { Cut file off here }

   Writeln;

   Writeln('File after truncation:');

   Reset(f);

   while not Eof(f) do

   begin

     Read(f,i);

     Writeln(i);

   end;

   Close(f);

   Erase(f);

 end.


UpCase.PAS
{UpCase.PAS}

{Sample code for the UpCase function.}

 uses WinCrt;

 var

   s : string;

   i : Integer;

 begin

   Write('Enter a string: ');

   Readln(s);

   for i := 1 to Length(s) do

     s[i] := UpCase(s[i]);

   Writeln('Here it is in all uppercase: ',s);

 end.


CreateDr.PAS
{CreateDr.PAS}

{Sample code for the CreateDir procedure.}

uses WinCrt, WinDOS;

const

  Create: PChar = 'C:\NEWDIR';

  CDrive: Byte = 3;

begin

  CreateDir(Create);

  Writeln('There is now a new directory at ', Create,'.');

end.


FileExp.PAS
{FileExp.PAS}

{Sample code for the FileExpand function.}

uses WinCrt, WinDOS;

const

  MyFile: PChar = 'TEST.FIL';

var

  Where: PChar;

begin

  GetMem(Where, 80);

  FileExpand(Where, MyFile);

  Writeln(MyFile, ' is in the current directory at ', Where, '.');

end.


GetArgCo.PAS
{GetArgCo.PAS}

{Sample code for the GetArgCount function.}

uses WinCrt, WinDOS;

var

  TheArgCount:  Integer;

begin

  TheArgCount := GetArgCount;

  Writeln('There were ', TheArgCount,' arguments to the prompt (in addition to the');

  Writeln('program name) when running this program.');

end.


GetArgSt.PAS
{GetArgSt.PAS}

{Sample code for the GetArgStr function.}

uses WinCrt, WinDOS;

var

  ArgN: PChar;

begin

  GetMem(ArgN, 20);

  GetArgStr(ArgN, 1, 19);

  Writeln('The 1st argument to the prompt (in addition to the');

  Writeln('program name) was ''', ArgN, '''.');

end.


GetCBrk.PAS
{GetCBrk.PAS}

{Sample code for the GetCBreak and SetCBreak procedures.}

 uses WinDos, WinCrt;

 const

   OffOn : array [Boolean] of String[3] =

     ('off','on');

 var

   cb : Boolean;

 begin

   GetCBreak(cb);

   Writeln('Control-Break checking is ',

           OffOn[cb]);

   cb := not(cb);

   Writeln('Turning Control-Break checking ',

           OffOn[cb]);

   SetCBreak(cb);

 end.


GetCurDr.PAS
{GetCurDr.PAS}

{Sample code for the GetCurDir function.}

uses WinCrt, WinDOS;

const

  CDrive:Byte = 3;

var

  CurDir: PChar;

begin

  GetMem(CurDir, 80);

  GetCurDir(CurDir, CDrive);

  Writeln('The current directory on drive c is ', CurDir,'.');

end.


GetDate.PAS
{GetDate.PAS}

{Sample code for the GetDate procedure.}

 uses WinDos, WinCrt;

 const

   days : array [0..6] of String[9] =

     ('Sunday','Monday','Tuesday',

      'Wednesday','Thursday','Friday',

      'Saturday');

 var

   y, m, d, dow : Word;

 begin

   GetDate(y,m,d,dow);

   Writeln('Today is ', days[dow],', ',

           m:0, '/', d:0, '/', y:0);

 end.


GetEnvVa.PAS
{GetEnvVa.PAS}

{Sample code for the GetEnvVar function.}

uses WinCrt, WinDOS;

var

  EnvironmentVar: PChar;

begin

  GetMem(EnvironmentVar, 255);

  EnvironmentVar := GetEnvVar('PATH');

  Writeln('The PATH is currently: ');

  Writeln(EnvironmentVar);

end.


GetFTime.PAS
{GetFTime.PAS}

{Sample code for the GetFTime, PackTime, SetFTime, and UnpackTime procedures.}

 uses WinDos, WinCrt;

 var

   f: text;

   h, m, s, hund : Word; { For GetTime}

   ftime : Longint; { For Get/SetFTime}

   dt : TDateTime; { For Pack/UnpackTime}

 function LeadingZero(w : Word) : String;

 var

   s : String;

 begin

   Str(w:0,s);

   if Length(s) = 1 then

     s := '0' + s;

   LeadingZero := s;

 end;

 begin

   Assign(f, 'TEST.TXT');

   GetTime(h,m,s,hund);

   Rewrite(f); { Create new file }

   GetFTime(f,ftime); { Get creation time }

   Writeln('File created at ',LeadingZero(h),

           ':',LeadingZero(m),':',

           LeadingZero(s));

   UnpackTime(ftime,dt);

   with dt do

     begin

       Writeln('File timestamp is ',

               LeadingZero(hour),':',

               LeadingZero(min),':',

               LeadingZero(sec));

       hour := 0;

       min := 1;

       sec := 0;

       PackTime(dt,ftime);

       Writeln('Setting file timestamp ',

               'to one minute after midnight');

       Reset(f); { Reopen file for reading }

       { (Otherwise, close will update time) }

       SetFTime(f,ftime);

     end;

   Close(f);   { Close file }

 end.


GetIntVc.PAS
{GetIntVc.PAS}

{Sample code for the GetIntVec and SetIntVec procedures.}

 uses WinDos, WinCrt;

 var

   Int1CSave : Pointer;

 {$F+}

 procedure TimerHandler; interrupt;

   begin

     { Timer ISR }

   end;

 {$F-}

 begin

   GetIntVec($1C,Int1CSave);

   SetIntVec($1C,Addr(TimerHandler));

   writeln('Press ANYKEY to exit');

   repeat until Keypressed;

   SetIntVec($01C,Int1CSave);

 end.


GetTime.PAS
{GetTime.PAS}

{Sample code for the GetTime procedure.}

 uses WinDos, WinCrt;

 var

   h, m, s, hund : Word;

 function LeadingZero(w : Word) : String;

 var

   s : String;

 begin

   Str(w:0,s);

   if Length(s) = 1 then

     s := '0' + s;

   LeadingZero := s;

 end;

 begin

   GetTime(h,m,s,hund);

   Writeln('It is now ',LeadingZero(h),':',

           LeadingZero(m),':',LeadingZero(s),

           '.',LeadingZero(hund));

 end.


GetVerify.PAS
{GetVerify.PAS}

{Sample code for the GetVerify and SetVerify procedures.}

 uses WinDos,WinCrt;

 const

   OffOn : array [Boolean] of String[3] =

     ('off','on');

 var

   v : Boolean;

 begin

   GetVerify(v);

   Writeln('Write verify is ', OffOn[v]);

   v := not(v);

   Writeln('Turning write verify ',

           OffOn[v]);

   SetVerify(v);

 end.


Intr.PAS
{Intr.PAS}

{Sample code for the Intr procedure.}

uses WinCrt, WinDos;

var

  date, year, month, day: string;

  regs: TRegisters;

begin

  regs.ah := $2a;

  with regs do

  intr($21,regs);

  with regs do

    begin

      str(cx ,year);

      str(dh ,month);

      str(dl,day);

    end;

  date := month+'/'+day+'/'+year;

  writeln('Today''s date is ', date);

end.


MsDos.PAS
{MsDos.PAS}

{Sample code for the MsDos procedure.}

uses WinCrt, WinDos;

var

  date, year, month, day: string;

  regs: TRegisters;

begin

  regs.ah := $2a;

  with regs do

  msdos(regs);

  with regs do

    begin

      str(cx ,year);

      str(dh ,month);

      str(dl,day);

    end;

  date := month+'/'+day+'/'+year;

  writeln('Today''s date is ', date);

end.


RemoveDr.PAS
{RemoveDr.PAS}

{Sample code for the RemoveDir procedure.}

uses WinCrt, WinDos;

const

  Remove: PChar = 'C:\NEWDIR';

  CDrive: Byte = 3;

begin

  RemoveDir(Remove);

  Writeln('There is no longer a directory at ', Remove,'.');

end.


SetCurDr.PAS
{SetCurDr.PAS}

{Sample code for the SetCurDir procedure.}

uses WinCrt, WinDOS;

const

  ChangeTo: PChar = 'C:\';

  CDrive: Byte = 3;

var

  CurDir: PChar;

begin

  GetMem(CurDir, 80);

  SetCurDir(ChangeTo);

  GetCurDir(CurDir, CDrive);

  Writeln('The current directory on drive c is ', CurDir,'.');

end.


SetDate.PAS
{SetDate.PAS}

{Sample code for the SetDate procedure.}

 uses WinDos;

 begin

   { Set the system date to 2/10/89 }

   SetDate(1989,2,10);

 end.


SetTime.PAS
{SetTime.PAS}

{Sample code for the SetTime procedure.}

 uses Dos;

 begin

   { Set system clock to 12:01 AM }

   SetTime(0,1,0,0);

 end.


InitWCrt.PAS
{InitWCrt.PAS}

{Sample code for the InitWinCrt procedure.}

uses Strings, WinCrt, WinDOS;

begin

  StrCopy(WindowTitle,'InitWinCRT created CRT Window');

  Writeln('This is the my manually created CRT window.');

  Writeln('Notice the title.');

  InitWinCRT;

end.


DoneWCrt.PAS
{DoneWCrt.PAS}

{Sample code for the DoneWinCrt procedure.}

uses WinCrt;

begin

  Writeln('This is the first CRT window.');

  Writeln('  Please hit return.');

  Readln;

  DoneWinCRT;

  Writeln('This is the second CRT window.');

end.


WriteBuf.PAS
{WriteBuf.PAS}

{Sample code for the WriteBuf procedure.}

uses WinCrt;

var

  MyBuffer: PChar;

begin

  GetMem(MyBuffer, 80);

  MyBuffer := 'This is an example of WriteBuf';

  WriteBuf(MyBuffer, 30);

end.


WriteChr.PAS
{WriteChr.PAS}

{Sample code for the WriteChar procedure.}

uses WinCrt;

begin

  Write('ABCDE');

  WriteChar('F');

end.


KeyPress.PAS
{KeyPress.PAS}

{Sample code for the KeyPressed function.}

uses WinCrt;

begin

  repeat

    Write('Xx');

  until KeyPressed;

end.


ReadKey.PAS
{ReadKey.PAS}

{Sample code for the ReadKey function.}

uses WinCrt;

var

  C: Char;

begin

  Writeln('Please press a key');

  C := Readkey;

  Writeln(' You pressed ', C, ', whose ASCII value is ', Ord(C), '.');

end.


ReadBuf.PAS
{ReadBuf.PAS}

{Sample code for the ReadBuf function.}

uses WinCrt;

var

  C: PChar;

begin

  GetMem(C, 20);

  C := #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0;

  Writeln('Type a phrase up to 20 characters long:');

  ReadBuf(C, 20);

  Writeln(' You typed: ');

  Writeln(C);

end.


GotoXY.PAS
{GotoXY.PAS}

{Sample code for the GotoXY procedure.}

uses WinCrt;

var

  C: PChar;

begin

  GotoXY(10,10);

  Writeln('Hello');

end.


WhereX.PAS
{WhereX.PAS}

{Sample code for the WhereX function.}

uses WinCrt;

begin

  Write('The number in this sentence is in the #');

  Writeln(WhereX, ' column in this window.');

end.


WhereY.PAS
{WhereY.PAS}

{Sample code for the WhereY function.}

uses WinCrt;

begin

  Writeln;

  Writeln;

  Write('This sentence is on the #');

  Writeln(WhereY, ' line in this window.');

end.


ClrScr.PAS
{ClrScr.PAS}

{Sample code for the ClrScr procedure.}

uses WinCrt;

begin

  Writeln('Hello.   Please any key...');

  Readln;

  ClrScr;

end.


ClrEol.PAS
{ClrEol.PAS}

{Sample code for the ClrEol procedure.}

uses WinCrt;

begin

  Writeln('Hello there, how are you today?');

  Writeln('Press any key...');

  Readln;

  CursorTo(13,0);

  ClrEol;

end.


ScrollTo.PAS
{ScrollTo.PAS}

{Sample code for the ScrollTo procedure.}

uses WinCrt;

begin

  GotoXY(1,10);

  Writeln('Hello');

  Writeln('Type in a line and press Enter.');

  Readln;

  ScrollTo(0,10);

end.


TrackCur.PAS
{TrackCur.PAS}

{Sample code for the TrackCursor procedure.}

uses WinCrt;

var

  x: integer;

begin

  for x := 1 to 30 do

    Write('Xx');

  TrackCursor;

  Readln;

end.


AssignCr.PAS
{AssignCr.PAS}

{Sample code for the AssignCrt procedure.}

uses WinCrt;

var

  MyScreenFile: Text;

begin

  AssignCRT(MyScreenFile);

  Rewrite(MyScreenFile);

  Writeln(MyScreenFile,'The file variable MyScreenFile is associated with the screen.');

  Close(MyScreenFile);

end.


FileSch.PAS
{FileSch.PAS}

{Sample code for the FileSearch function.}

uses WinCrt, WinDos;

var

  S: array[0..fsPathName] of Char;

begin

  FileSearch(S, 'TPW.EXE', GetEnvVar('PATH'));

  if S[0] = #0 then

    Writeln('TPW.EXE not found')

  else

    Writeln('Found as ', FileExpand(S, S));

end.


FileSplt.PAS
{FileSplt.PAS}

{Sample code for the FileSplit function.}

uses Strings, WinCrt, WinDos;

var

  Path: array[0..fsPathName] of Char;

  Dir: array[0..fsDirectory] of Char;

  Name: array[0..fsFileName] of Char;

  Ext: array[0..fsExtension] of Char;

begin

  Write('Filename (WORK.PAS): ');

  Readln(Path);

  FileSplit(Path, Dir, Name, Ext);

  if Name[0] = #0 then StrCopy(Name, 'WORK');

  if Ext[0] = #0 then StrCopy(Ext, '.PAS');

  StrECopy(StrECopy(StrECopy(Path, Dir), Name), Ext);

  Writeln('Resulting name is ', Path);

end.


StrCat.PAS
{StrCat.PAS}

{Sample code for the StrCat function.}

uses Strings, WinCrt;

const

  Turbo: PChar = 'Turbo';

  Pascal: PChar = 'Pascal';

var

  S: array[0..15] of Char;

begin

  StrCopy(S, Turbo);

  StrCat(S, ' ');

  StrCat(S, Pascal);

  Writeln(S);

end.


StrComp.PAS
{StrComp.PAS}

{Sample code for the StrComp and StrlComp functions.}

uses Strings, WinCrt;

var

  C: Integer;

  Result: PChar;

  S1, S2: array[0..79] of Char;

begin

  Readln(S1);

  Readln(S2);

  C := StrComp(S1, S2);

  if C < 0 then Result := ' is less than ' else

    if C > 0 then Result := ' is greater than ' else

      Result := ' is equal to ';

  Writeln(S1, Result, S2);

end.


StrCopy.PAS
{StrCopy.PAS}

{Sample code for the StrCopy function.}

uses Strings, WinCrt;

var

  S: array[0..15] of Char;

begin

  StrCopy(S, 'Turbo Pascal');

  Writeln(S);

end.


StrECopy.PAS
{StrECopy.PAS}

{Sample code for the StrECopy function.}

uses Strings, WinCrt;

const

  Turbo: PChar = 'Turbo';

  Pascal: PChar = 'Pascal';

var

  S: array[0..15] of Char;

begin

  StrECopy(StrECopy(StrECopy(S, Turbo), ' '), Pascal);

  Writeln(S);

end.


StrEnd.PAS
{StrEnd.PAS}

{Sample code for the StrEnd function.}

uses Strings, WinCrt;

var

  S: array[0..79] of Char;

begin

  Readln(S);

  Writeln('String length is ', StrEnd(S) - S);

end.


StrLCat.PAS
{StrLCat.PAS}

{Sample code for the StrLCat function.}

uses Strings, WinCrt;

var

  S: array[0..9] of Char;

begin

  StrLCopy(S, 'Turbo', SizeOf(S) - 1)

  StrLCat(S, ' ', SizeOf(S) - 1);

  StrLCat(S, 'Pascal', SizeOf(S) - 1);

  Writeln(S);

end.


StrLComp.PAS
{StrLComp.PAS}

{Sample code for the StrLComp function.}

uses Strings, WinCrt;

var

  Result: PChar;

  S1, S2: array[0..79] of Char;

begin

  Readln(S1);

  Readln(S2);

  if StrLComp(S1, S2, 5) = 0 then

    Result := 'equal'

  else

    Result := 'different';

  Writeln('The first five characters are ', Test);

end.


StrLCopy.PAS
{StrLCopy.PAS}

{Sample code for the StrLCopy function.}

uses Strings, WinCrt;

var

  S: array[0..9] of Char;

begin

  StrLCopy(S, 'Turbo Pascal', SizeOf(S) - 1);

  Writeln(S);

end.


StrLen.PAS
{StrLen.PAS}

{Sample code for the StrLen function.}

uses Strings, WinCrt;

var

  S: array[0..79] of Char;

begin

  Readln(S);

  Writeln('String length is ', StrLen(S));

end.


StrLower.PAS
{StrLower.PAS}

{Sample code for the StrLower function.}

uses Strings, WinCrt;

var

  S: array[0..79] of Char;

begin

  Readln(S);

  Writeln(StrLower(S));

  Writeln(StrUpper(S));

end.


StrMove.PAS
{StrMove.PAS}

{Sample code for the StrMove and StrDispose functions.}

{ Allocate string on heap }

function StrNew(S: PChar): PChar;

var

  L: Word;

  P: PChar;

begin

  if (S = nil) or (S^ = #0) then StrNew := nil else

  begin

    L := StrLen(S) + 1;

    GetMem(P, L);

    StrNew := StrMove(P, S, L);

  end;

end;

{ Dispose string on heap }

procedure StrDispose(S: PChar);

begin

  if S <> nil then FreeMem(S, StrLen(S) + 1);

end;


StrNew.PAS
{StrNew.PAS}

{Sample code for the StrNew function.}

uses Strings, WinCrt;

var

  P: PChar;

  S: array[0..79] of Char;

begin

  Readln(S);

  P := StrNew(S);

  Writeln(P);

  StrDispose(P);

end.


StrPas.PAS
{StrPas.PAS}

{Sample code for the StrPas function.}

uses Strings, WinCrt;

var

  A: array[0..79] of Char;

  S: string[79];

begin

  Readln(A);

  S := StrPas(A);

  Writeln(S);

end.


StrPCopy.PAS
{StrPCopy.PAS}

{Sample code for the StrPCopy function.}

uses Strings, WinCrt;

var

  A: array[0..79] of Char;

  S: string[79];

begin

  Readln(S);

  StrPCopy(A, S);

  Writeln(A);

end.


StrPos.PAS
{StrPos.PAS}

{Sample code for the StrPos function.}

uses Strings, WinCrt;

var

  P: PChar;

  S, SubStr: array[0..79] of Char;

begin

  Readln(S);

  Readln(SubStr);

  P := StrPos(S, SubStr);

  if P = nil then

    Writeln('Substring not found');

  else

    Writeln('Substring found at index ', P - S);

end.


StrRScan.PAS
{StrRScan.PAS}

{Sample code for the StrRScan function.}

{ Return pointer to name part of a full path name }

function NamePart(FileName: PChar): PChar;

var

  P: PChar;

begin

  P := StrRScan(FileName, '\');

  if P = nil then

  begin

    P := StrRScan(FileName, ':');

    if P = nil then P := FileName;

  end;

  NamePart := P;

end;


StrScan.PAS
{StrScan.PAS}

{Sample code for the StrScan function.}

{ Return true if file name has wildcards in it }

function HasWildcards(FileName: PChar): Boolean;

begin

  HasWildcards := (StrScan(FileName, '*') <> nil) or

    (StrScan(FileName, '?') <> nil);

end;


StrUpper.PAS
{StrUpper.PAS}

{Sample code for the StrUpper function.}

uses Strings, WinCrt;

var

  S: array[0..79] of Char;

begin

  Readln(S);

  Writeln(StrUpper(S));

  Writeln(StrLower(S));

end.


CursorTo.PAS
{CursorTo.PAS}

{Sample code for the CursorTo procedure.}

uses WinCrt;

var

  C: PChar;

begin

  CursorTo(15,10);

  Writeln('Hi there.');

end.


Sample Codes

AssignCr.PAS

Chr.PAS

ClrEol.PAS

ClrScr.PAS

CreateDr.PAS

CSeg.PAS

CursorTo.PAS

Delete.PAS

DoneWCrt.PAS

Eoln.PAS

Exit.PAS

Exp.PAS

FileExp.PAS

FilePos.PAS

FileSch.PAS

FileSplt.PAS

Flush.PAS

FreeMem.PAS

GetArgCo.PAS

GetArgSt.PAS

GetCBrk.PAS

GetCurDr.PAS

GetDate.PAS

GetDir.PAS

GetEnvVa.PAS

GetFTime.PAS

GetIntVc.PAS

GetTime.PAS

GetVerify.PAS

GotoXY.PAS

Halt.PAS

InitWCrt.PAS

Intr.PAS

KeyPress.PAS

Ln.PAS

MsDos.PAS

Odd.PAS

Ord.PAS

Pi.PAS

Pred.PAS

Random.PAS

ReadBuf.PAS

ReadKey.PAS

Readln.PAS

RemoveDr.PAS

Rename.PAS

RmDir.PAS

Round.PAS

ScrollTo.PAS

SeekEof.PAS

SetCurDr.PAS

SetDate.PAS

SetFAttr.PAS

SetTime.PAS

Sqr.PAS

StrCat.PAS

StrComp.PAS

StrCopy.PAS

StrECopy.PAS

StrEnd.PAS

StrLCat.PAS

StrLComp.PAS

StrLCopy.PAS

StrLen.PAS

StrLower.PAS

StrMove.PAS

StrNew.PAS

StrPas.PAS

StrPCopy.PAS

StrPos.PAS

StrRScan.PAS

StrScan.PAS

StrUpper.PAS

TrackCur.PAS

Trunc.PAS

Truncate.PAS

UpCase.PAS

WhereX.PAS

WhereY.PAS

WriteBuf.PAS

WriteChr.PAS


Run-Time Error Messages

To go to the Help screen for a particular run-time error, choose the highlighted error number from this list (click it, or Tab to it and press Enter).

Error #	Error Message

1	Invalid function number

2	File not found

3	Path not found

4	Too many open files

5	File access denied

6	Invalid file handle

12	Invalid file access code

15	Invalid drive number

16	Cannot remove current directory

17	Cannot rename across drives

100	Disk read error

101	Disk write error

102	File not assigned

103	File not open

104	File not open for input

105	File not open for output

106	Invalid numeric format

200	Division by zero

201	Range check error

202	Stack overflow error

203	Heap overflow error

204	Invalid pointer operation

205	Floating point overflow

206	Floating point underflow

207	Invalid floating point operation

210	Object not initialized

211	Call to abstract method

212	Stream registration error

213	Collection index out of range

214	Collection overflow error

See Also

Compiler error messages


Compiler Errors
Compiler Error Messages

To go to the Help screen for a particular compiler error, choose the highlighted error number from this list.

Error #	Error Message

1	Out of memory

2	Identifier expected

3	Unknown identifier

4	Duplicate identifier

5	Syntax error

6	Error in real constant

7	Error in integer constant

8	String constant exceeds line

9	Too many nested files

10	Unexpected end of file

11	Line too long

12	Type identifier expected

13	Too many open files

14	Invalid file name

15	File not found

16	Disk full

17	Invalid compiler directive

18	Too many files

19	Undefined type in pointer definition

20	Variable identifier expected

21	Error in type

22	Structure too large

23	Set base type out of range

24	File components may not be files or objects

25	Invalid string length

26	Type mismatch

27	Invalid subrange base type

28	Lower bound > than upper bound

29	Ordinal type expected

30	Integer constant expected

31	Constant expected

32	Integer or real constant expected

33	Pointer type identifier expected

34	Invalid function result type

35	Label identifier expected

36	BEGIN expected

37	END expected

38	Integer expression expected

39	Ordinal expression expected

40	Boolean expression expected

41	Operand types do not match operator

42	Error in expression

43	Illegal assignment

44	Field identifier expected

45	Object file too large

46	Undefined external

47	Invalid object file record

48	Code segment too large

49	Data segment too large

50	DO expected

51	Invalid PUBLIC definition

52	Invalid EXTRN definition

53	Too many EXTRN definitions

54	OF expected

55	INTERFACE expected

56	Invalid relocatable reference

57	THEN expected

58	TO or DOWNTO expected

59	Undefined forward

61	Invalid typecast

62	Division by zero

63	Invalid file type

64	Cannot Read or Write variables of this type

65	Pointer variable expected

66	String variable expected

67	String expression expected

68	Circular unit reference

69	Unit name mismatch

70	Unit version mismatch

72	Unit file format error

73	IMPLEMENTATION expected

74	Constant and case types don't match

75	Record variable expected

76	Constant out of range

77	File variable expected

78	Pointer expression expected

79	Integer or real expression expected

80	Label not within current block

81	Label already defined

82	Undefined label in preceding statement part

83	Invalid @ argument

84	UNIT expected

85	";" expected

86	":" expected

87	"," expected

88	"(" expected

89	")" expected

90	"=" expected

91	":=" expected

92	"[" or "(." expected

93	"]" or ".)" expected

94	"." expected

95	".." expected

96	Too many variables

97	Invalid FOR control variable

98	Integer variable expected

99	File and procedure types are not allowed here

100	String length mismatch

101	Invalid ordering of fields

102	String constant expected

103	Integer or real variable expected

104	Ordinal variable expected

105	INLINE error

106	Character expression expected

112	CASE constant out of range

113	Error in statement

114	Cannot call an interrupt procedure

116	Must be in 8087 mode to compile

117	Target address not found

118	Include files are not allowed here

120	NIL expected

121	Invalid qualifier

122	Invalid variable reference

123	Too many symbols

124	Statement part too large

126	Files must be var parameters

127	Too many conditional symbols

128	Misplaced conditional directive

129	ENDIF directive missing

130	Error in initial conditional defines

131	Header does not match previous definition

132	Critical disk error

133	Cannot evaluate this expression

136	Invalid indirect reference

137	Structured variables are not allowed here

140	Invalid floating-point operation

142	Procedure or function variable expected

143	Invalid procedure or function reference

146	File access denied

147	Object type expected

148	Local object types are not allowed

149	VIRTUAL expected

150	Method identifier expected

151	Virtual constructors are not allowed

152	Constructor identifier expected

153	Destructor identifier expected

154	Fail only allowed within constructors

155	Invalid combination of opcode and operands

156	Memory reference expected

157	Cannot add or subtract relocatable symbols

158	Invalid register combination

159	286/287 instructions are not enabled

160	Invalid symbol reference

161	Code generation error

162	ASM expected

163	Duplicate dynamic method index

164	Duplicate resource identifier

165	Duplicate or invalid export index

166	Procedure or function identifier expected

167	Cannot export this symbol

168	Duplicate export name

See Also

Run-time error messages


Run-time error 1
Run-time error 1: Invalid function number

A call was made to a nonexistent DOS function.


Run-time error 2
Run-time error 2: File not found

The routines Reset, Append, Rename, and Erase report this error if the name assigned to the file variable doesn't specify an existing file.


Run-time error 3
Run-time error 3: Path not found

The routines Reset, Append, Rewrite, Rename, and Erase report this error if the name assigned to the file variable is invalid or specifies a non-existent subdirectory.

The routines ChDir, MkDir, and RmDirreport this error if the path is invalid or if it specifies a non-existent subdirectory.


Run-time error 4
Run-time error 4: Too many open files

The routines Reset, Rewrite, and Append report this error if the program has too many open files.

DOS never allows more than 15 open files per process.

If you get this error with less than 15 open files, the CONFIG.SYS file might not include a FILES=xx entry (or xx might specify too few files).

Increase the number xx to some suitable value, such as 20.


Run-time error 5
Run-time error 5: File access denied

Reported by	This Problem Occurs If:

Reset	FileMode allows writing and the name assigned to the file variable specifies a directory or a read only file

Append	FileMode allows writing and the name assigned to the file variable specifies a directory or a read only file

Rewrite	The directory is full, or the name assigned to the file variable specifies a directory or an existing read-only file.

Rename	The name assigned to the file variable specifies a directory, or the new name specifies an existing file.

Erase	The name assigned to the file variable specifies a directory or a read-only file.

MkDir	A file with the same name exists in the parent directory, or there is no room in the parent directory, or the path specifies a device.

RmDir	The directory isn't empty, or the path doesn't specify a directory, or the path specifies the root directory.

Read	(On a typed or untyped file): The file is not open for reading.

BlockRead	(On a typed or untyped file): The file is not open for reading.

Write	(On a typed or untyped file): The file is not open for writing.

BlockWrite	(On a typed or untyped file): The file is not open for writing.


Run-time error 6
Run-time error 6: Invalid file handle

This error is reported if an invalid file handle is passed to a DOS system call.

This error should never occur; if it does,you know that the file variable is somehow trashed.


Run-time error 12
Run-time error 12: Invalid file access code

Reset and Append report this error (on a typed or untyped file) if the value of FileMode is invalid.


Run-time error 15
Run-time error 15: Invalid drive number

GetDir and ChDir report this error if the drive number is invalid.


Run-time error 16
Run-time error 16: Cannot remove current directory

RmDir reports this error if the path specifies the current directory.


Run-time error 17
Run-time error 17:  Cannot rename across drives

Rename reports this error if both names are not on the same drive.


Run-time error 100
Run-time error 100: Disk read error

Read reports this error on a typed file if you attempt to read past the end of the file.


Run-time error 101
Run-time error 101: Disk write error

Close, Write, Writeln, and Flush report this error if the disk becomes full.


Run-time error 102
Run-time error 102: File not assigned

Reset, Rewrite, Append, Rename, and Erase report this error if the file variable has not been assigned a name through a call to Assign.


Run-time error 103
Run-time error 103: File not open

These routines report this error if the file is not open:

BlockRead

BlockWrite

Close

Eof

FilePos

FileSize

Flush

Read

Seek

Write


Run-time error 104
Run-time error 104: File not open for input

These routines report this error on a text file if the file is not open for input:

Eof

Eoln

Read

ReadLn

SeekEof

SeekEoln


Run-time error 105
Run-time error 105: File not open for output

This error occurs if you try to use standard input and output functions like Readln and Writeln without the Uses WinCRT; statement.

To correct this error, just add Uses WinCRT; to your program.


Run-time error 106
Run-time error 106: Invalid numeric format

Read and Readln report this error if a numeric value read from a text file doesn't conform to the proper numeric format.


Run-time error 200
Run-time error 200: Division by zero

The program attempted to divide a number by 0 during a /, mod, or div operation.

See Also

Binary arithmetic operators (/, mod, and div)


Run-time error 201
Run-time error 201: Range check error

This error is reported by statements compiled in the {$R+} state, when one of the following situations arises:

-	The index of an array was out of range.

-	The program attempted to assign an out-of-range value to a variable.

-	The program attempted to pass an out-of-range value as a parameter to a procedure or function.


Run-time error 202
Run-time error 202: Stack overflow error

The program reports this error on entry to a procedure or function compiled in the {$S+} state when there is not enough stack space to allocate the subprogram's local variables.

Increase the size of the stack with the $M compiler directive.

The Stack Overflow error can also be caused by infinite recursion, or by an assembly language procedure that doesn't maintain the stack properly.


Run-time error 203
Run-time error 203: Heap overflow error

New and GetMem report this error when there is not enough free space in the heap to allocate a block of the requested size.

For a complete discussion of the heap manager, refer to the chapter "Memory Issues" in the Turbo Pascal for Windows Programmer's Guide.


Run-time error 204
Run-time error 204: Invalid pointer operation

Dispose and FreeMem report this error if the pointer is nil or if it points to a location outside the heap.


Run-time error 205
Run-time error 205: Floating point overflow

A floating-point operation produced a number too large for Turbo Pascal (or the numeric coprocessor, if there is one) to handle.


Run-time error 206
Run-time error 206: Floating point underflow

A floating-point operation produced an underflow.

This error is only reported if you are using a numeric coprocessor with a control word that unmasks underflow exceptions.

By default, an underflow causes a result of zero to be returned.


Run-time error 207
Run-time error 207: Invalid floating point operation

One of the following floating-point errors occured:

-	The real value passed to Trunc or Round could not be converted to an Integer within the Longint range (-2147483648 to 2147483647).

-	The argument passed to the Sqrt function was negative.

-	The argument passed to the Ln function was zero or negative.

-	An 80 x 87 stack overflow occurred.

For details on correctly programming the 80 x 87, refer to the chapter "Using the 80 x 87" in the Turbo Pascal for Windows Programmer's Guide.


Run-time error 210
Run-time error 210: Object not initialized

With range-checking on, you made a call to an object's virtual method, before the object had been initialized via a constructor call.


Run-time error 211
Run-time error 211: Call to abstract method

This error is generated by the Abstract procedure in the WObjects unit.

It indicates that your program tried to execute an abstract virtual method.


Run-time error 212
Run-time error 212: Stream registration error

This error is generated by the RegisterType procedure in the WObjects unit.

It indicates that one of the following errors has occurred:

-	The stream registration record does not reside in the data segment.

-	The ObjType field of the stream registration record is 0.

-	The type has already been registered.

-	Another type with the same ObjType value already exists.


Run-time error 213
Run-time error 213: Collection index out of range

The index passed to a TCollection method is out of range.


Run-time error 214
Run-time error 214: Collection overflow error

This error is reported by a TCollection if an attempt is made to add an element when the collection cannot be expanded.


Compiler error 1
Compiler error 1: Out of memory

This error occurs when the compiler has run out of memory.

Try these possible solutions:

-	Try to increaset the amount of available memory in Windows.

-	Set Options|Linker|Link buffer to Disk.

-	If you are using the command-line compiler, use the /L option to place the link buffer on disk.

If none of these suggestions help, your program or unit might just be too large to compile in the amount of memory available; you might have to break it into two or more smaller units.


Compiler error 2
Compiler error 2: Identifier expected

An identifier was expected at this point.

You might be trying to redeclare a reserved word.


Compiler error 3
Compiler error 3: Unknown identifier

This identifier has not been declared, or it might not be visible within the current scope.


Compiler error 4
Compiler error 4: Duplicate identifier

The identifier has already been used within the current block.


Compiler error 5
Compiler error 5: Syntax error

An illegal character was found in the source text.

You might have forgotten the quotes around a string constant.


Compiler error 6
Compiler error 6: Error in real constant

The syntax of real-type constants is defined in the chapter "Tokens and Constants" in the Turbo Pascal for Windows Programmer's Guide.


Compiler error 7
Compiler error 7: Error in Integer constant

The syntax of Integer-type constants is defined in the chapter "Tokens and Constants" in the Turbo Pascal for Windows Programmer's Guide.

NOTE: Whole real numbers outside the maximum integer range must be followed by a decimal point and a zero, like this:

12345678912.0


Compiler error 8
Compiler error 8: String constant exceeds line

You have probably forgotten the ending quote in a string constant.


Compiler error 9
Compiler error 9: Too many nested files

The compiler allows no more than 15 nested source files.

You probably have more than four nested Include files.


Compiler error 810
Compiler error 10: Unexpected end of file

Here are the most likely causes of this error message:

-	Your source file ends before the final end of the main statement part. Probably, the begins and ends are unbalanced.

-	An Include file ends in the middle of a statement part. Every statement part must be entirely contained in one file.

-	 You didn't close a comment.


Compiler error 811
Compiler error 11: Line too long

The maximum line length is 126 characters.


Compiler error 12
Compiler error 12: Type identifier expected

The identifier doesn't denote a type as it should.


Compiler error 13
Compiler error 13: Too many open files

If this error occurs, your CONFIG.SYS file doesn't include a FILES=xx entry, or the entry specifies too few files.

Increase the number xx; for instance, to 20.


Compiler error 14
Compiler error 14: Invalid file name

The file name is invalid or specifies a nonexistent path.


Compiler error 15
Compiler error 15: File not found

The file could not be found in the current directory or in any of the search directories that apply to this type of file.


Compiler error 16
Compiler error 16: Disk full

Delete some files or use a new disk.


Compiler error 17
Compiler error 17: Invalid compiler directive

One of the following applies:

-	The compiler directive letter is unknown.

-	One of the compiler directive parameters is invalid.

-	You are using a global compiler directive  when compilation of the program's body has begun.


Compiler error 18
Compiler error 18: Too many files

There are too many files involved in the compilation of the program or unit.

Try not to use that many files by merging Include files or making the file names shorter.


Compiler error 19
Compiler error 19: Undefined type in pointer definition

The type was referenced in a pointer-type declaration, but it was never declared.


Compiler error 20
Compiler error 20: Variable identifier expected

The identifier doesn't denote a variable as it should.


Compiler error 21
Compiler error 21: Error in type

This symbol can't start a type definition.


Compiler error 22
Compiler error 22: Structure too large

The maximum allowable size of a structured type is 65520 bytes.


Compiler error 23
Compiler error 23: Set base type out of range

The base type of a set must be a subrange with bounds in the range 0..255, or an enumerated type with no more than 256 possible values.


Compiler error 24
Compiler error 24: File components may not be files or objects

The component type of a file type can't be an object type or a file type, or any structured type within an object type or file type component.


Compiler error 25
Compiler error 25: Invalid string length

The declared maximum length of a string must be in the range 1..255.


Compiler error 26
Compiler error 26:Type mismatch

This error occurs because of one of four things:

-	Incompatible types of the variable and the expression in an assignment statement.

-	Incompatible types of the actual and formal parameter in a call to a procedure or function.

-	An expression type that is incompatible with index type in array indexing.

-	Incompatible types of operands in an expression.


Compiler error 27
Compiler error 27: Invalid subrange base type

Only ordinal types are valid base types.


Compiler error 28
Compiler error 28: Lower bound > than upper bound

The declaration of a subrange type specifies a lower bound greater than the upper bound.


Compiler error 29
Compiler error 29: Ordinal type expected

Real types, string types, structured types, and pointer types are not allowed here.


Compiler error 30
Compiler error 30: Integer constant expected

Only an integer constant is allowed here.


Compiler error 31
Compiler error 31: Constant expected

Only a constant is allowed here.


Compiler error 32
Compiler error 32: Integer or real constant expected

Only a numeric constant is allowed here.


Compiler error 33
Compiler error 33: Pointer Type identifier expected

The identifier doesn't denote a type as it should.


Compiler error 34
Compiler error 34: Invalid function result type

Valid function result types are all simple types, string types, and pointer types.


Compiler error 35
Compiler error 35: Label identifier expected

The identifier doesn't denote a label as it should.


Compiler error 36
Compiler error 36: BEGIN expected

A BEGIN was expected here, or else there is an error in the block structure of the unit or program.


Compiler error 37
Compiler error 37: END expected

An END was expected here, or else there is an error in the block structure of the unit or program.


Compiler error 38
Compiler error 38: Integer expression expected

The expression must be of an Integer type.


Compiler error 39
Compiler error 39: Ordinal expression expected

The expression must be of an ordinal type.


Compiler error 40
Compiler error 40: Boolean expression expected

The expression must be of type Boolean.


Compiler error 41
Compiler error 41: Operand types do not match operator

The operator can't be applied to operands of this type; for example, 'A' div '2'.


Compiler error 42
Compiler error 42: Error in expression

This symbol can't participate in an expression in the way it is written.

You might have forgotten to write an operator between two operands.


Compiler error 43
Compiler error 43: Illegal assignment

Files and untyped variables can't be assigned values.

A function identifier can only be assigned values within the statement part of the function.


Compiler error 44
Compiler error 44: Field identifier expected

The identifier doesn't denote a field in the record variable.


Compiler error 45
Compiler error 45: Object file too large

Turbo Pascal can't link in .OBJ files larger than 64K.


Compiler error 846
Compiler error 46: Undefined External

The external procedure or function doesn't have a matching PUBLIC definition in an object file.

Make sure you have specified all object files in $L filename directives, and check the spelling of the procedure or function identifier in the .ASM file.


Compiler error 47
Compiler error 47: Invalid object file record

The .OBJ file contains an invalid object record; make sure the file is an .OBJ file.


Compiler error 48
Compiler error 48: Code segment too large

The maximum size of the code of a program or unit is 65520 bytes.

-	If you are compiling a program, move some procedures or functions into a unit.

-	If you are compiling a unit, break it into two or more units.


Compiler error 49
Compiler error 49: Data segment too large

The maximum size of a program's data segment is 65520 bytes, including data declared by the used units.

If you need more global data than this, declare the larger structures as pointers, and allocate them dynamically using the New procedure.


Compiler error 50
Compiler error 50: DO expected

The reserved word DO doesn't appear where it should.


Compiler error 51
Compiler error 51: Invalid PUBLIC definition

Here are some possible sources of this error:

-	Two or more PUBLIC directives in assembly language define the same identifier.

-	The .OBJ file defines PUBLIC symbols that do not reside in the CODE segment.


Compiler error 52
Compiler error 52: Invalid EXTRN definition

Here are some possible sources of this error:

-	The identifier was referred to through an EXTRN directive in assembly language, but it is not declared in the Pascal program or unit, nor in the interface part of any of the used units.

-	The identifier denotes an absolute variable.

-	The identifier denotes an inline procedure or function.


Compiler error 53
Compiler error 53: Too many EXTRN definitions

Turbo Pascal can't handle .OBJ files with more than 256 EXTRN definitions.


Compiler error 54
Compiler error 54: OF expected

The reserved word OF doesn't appear where it should.


Compiler error 55
Compiler error 55: INTERFACE expected

The reserved word INTERFACE doesn't appear where it should.


Compiler error 56
Compiler error 56: Invalid relocatable reference

Here are some possible sources of this error:

-	The .OBJ file contains data and relocatable references in segments other than CODE. For example, you might be attempting to declare initialized variables in the DATA segment.

-	The .OBJ file contains byte-sized references to relocatable symbols. This error occurs if you use the HIGH and LOW operators with relocatable symbols, or if you refer to relocatable symbols in DB directives.

-	An operand refers to a relocatable symbol that was not defined in the CODE segment or in the DATA segment.

-	An operand refers to an EXTRN procedure or  function with an offset; for example, CALL SortProc+8


Compiler error 57
Compiler error 57: THEN expected

The reserved word THEN doesn't appear where it should.


Compiler error 58
Compiler error 58: TO or DOWNTO expected

The reserved word TO or DOWNTO doesn't appear where it should.


Compiler error 59
Compiler error 59: Undefined forward

Here are some possible sources of this error:

-	The procedure or function was declared in the interface part of a unit, but its declaration never occurred in the implementation part.

-	The procedure or function was declared forward but its definition was never found.


Compiler error 61
Compiler error 61: Invalid typecast

Here are some possible sources of this error:

-	In a variable typecast, the sizes of the variable reference and the destination type differ.

-	You are attempting to typecast an expression where only a variable reference is allowed.


Compiler error 62
Compiler error 62: Division by zero

The preceeding operand attempts to divide by zero.


Compiler error 63
Compiler error 63: Invalid file type

The file-handling procedure doesn't support the given file's type.

For example, you might have made a call to Readln with a typed file or Seek with a text file.


Compiler error 864
Compiler error 64: Cannot Read or Write variables of this type

Reading:

Read and Readln can input these variables:

Char

Integer

real

string

Writing:

Write and Writeln can output these variables:

Char

Integer

real

string

Boolean


Compiler error 865
Compiler error 65: Pointer variable expected

This variable must be of a pointer type.


Compiler error 866
Compiler error 66: String variable expected

This variable must be of a string type.


Compiler error 67
Compiler error 67: String expression expected

This expression must be of a string type.


Compiler error 68
Compiler error 68: Circular unit reference

Two units are not allowed to use each other in their interface parts.


Compiler error 869
Compiler error 69: Unit name mismatch

The name of the unit found in the .TPU file doesn't match the name specified in the uses clause.


Compiler error 70
Compiler error 70: Unit version mismatch

One or more of the units used by this unit have been changed since this unit was compiled.

Use Compile|Make or Compile|Build to automatically recompile the units that have changed.


Compiler error 72
Compiler error 72: Unit file format error

The .TPU file is somehow invalid; make sure it is a .TPU file.


Compiler error 73
Compiler error 73: IMPLEMENTATION expected

The reserved word IMPLEMENTATION doesn't appear where it should.


Compiler error 74
Compiler error 74: Constant and case types don't match

The type of the case constant is incompatible with the case statement's selector expression.


Compiler error 75
Compiler error 75: Record variable expected

This variable must be of a record type.


Compiler error 76
Compiler error 76: Constant out of range

You are trying to do one of the following:

-	Index an array with an out-of-range constant.

-	Assign an out-of-range constant to a variable.

-	Pass an out-of-range constant as a parameter to a procedure or function.


Compiler error 877
Compiler error 77: File variable expected

This variable must be of a file type.


Compiler error 878
Compiler error 78: Pointer expression expected

This expression must be of a pointer type.


Compiler error 879
Compiler error 79: Integer or real expression expected

This expression must be of an Integer or a Real type.


Compiler error 80
Compiler error 80: Label not within current block

A goto statement can't reference a label outside the current block.


Compiler error 81
Compiler error 81: Label already defined

The label already marks a statement.


Compiler error 82
Compiler error 82: Undefined label in preceding statement part

The label was declared and referenced in a statement part, but it was never defined.


Compiler error 83
Compiler error 83: Invalid @ argument

Valid arguments are variable references and procedure or function identifiers.


Compiler error 84
Compiler error 84: UNIT expected

The reserved word UNIT doesn't appear where it should.


Compiler error 85
Compiler error 85: ";" expected

A semicolon doesn't appear where it should.


Compiler error 86
Compiler error 86: ":" expected

A colon doesn't appear where it should.


Compiler error 87
Compiler error 87: "," expected

A comma doesn't appear where it should.


Compiler error 88
Compiler error 88: "(" expected

An opening parenthesis doesn't appear where it should.


Compiler error 89
Compiler error 89: ")" expected

A closing parenthesis doesn't appear where it should.


Compiler error 90
Compiler error 90: "=" expected

An equal sign doesn't appear where it should.


Compiler error 91
Compiler error 91: ":=" expected

An assignment operator doesn't appear where it should.


Compiler error 92
Compiler error 92: "[" or "(." expected

A left bracket doesn't appear where it should.


Compiler error 93
Compiler error 93: "]" or ".)" expected

A right bracket doesn't appear where it should.


Compiler error 94
Compiler error 94: "." expected

A period doesn't appear where it should.


Compiler error 95
Compiler error 95: ".." expected

A subrange doesn't appear where it should.


Compiler error 96
Compiler error 96: Too many variables

Global

The total size of the global variables declared within a program or unit can't exceed 64K.

Local

The total size of the local variables declared within a procedure or function can't exceed 64K.


Compiler error 97
Compiler error 97: Invalid FOR control variable

The FOR statement control variable must be a simple variable defined in the declaration part of the current subprogram.


Compiler error 98
Compiler error 98: Integer variable expected

This variable must be of an Integer type.


Compiler error 99
Compiler error 99: File and procedure types are not allowed here

A typed constant can't be of a file type.


Compiler error 100
Compiler error 100: String length mismatch

The length of the string constant doesn't match the number of components in the chacter array.


Compiler error 101
Compiler error 101: Invalid ordering of fields

The fields of a record-type constant must be written in the order of declaration.


Compiler error 102
Compiler error 102: String constant expected

A string constant doesn't appear where it should.


Compiler error 103
Compiler error 103: Integer or Real variable expected

This variable must be of an Integer or Real type.


Compiler error 104
Compiler error 104: Ordinal variable expected

This variable must be of an ordinal type.


Compiler error 105
Compiler error 105: INLINE error

The < operator is not allowed in conjunction with relocatable references to variables.

Such references are always word-sized.


Compiler error 106
Compiler error 106: Character expression expected

This expression must be of a Char type.


Compiler error 112
Compiler error 112: CASE constant out of range

For Integer type case statements, the constants must be within the range - 32768..32767.


Compiler error 113
Compiler error 113: Error in statement

This symbol can't start a statement.


Compiler error 114
Compiler error 114: Cannot call an interrupt procedure

You can't directly call an interrupt procedure.


Compiler error 116
Compiler error 116: Must be in 80x87 mode to compile

This construct can only be compiled in the {$N+} state.

Operations on the 80x87 real types (Single, Double, Extended, and Comp) are not allowed in the {$N-} state.


Compiler error 117
Compiler error 117: Target address not found

The Search|Find Error command could not locate a statement that corresponds to the specified address.


Compiler error 118
Compiler error 118: Include files are not allowed here

Every statement part must be entirely contained in one file.


Compiler error 120
Compiler error 120: NIL expected

Typed constants of pointer types may only be initialized to the value nil.


Compiler error 121
Compiler error 121: Invalid qualifier

You are trying to do one of the following:

-	Index a variable that is not an array.

-	Specify fields in a variable that is not a record.

-	Dereference a variable that is not a pointer.


Compiler error 122
Compiler error 122: Invalid variable reference

This construct follows the syntax of a variable reference, but it doesn't denote a memory location.

You are probably calling a pointer function, but forgetting to dereference the result.


Compiler error 123
Compiler error 123: Too many symbols

The program or unit declares more than 64K of symbols.

If you are compiling with {$D+}, try turning it off.

NOTE: This will prevent you from finding run-time errors in that module.

You could also try moving some declarations into a separate unit.


Compiler error 124
Compiler error 124: Statement part too large

Turbo Pascal limits the size of a statement part to about 24K.

If you encounter this error, move sections of the statement part into one or more procedures.


Compiler error 126
Compiler error 126: Files must be var parameters

You are attempting to declare a file type value parameter.

File-type parameters must be var parameters.


Compiler error 127
Compiler error 127: Too many conditional symbols

There is not enough room to define further conditional symbols.

Try to eliminate some symbols, or shorten some of the symbolic names.


Compiler error 128
Compiler error 128: Misplaced conditional directive

The compiler encountered an {$ELSE} or {$ENDIF} directive without a matching {$IFDEF}, {$IFNDEF}, or {$IFOPT} directive.


Compiler error 129
Compiler error 129: ENDIF directive missing

The source file ended within a conditional compilation construct.

There must be an equal number of {$IFxxx}s and {$ENDIF} in a source file.


Compiler error 130
Compiler error 130: Error in initial conditional defines

The initial conditional symbols specified in Options|Compiler|Conditional Defines (or in a /D directive) are invalid.

Turbo Pascal expects zero or more identifiers separated by blanks, commas, or semicolons.


Compiler error 131
Compiler error 131: Header does not match previous definition

The procedure or function header specified in an interface part or FORWARD declaration doesn't match this header.


Compiler error 132
Compiler error 132: Critical disk error

A critical error occurred during compilation (for example, a Drive Not Ready error).


Compiler error 133
Compiler error 133: Cannot evaluate this expression

You are attempting to use a non-supported feature in a constant expression or in a debug expression.

For example, you might be attempting to use the Sin function in a const declaration, or attempting to call a user-defined function in a debug expression.


Compiler error 136
Compiler error 136: Invalid indirect reference

The statement attempts to make an invalid indirect reference.

For example, you might be using an absolute variable whose base variable is not known in the current module, or using an inline routine that references a variable not known in the current module.


Compiler error 137
Compiler error 137: Structured variables are not allowed here

You are attempting to perform a non-supported operation on a structured variable.

For example, you might be trying to multiply two records.


Compiler error 140
Compiler error 140: Invalid floating-point operation

An operation on two real type values produced an overflow or a division by zero.


Compiler error 142
Compiler error 142: Procedure or function variable expected

In this context, the address operator (@) can only be used with a procedure or function variable.


Compiler error 143
Compiler error 143: Invalid procedure or function reference

You are attempting to call a procedure in an expression.

A procedure or a function must be compiled in the {$F+} state, and can't be declared with inline or interrupt if it is to be assigned to a procedure variable.


Compiler error 146
Compiler error 146: File access denied

The file could not be opened or created. The program might be trying to write to a read-only file.


Compiler error 147
Compiler error 147: Object type expected

The identifier doesn't denote an object type.


Compiler error 148
Compiler error 148: Local object types are not allowed

Object types can be defined only in the outermost scope of a program or unit.

Object type definitions within procedures and functions are not allowed.


Compiler error 149
Compiler error 149: VIRTUAL expected

The keyword virtual is missing.


Compiler error 150
Compiler error 150: Method identifier expected

The identifier doesn't denote a method.


Compiler error 151
Compiler error 151: Virtual constructors are not allowed

A constructor method must be static.


Compiler error 152
Compiler error 152: Constructor identifier expected

The identifier doesn't denote a constructor.


Compiler error 153
Compiler error 153: Destructor identifier expected

The identifier doesn't denote a destructor.


Compiler error 154
Compiler error 154: Fail only allowed within constructors

The Fail standard procedure can be used only within constructors.


Compiler error 155
Compiler error 155: Invalid combination of opcode and operands

The assembler opcode does not accept this combination of operands.

Possible causes are:

-	There are too many or too few operands for this assembler opcode; for example, INC AX,BX or MOV AX.

-	The number of operands is correct, but their types or order do not match the opcode; for example, DEC 1, MOV AX,CL or MOV 1,AX.


Compiler error 156
Compiler error 156: Memory reference expected

The assembler operand is not a memory reference, which is required here.

Most likely you have forgotten to put square brackets around an index register operand, for example MOV AX,BX+SI instead of MOV AX,[BX+SI].


Compiler error 157
Compiler error 157: Cannot add or subtract relocatable symbols

The only arithmetic operation that can be performed on a relocatable symbol in an assembler operand is addition or subtraction of a constant.

Variables, procedures, functions, and labels are relocatable symbols. Assuming that Var is variable and Const is a constant, then the instructions MOV AX,Const+Const and MOV AX,Var+Const are valid, but MOV AX,Var+Var is not.


Compiler error 158
Compiler error 158: Invalid register combination

Valid index register combinations are [BX], [BP], [SI], [DI], [BX+SI], [BX+DI], [BP+SI], and [BP+DI]. Other index register combinations, such as [AX], [BP+BX], and [SI+DX], are not allowed.

Local variables are always allocated on thestack and accessed via the BP register. The ssembler automatically adds [BP] in references to such variables, so even though a construct like Local[BX] (where Local is a local variable) appears valid, it is not since the final operand would become Local[BP+BX].


Compiler error 159
Compiler error 159: 286/287 instructions are not enabled

Use a {$G+} compiler directive to enable 286/287 opcodes, but be aware that the resulting code cannot be run on 8086 and 8088 based machines.


Compiler error 160
Compiler error 160: Invalid symbol reference

This symbol cannot be accessed in an assembler operand.

Possible causes are:

-	You are attempting to access a standard procedure, a standard function, or the Mem, MemW, MemL, Port, or PortW special arrays in an assembler operand.

-	You are attempting to access a string, floating-point, or set constant in an assembler operand.

-	You are attempting to access an inline procedure or function in an assembler operand.

-	You are attempting to access the @Result special symbol outside a function.

-	You are attempting to generate a short JMP instruction that jumps to something other than a label.


Compiler error 161
Compiler error 161: Code generation error

The preceding statement part contains a LOOPNE, LOOPE, LOOP, or JCXZ instruction that cannot reach its target label.


Compiler error 162
Compiler error 162: ASM expected

The compiler expects an ASM reserved word at this location.


Compiler error 163
Compiler error 163: Duplicate dynamic method index

This dynamic method index has already been used by another method.


Compiler error 164
Compiler error 164: Duplicate resource indentifier

This resource file contains a resource with a name or ID that has already been used by another resource.


Compiler error 165
Compiler error 165: Duplicate or invalid export Index

The ordinal number specified in the Index cause is not within the range 1..32767, or has already been used by another exported routine.


Compiler error 166
Compiler error 166: Procedure or function identifier expected

The exports clause only allows procedures and functions to be exported.


Compiler error 167
Compiler error 167: Cannot export this symbol

A procedure or function cannot be exported unless it was declared with the export function.


Compiler error 168
Compiler error 168: Duplicate export name

The name specified in the name clause has already been used by another exported routine.


Command-Line Options

The Turbo Pascal for Windows command-line compiler (TPCW.EXE) lets you invoke all the functions of the IDE compiler (TPW.EXE) from the DOS command line.

Turbo Pascal command-line options use this syntax:

TPCW   [options]   <file name>   [options]

where [options] can be one or more options, separated by spaces.

 -	Place a + (or a space) after an option to turn it On.

 -	Place a - after the option to turn it Off.

Compiler directive options

Option	Meaning

/$A	Align Data

/$B	Boolean Evaluation

/$D	Debug Information

/$F	Force FAR Calls

/$G	Generate 286 Instructions

/$I	Input/Output Checking

/$L	Local Symbol Information

/$N	80x87 Code (Numeric coprocessor)

/$R	Range Checking

/$S	Stack-Overflow Checking

/$V	String Var Checking

/$W	Windows Stack Frame

/$X	Extended Syntax

Compiler mode options

Option	Meaning

/B	Build All

/F	Find Error

/L	Link Buffer

/M	Make

/Q	Quiet (no IDE equivalent)

Conditional defines option

/D	Conditional Defines

Debug options

Option	Meaning

/G	.MAP File

/V	Debug Info in EXE Option

Directory options

Option	Meaning

/E	EXE and TPU Directory

/I	Include Directories

/O	Object Files Directories

/R	Resource Directories

/T	Turbo Directory

/U	Unit Directories

Most of the command-line options have equivalent menu commands. See the Command-Line Options and IDE Equivalents Help screen for a summary.


Command-Line Options and IDE Equivalents

Option	IDE Equivalent

/$A	Options|Compiler|Align Data

/$B	Options|Compiler|Boolean Evaluation

/$D	Options|Compiler|Debug Information

/$F	Options|Compiler|Force Far Calls

/$G	Options|Compiler|286 Code

/$I	Options|Compiler|I/O Checking

/$L	Options|Compiler|Local Symbols

/$M	Options|Compiler|Memory Sizes

/$N	Options|Compiler|80x87 Code

/$R	Options|Compiler|Range Checking

/$S	Options|Compiler|Stack Checking

/$V	Options|Compiler|String Var Checking options

/$W	Options|Compiler|Windows Stack Frames

/$X	Options|Compiler|Extended Syntax

/B	Compile|Build

/D	Options|Compiler|Conditional Defines

/E	Options|Directories|EXE and TPU Directory

/F	Search|Find Error

/G	Options|Linker|Map File

/I	Options|Compiler|Include Directories

/L	Options|Linker|Link Buffer

/M	Compile|Make

/O	Options|Directories|Object Directories

/Q	(none)

/R	Options|Directories|Resource Directories

/T	(none)

/U	Options|Directories|Unit Directories

/V	Options|Linker|Debug Info in EXE


/V Command-Line Option

The /V command-line option appends Turbo Debugger-compatible debug information at the end of the .EXE file.

This option does not affect the actual code in the .EXE file. If the .EXE file is executed, the .EXE file does not require additional memory.

See Also

Options|Linker|Debug Info in Exe


/Q Command-Line Option

The /Q command-line option suppresses the printing of file names and line numbers during compilation.

If an error occurs, it will be reported.


/L Command-Line Option

The /L command-line option disables buffering in memory when .TPU files are linked to create an .EXE file. Files are then read from disk instead of from memory.

For very large programs, you may need to specify /L to link successfully.

See Also

Options|Linker|Link Buffer


/G Command-Line
/G Command-Line Option

The /G command-line option tells TPCW to generate a .MAP file that shows the layout of the .EXE file.

The /G option must be followed by S, P, or L to indicate the level of information in the .MAP file.

-	The /GS option outputs the Segment section of the .MAP file.

-	The /GP option outputs the Segments and Publics sections of the .MAP file.

-	The /GL option outputs the Segments, Publics, and Line Numbers sections of the .MAP file.

See Also

Options|Linker|Map File


/R Command-Line Option

The /R option tells TPCW where to look for .RES files created with the Whitewater Resource Toolkit.

See Also

Options|Directories|Resource Directories


/O Command-Line Option

Use the /O command-line option to specify a list of directories in which to search for .OBJ files that contain external assembly language routines.

Separate multiple directories with semicolons.

See Also

Options|Directories|Object Directories


/U Command-Line Option

Use the /U command-line option to specify additional directories in which to search for units.

Separate multiple directories with semicolons.

By default, TPCW first searches for units in TPW.TPL. If the units are not there, TPCW then searches for unitname.TPU in the current directory.

See Also

Options|Directories|Unit Directories


/I Command-Line Option

Use the /I command-line option to specify a list of directories in which to search for include files. Separate multiple directories with semicolons.

See Also

Options|Directories|Include Directories


/E Command-Line Option

The /E command-line option tells TPCW where to put the .EXE and .TPU files it creates.

See Also

Options|Directories|EXE and TPU Directory


/T Command-Line Option

The /T command-line option tells TPCW where to find the:

-	configuration file (TPCW.CFG) and

-	resident library file (TPCW.TPL)

If these files are in the current directory or in the directory with TPCW.EXE, you do not need to use this option.

If you use this option, it must be the first command-line argument.


/D Command-Line Option

Use the /D command-line option to define conditional symbols. This is the same as using the DEFINE conditional symbol directive at the beginning of your program.

See Also

Options|Compiler|Conditional Defines


/B Command-Line Option

The /B command-line option rebuilds all the components of your program, regardless of whether they're current.

This option is identical to /M, except that it is unconditional. (/M rebuilds only those files that aren't current.)

See Also

Compile|Build


/M Command-Line
/M Command-Line Option

The /M command-line option creates an .EXE file according to the following rules.

-	If the source file for a given unit has been modified since the .TPU (object code) file was created, that unit is recompiled.

-	If the interface section of a unit referenced in a uses statement has been changed, all other units that depend upon it are recompiled.

-	If any linked .OBJ file is newer than the unit's .TPU file, the unit is recompiled.

-	If a unit contains an Include file and the Include file is newer than that unit's .TPU file, the unit is recompiled.

This option is identical to /B, except that it is conditional. (/M rebuilds all files, regardless of whether they're out of date).

NOTE: Units in TPW.TPL are excluded from this process.

See Also

Compile|Make


/F Command-Line Option

The /F command-line option finds a run-time error in your source text.

When a program terminates due to a run-time error, it displays an error code and the address (segment:offset) at which the error occurred.

To locate the error in the source text, specify that address in the /F option:

/Fsegment:offset

NOTE: The program and units must have been compiled with the /$D command-line option enabled.

See Also

Search|Find Error


Compile menu

You use the commands on the Compile menu to compile, make, or build your program.

To use the Compile, Make, and Build commands, you must have a file open in an active edit window or have a primary file defined (for Make and Build).

You can choose from these commands:

Compile

Make

Build

Primary File

Clear Primary File

Information


Compile|Compile

The Compile|Compile command compiles the file in the active edit window.

A Compile Status information box displays the compilation progress and results. Choose OK when compilation is complete.

If an error occurred, the status bar displays the line with the error highlighted.

Click your mouse or press any key to clear the message so you can correct the error.


Compile Status information box

The Compile Status information box displays the compilation progress and results.


Compile|Make

The Make command creates an .EXE file according to the following rules.

-	If a primary file has been named in the Primary File dialog box, that file is compiled. Otherwise, the file in the active edit window is compiled. Turbo Pascal checks all files that the file being compiled depends on to see if they exist and that they are current.

-	If the source file for a given unit has been modified since the .TPU (object code) file was created, that unit is recompiled.

-	If the interface for a given unit has been changed, all other units that depend upon it are recompiled.

-	If a unit links in an .OBJ file (external routines), and the .OBJ file is newer than the unit's .TPU file, the unit is recompiled.

-	If a unit contains an Include file and the Include file is newer than that unit's .TPU file, the unit is recompiled.

-	If the source to a unit (.TPU file) cannot be located, that unit is not compiled, but used as is.

This option is identical to Compile|Build, except that it is conditional.  (Build rebuilds all files, regardless of whether they're out of date).


Compile|Build

The Build command rebuilds all the components of your program, regardless of whether they're current.

This option is identical to Compile|Make, except that it is unconditional. (Make rebuilds only those files that aren't current.)

The Compile|Build command recompiles all the files included in the primary file.

If you abort a Build command by pressing Ctrl+Break or get errors that stop the build, you can pick up where it left off by choosing Compile|Make.


Compile|Primary File

The Compile|Primary File command displays the Primary File dialog box, where you specify which .PAS file will be compiled when you choose Compile|Make or Compile|Build.

Use Primary File when you're working on a program that uses several unit (.TPU) or Include files.

No matter which file you've been editing, Make or Build always operates on your primary file.

If you specify another file as a primary file, but want to compile only the file in the active edit window, choose Compile.


Primary File dialog box

The Primary File dialog box is where you specify which .PAS file will be compiled when you choose Compile|Make or Compile|Build.

File Name input box

This input box is where you enter the name of the .PAS file to be compiled, or the file-name mask for the Files list box.

Files list box

The Files list box lists the files in the current directory that match the input box file-name mask, plus the parent directory and all subdirectories.

Directories list box

View the contents of different directories by selecting a directory name in the Directories list box.

You can also use shortcut keys (those underlined in the menu) to get to the area of the dialog box you want.

For example, press Alt+D to outline the first directory in the Directories list box.


File Name input box (Primary File dialog box)

The File Name input box is where you enter the name of the .PAS file to be compiled when you choose Make or Build, or the file-name mask for the Files list box.

Once the primary file is named, the file is listed beside the Primary File command on the Compile menu.

This input box has a history list attached to it.


Files list box (Primary File dialog box)

The Files list box lists the names of files in the current directory that match the file-name mask in the File Name input box, plus the parent directory and all subdirectories.

To assign a primary file, select the file name (click it or move the cursor to it), then choose OK.


Directories list box (Primary File dialog box)

The Directories list box lists the names of directories and drives available to you.

To work with directories, press Alt+D. The first directory in the Directories list box will be outlined.

Double-click directories in the Directories list box to change to the correct directory.

If you're using your keyboard, use the arrow keys to select the directory or drive you want to open and choose OK or press Enter.

If you see and double-click the [..] symbol, you'll change to the parent directory of the current subdirectory.


Clear Primary File

The Compile|Clear Primary File command removes the name of the primary file you specified with the Compile|Primary File command.

If a primary file hasn't been specified, the command is disabled.


Compile|Information

The Compile|Information command displays the Compile Information box, which tells the name of your primary file (if you have one) and the name of the last file compiled.


Compile|Information dialog box
Compile Information box

The Compile Information box lists:

-	the name of the primary file (if you have one)

-	the name of the last file compiled

-	the source compiled

-	code size

-	data size

-	stack size

-	local heap size


Turbo Pascal Control menu

The Turbo Pascal Control-menu box is on the far left of the title bar. Click it once or press Alt+Spacebar to display the menu.

The commands that appear on this menu affect the Turbo Pascal desktop.

Each Edit window and dialog box also has a Control menu.

The Turbo Pascal Control menu commands are:

Restore

Move

Size

Minimize

Maximize

Close

Switch to


Turbo Pascal Control|Restore

When you choose the Restore command, the Turbo Pascal desktop window returns to its previous size.

This command is available only if the Turbo Pascal desktop window is maximized or minimized.


Turbo Pascal Control|Move

The Move command moves the Turbo Pascal desktop window with your keyboard.

Use your arrow cursor keys to move it and press Enter when you are done.

You cannot use this command if the Turbo Pascal desktop is maximized.

You can also move the window by dragging its title bar.


Turbo Pascal Control|Size

With your keyboard, you can change the size of the Turbo Pascal desktop window with the Size command.

Use your arrow cursor keys to move the window borders. Press Enter when you are satisfied with the window size.

Size is available only if the Turbo Pascal desktop is not maximized.


Turbo Pascal Control|Minimize

Selecting the Minimize command turns the Turbo Pascal desktop into the Turbo Pascal icon.

You can choose this command only if the Turbo Pascal desktop window has not been minimized already.


Turbo Pascal Control|Maximize

If you choose the Maximize command, the Turbo Pascal desktop zooms to fill your entire screen.

You can choose this command only if the Turbo Pascal desktop window has not been maximized already.


Turbo Pascal Control|Close

The Close command closes the Turbo Pascal desktop and unloads Turbo Pascal from memory.

 -	In CUA mode, press Alt+F4 to close the desktop.

 -	In Alternate mode, press Alt+X to close the desktop.

You can also click the close box in the upper left corner to close the window.

If you have modified an edit window and not saved the file, a Turbo Pascal dialog box appears asking you if you want to save the file before closing.


Turbo Pascal dialog box

The Turbo Pascal dialog box asks if you want to save the file before closing.

 -	Choose Yes if you want to save the file before closing.

 -	Choose No if you do not want to save the file before closing.

 -	Choose Cancel to cancel the operation and return to your active edit window.


Turbo Pascal Control|Switch To

The Switch To command displays the Task List dialog box where you can switch from one application to another and rearrange application windows.


Task List dialog box

You use the Task List dialog box to switch to another application and rearrange application windows.

Task List list box

All open applications are listed in this box.


Task List list box

The Task List list box lists all open applications.

If the application you want is in the list box, double-click on it to choose it.

From the keyboard:

 -	Press the Up or Down arrow keys to reach the application you want.

 -	Press Enter to choose it.

 -	Then switch to the application and rearrange windows with Action Buttons.


Action Buttons

Action buttons are used to switch to another application and rearrange application windows.

 -	With the mouse, click the action button you want.

 -	If you're using the keyboard, press Tab to go to the action button, then press Enter.

Switch To

The Switch To button switches to another application in the list box.

End Task

The End Task button closes the selected application in the list box.

Cascade

The Cascade button arranges the application windows in an overlap style.

Tile

The Tile button arranges the application windows in a tile fashion (side-by-side).

Arrange Icons

The Arrange Icons button evenly spaces the icons across the bottom of the desktop.


Edit Window Control menu

Each edit window also has a Control menu when the window is active.

The commands on this menu are similar to those on the Turbo Pascal Control menu.

These are the commands available on the Edit Window Control menu:

Restore

Move

Size

Minimize

Maximize

Close

Next


Edit Window Control|Restore

The Restore command returns your edit window to its default size (which is neither maximized nor minimized).


Edit Window Control|Move

You use the Move command to move your edit window with keyboard commands.

After you select Move, use your arrow cursor keys to move the window. When satisfied, press Enter.

Move is available only if your edit window is not maximized.

You can also move a window by dragging its title bar.


Edit Window Control|Size

With your keyboard, you can change the size of your edit window.

After choosing Size, use your arrow cursor keys to move the window borders. When you are satisfied, press Enter.

Size is available only if your edit window is not maximized or minimized.

If a window has a Resize corner, you can drag that corner to resize the window.


Edit Window Control|Minimize

Select the Minimize command to shrink your edit window to an icon on the Turbo Pascal desktop.

You can select this command only if the window has not been minimized already.


Edit Window Control|Maximize

Choosing the Maximize command zooms your edit window so that it fills the Turbo Pascal desktop.

You can select this command only if the window has not been maximized already.


Edit Window Control|Close

The Close command closes your edit window.

You can also double-click the Close box in the upper left corner to close a window.

If you have modified text in the window and have not saved the text, a Turbo Pascal dialog box appears asking if you want to save the file before closing.


Edit Window Control|Next

The Next command makes the next open window or icon active.


Edit menu

The Edit menu provides commands to undo, redo, cut, copy, paste, and clear text in edit windows.

You can also open a Clipboard window to view or edit its contents.

You can choose from these Edit menu commands:

Undo

Redo

Cut

Copy

Paste

Clear


Edit|Undo

The Undo command "undoes" your most recent edit or cursor movement.

Undo inserts any characters you deleted, deletes any characters you inserted, replaces any characters you overwrote, and moves your cursor back to a prior position.

If you undo a block operation, your file will appear as it was before you executed the block operation.

If you continue to press Undo, it continues to undo the changes you made during the current editing session.

The Undo command will not change an option setting that affects more than one window.

The Group Undo option in the Options| Preferences dialog box affects how Undo and Redo behave.


Edit|Redo

Redo reverses the effect of the most recent Undo command.

It is effective only immediately after an Undo or another Redo.

A series of Redo commands reverses the effects of a series of Undo commands.


Edit|Cut

The Cut command removes the selected text from your document and places the text in the Clipboard.

You can then choose Edit|Paste to paste the cut text into any other document (or somewhere else in the same document).

The text remains selected in the Clipboard so you can paste it as many times as you want.


Edit|Copy

The Copy command leaves the selected text intact but places an exact copy of it in the Clipboard.

To paste the copied text into any other document, choose Edit Paste.

You can also copy text from a Help window:

 -	From the keyboard, press Shift and an arrow key to select the text you want to copy.

 -	With the mouse, click and drag the text you want to copy.


Edit|Paste

The Paste command inserts the selected text from the Clipboard into the current window at the cursor position.


Edit|Clear

The Clear command removes the selected text but does not put it into the Clipboard.

This means you can't paste the text as you could if you had chosen Cut or Copy.

Although you can't paste the cleared text, you can undo the Clear command with Undo.

Clear is useful if you want to delete text, but you don't want to overwrite text held in the Clipboard.


File menu

The File menu offers choices for creating new files, opening and loading existing files, saving files, printing files, and exiting Turbo Pascal.

New

Open

Save

Save As

Save All

Print

Printer Setup

Exit

List of closed files


File|New

New opens a new Edit window with the default name NONAMExx.PAS (the xx stands for a number from 00 to 99) and automatically makes the new Edit window active.

These NONAME files are used as a temporary edit buffer.

Turbo Pascal prompts you to name a NONAME file when you save it.


File|Open

The Open command displays the File Open dialog box.

In this dialog box, you select the file you want to open.

In Alternate mode, press F3 to open a file.


File Open dialog box
File|Open dialog box

The File|Open dialog box is where you open a file by typing the file name in the input box or using the list boxes to find and open the file.

File Name input box

The File Name input box is where you enter the name of the file to load, or the file-name mask to use as a filter for the Files list box.

Files list box

The Files list box lists the names of files in the current directory that match the file-name mask in the File Name input box, plus the parent directory and all subdirectories.

Directories list box

You view the contents of different directories by selecting a directory name in the Directories list box.

You can also use shortcut keys (those underlined on your screen) to get to the area of the dialog box you want.

For example, pressing Alt+D outlines the first directory in the Directories list box.


File Name input box

The File Name input box is where you enter the name of the file to load, or the file-name mask to use as a filter for the Files list box.

This input box has a history list attached to it.

To open a file you can choose any of these actions:

-	Type in a file name (if the file isn't in your current directory, include the full path name) and choose OK or press Enter

-	Type in a file name with * and ? wildcards, which filters the files list to match your specifications when you choose OK or press Enter

-	Press Alt+Down arrow or click the drop-down arrow in the input box to choose a file from the history list

-	Press the Down arrow when you're in the box to see previous entries

-	Press the Up arrow when you're in the box to move backwards through the list

The default file name, *.PAS, displays all files with a PAS extension in the Files List box.

If you enter another wildcard pattern, Turbo Pascal remembers it the next time you bring up the Open File dialog box during the same session.


Files list box

The Files list box lists the names of files in the current directory that match the file-name mask in the File Name input box, plus the parent directory and all subdirectories.

If the file you want to open is listed in the list box, double-click on it to open the file.

If you're using the keyboard, Tab to the Files list box and use the Up or Down arrow to reach the file you want to open. Press Enter to open the file.

Press the Spacebar or an arrow key to select the first item. Press Enter to open the item.


Directories list box

The Directories list box lists the names of directories and drives available to you.

To work with directories, press Alt+D. The first directory in the Directories list box will be outlined.

Double-click directories in the Directories list box to change to the correct directory.

If you're using your keyboard, use the arrow keys to select the directory or drive you want to open and choose OK or press Enter.

If you see and double-click the [..] symbol, you'll change to the parent directory of the subdirectory you're in.


File|Save

The Save command saves the file in the active Edit window to disk.

If the file has a default name (such as NONAME00.PAS), Turbo Pascal opens the File Save As dialog box so you can rename the file and save it in a different directory or on a different drive.

If you use an existing file name to name the file, Turbo Pascal asks if you want to overwrite the existing file.

If you want to save all modified files, not just the file in the active Edit window, choose File|Save All.

In Alternate mode, press F2 to save a file.


File Save As dialog box

The File Save As dialog box is where you type in the new name in the File Name input box (you can include a drive and directory path) or use the Directories list to select a new path.

If you choose an existing file name, Turbo Pascal asks if you want to overwrite the existing file.


File|Save As

Save As opens up the File Save As dialog box, where you can save the file in the active Edit window under a different name, in a different directory, or on a different drive.

You can enter the new file name, including the drive and directory.

All windows containing this file are updated with the new name.

If you choose an existing file name, Turbo Pascal asks if you want to overwrite the existing file.


File|Save All

Save All saves all files in open Edit windows.


File|Print

The Print command prints the contents of the active Edit window.

Turbo Pascal expands tabs (replaces any tab characters with the appropriate number of spaces) and prints the file.

The Print command is disabled if the active window can't be printed.


File|Printer Setup

The Printer Setup command displays the Select Printer dialog box where you select which printer you want to use for printing with Turbo Pascal.

If you don't want to make any changes to the way your printer is normally configured, you don't need to use Printer Setup.


Select Printer dialog box

With the Select Printer dialog box, you can select any of the printers listed.

If you want to set options specific to the printer you chose, choose Set Up.

Some printer drivers have their own help. You will see a Help button if this is so. Choose Help for more information about setting up your printer.

If you need more help or there is no help for the printer driver you are using, read the Configuring a Printer section in the "Control Panel" chapter of the Microsoft Windows User's Guide.

Printer and Port list box

The Printer and Port list box lists the Windows-installed printer drivers.

Set Up dialog box

The Set Up dialog box contains printer set-up options. The options available depend on the capabilities of your printer.


Printer and Port list box

The Printer and Port list box lists the Windows-installed printer drivers.

Press Alt+Down arrow to display the list of installed printer drivers.


Set Up dialog box

The Set Up dialog box contains printer options that are specific to the printer that you already chose in the Select Printer dialog box.


File|Exit

The Exit command exits Turbo Pascal and removes it from memory.

If you've modified a source file without saving it, Turbo Pascal prompts you to do so before exiting.

 -	In CUA mode, press Alt+F4 to exit.

 -	In Alternate mode, press Alt+X to exit.


File|(List of closed files)
List of closed files (File menu)

If you close a file during your editing session (by pressing Ctrl+F4), those closed files are listed at the bottom of the File menu so you can quickly reopen them.

Choose the file name at the bottom of the menu to reopen the file.


Open dialog boxes

An Open dialog box is where you open a file by typing the file name in the input box or using the list boxes to find and open the file.

File Name input box

The File Name input box is where you enter the name of the file to open.

Files list box

The Files list box lists the names of files in the current directory that match the file-name mask in the File Name input box, plus the parent directory and all subdirectories.

Directories list box

You view the contents of different directories by selecting a directory name in the Directories list box.

You can also use shortcut keys (those underlined on your screen) to get to the area of the dialog box you want.

For example, pressing Alt+D outlines the first directory in the Directories list box.


Save As dialog boxes

A Save As dialog box is where you enter the new name of the file that you are saving.

File Name input box

This is where you enter the file's new name.

A history list is attached to the File Name input box.

Directories list box

Use the Directories list box to change to another directory. Press Alt+D to place the cursor in the Directories list box.


Help Menu
Help menu   (Alt+H)

The Help menu provides access to online Help, which comes up in a special Help window.

The Help system provides information on virtually all aspects of the integrated environment and Turbo Pascal.

(Also, don't forget that one-line menu and dialog-box hints appear on the status line whenever you select a menu command or dialog box item.)

These are the Help menu commands:

Index

Topic Search

Using Help

Compiler Directives

ObjectWindows

Procedures and Functions

Reserved Words

Standard Units

Turbo Pascal Language

Windows API

About Turbo Pascal


Help|Index
Help|Index   (Shift+F1)

Turbo Pascal's online Help comes with a comprehensive index that summarizes the organization and contents of the Help system.

To get into the Help system from the index, choose one of the highlighted words or phrases in the index: click it, or Tab to it and then press Enter.

If you don't know how to use a Help system under Windows, choose the Help|Using Help menu command.


Help|Topic Search
Help|Topic Search   (Ctrl+F1)

If you place your cursor on a word (a "token") in the active Edit window and choose Help|Topic Search, a Help window opens with information about that token.

You can set up the Right mouse button (in the Options|Preferences dialog box) to do a topic search.

Help provides online reference for many elements of the Turbo Pascal language: functions and procedures, reserved words, global variables, ObjectWindows, the Windows API, and so on.


Help|Using Help

The Help|Using Help command displays information on how to use Turbo Pascal's Help system (or any other Help system under Windows).


Help|About Turbo Pascal

When you choose the Help|About Turbo Pascal command, a dialog box appears, showing copyright and version information.

Press Esc, click OK, or click Cancel to close the box.


OK Button

Press Enter or click the OK button to put this message window away and get into the Turbo Pascal environment.


Help|Compiler Directives

When you choose this menu command, you'll see an index of compiler directives.

Compiler directives control some of Turbo Pascal's features.

-	Some turn compiler features on or off.

-	Some specify parameters that affect how your program is compiled.

-	Others control the conditional compilation of your program.

A compiler directive is a comment with a special syntax you can put in your program anywhere a comment is allowed.

See Also

Index of Compiler Directives


Help|ObjectWindows

When you choose this menu command, you'll see a hierarchy of ObjectWindows types.

ObjectWindows is a Pascal object-oriented class library that simplifies the task of programming for Windows.

See Also

Index of ObjectWindows Objects (alphabetical)

ObjectWindows Object Hierarchy


Help|Procedures and Functions

When you choose this menu command, you'll see an index of all the Turbo Pascal  library procedures and functions you can use to write your programs.

See Also

Index of Turbo Pascal Procedures and Functions


Help|Reserved Words

When you choose this menu command, you'll see an index of all the reserved words in the Turbo Pascal language.

Reserved words have special meaning to the compiler. You should not use a reserved word to name your variables, procedures, functions, objects, and so on.


Help|Standard Units

When you choose this menu command, you'll see an index of Turbo Pascal's standard units.

A standard unit is a collection of predefined constants, data types, variables, procedures, and functions. You tell your program to use only the units it needs.

See Also

Turbo Pascal's Standard Units


Help|Turbo Pascal Language

When you choose this menu command, you'll see a list of the elements that make up the Turbo Pascal language.

See Also

Index of Turbo Pascal Language Elements


Help|Windows API

When you choose this menu command, you'll see an index to the constants, styles, messages,  types, functions, and procedures that make up the Windows Application Programming Interface (API).

Turbo Pascal declares all the Windows styles, constants, and types in the WinTypes unit. The WinProcs unit has all the API procedures and functions.

See Also

Index of Turbo Pascal's MS-Windows API


Options menu

The Options menu contains commands for viewing and changing various default settings in Turbo Pascal. Most of the commands in this menu lead to a dialog box.

Compiler

Linker

Directories

Preferences

Open

Save

Save As


Options|Compiler

The Options|Compiler command displays the Compiler Options dialog box, where you choose options that affect code compilation.


Compiler Options dialog box

Options

These compiler options tell Turbo Pascal how to compile your code.

Range Checking

Stack Checking

I/O Checking

Force Far Calls

Debug Information

Local Symbols

286 Code

80x87 Code

Windows Stack Frame

Extended Syntax

Align Data options

The Align Data radio buttons (Word or Byte) set options to align non-character data.

String Var Checking options

The String Var Checking radio buttons (Strict or Relaxed) set options for string parameter error-checking.

Boolean Evaluation options

The Boolean Evaluation radio buttons (Short Circuit or Complete) set options for evaluating terms in Boolean expressions.

Memory Sizes input boxes

The Memory Sizes input boxes (Stack Size and Heap Size) specify the size of the stack segment and local heap for local window allocations.

Conditional Defines input box

The Conditional Defines input box is where you define symbols to be referenced in conditional compilation directives.


Range Checking option

When Range Checking is on, the compiler generates code to check that array and string subscripts are within bounds, and that assignments to scalar-type variables don't exceed their defined ranges.

If the check fails, the program halts with a run-time error.

When Range Checking is off, no such code is generated.

Range Checking is equivalent to $R.

See Also

Compiler Options dialog box


Stack Checking option

When this option is on, the compiler generates code to check that space is available for local variables on the stack before each call to a procedure or function.

If the check fails, the program halts with a run-time error.

When Stack Checking is off, no such code is generated.

Stack Checking is equivalent to $S.

See Also

Compiler Options dialog box


I/O Checking option

When I/O Checking is on, the compiler generates code to check for I/O errors after every I/O call. If the check fails, the program halts with a run-time error.

When I/O Checking is off, no such code is generated. However, you can test for I/O errors with the system function IOResult.

I/O Checking is equivalent to $I.

See Also

Compiler Options dialog box


Force Far Calls option

When Force Far Calls is on (checked), all procedures and functions use the FAR call model.

If Force Far Calls is off, the compiler uses the NEAR call models for any procedures or functions within the file being compiled.

Force Far Calls is equivalent to $F.

See Also

Compiler Options dialog box


Debug Information option

When Debug Information is on, the compiler puts debug information into the executable file. This information consists of a line-number table for each procedure that maps object code addresses into source text numbers.

You'll usually use the Debug Information option with the local symbols option.

You must turn on Options|Linker|Debug Info in Exe or the compiler ignores this option's setting.

Debug Information is equivalent to $D.

See Also

Compiler Options dialog box


Local Symbols option

When the Local Symbols option is on, the compiler can generate local symbol information.

Local symbol information consists of the names and types of all local variables and constants in a module:

-	the symbols in the module's implementation part; and

-	the symbols within the module's procedures and functions

If the Local Symbols option is on, Turbo Debugger uses the symbol names for debugging, which makes debugging much easier.

Turning off this option frees more memory for your compiles, but local symbols won't be available for use by a debugger.

NOTE: The Local Symbols option is ignored if  the Option|Compiler|Debug Information and the Options|Linker|Debug Info in EXE options are off.

Local Symbols is equivalent to $L.

See Also

Compiler Options dialog box


286 Code option

When the 286 Code option is off, the compiler generates only 8086 instructions that can run on any processor in the 80x86 family.

When the option is on, the compiler uses the additional 80286 instructions to improve code generation, but the resulting program won't be able to run on 8088 or 8086 processors.

A program compiled with this option on does not check for the presence of an 80286 at run time.

The 286 Code option is equivalent to $G.

See Also

Compiler Options dialog box


80x87 Code option

The 80x87 Code option specifies how you want Turbo Pascal to handle floating point numbers.

When the 80x87 Code option is on, Turbo Pascal does not generate direct 8087 or 80287 inline code that requires an 80x87 coprocessor to run.

When this option is off, Turbo Pascal  does generate direct 8087 or 80287 inline code that requires an 80x87 coprocessor to run. (Default = Off)

You can use all Real types with this option, such as:

Single

Double

Extended

Comp

See Also

Compiler Options dialog box


Windows Stack Frame option

When the Windows Stack Frame option is on, the compiler generates special prolog and epilog code for programs that run in Windows 3.0 real mode.

Turn this option off if you want your program to run in protected mode only.

Windows Stack Frame is equivalent to $W.

See Also

Compiler Options dialog box


Extended Syntax option

When the Extended Syntax option is on, Turbo Pascal's syntax is extended so you can use user-defined function calls as statements, as if they were procedures.

When Extended Syntax is off (it's disabled), attempting to use these extensions results in an error.

Extended Syntax is equivalent to $X.

See Also

Compiler Options dialog box


Align Data options

The Align Data options align non-character data at even or odd addresses. Word alignment increases the speed with which 8086 and 80286 processors fetch and store the data. Align Data is equivalent to $A.

Word

The Word option aligns the data at even addresses only.

Byte

The Byte option aligns data at the next available address whether the address is odd or even.

See Also

Compiler Options dialog box


String Var Checking options

With the String Var Checking options, you can choose between Strict or Relaxed parameter-error checking. String Var Checking is equivalent to $V.

Strict

When the Strict option is on, Turbo Pascal compares the formal var-type string parameter with the actual parameter being passed. If they are not identical, a compiler error is issued.

Relaxed

When the Relaxed option is on, this type-checking does not occur.

Any string type variable is allowed as an actual parameter, even if the declared maximum length is not the same as that of the formal parameter.

See Also

Compiler Options dialog box


Boolean Evaluation options

With the Boolean Evaulation options, you can choose either short circuit or complete Boolean expression evaluation. Boolean Evaluation is equivalent to $B.

Short Circuit

When the Short Circuit option is on, the compiler generates code to terminate evaluation of a Boolean expression as soon as possible.

For example, in the expression

   if False and MyFunc...

the function MyFunc would never be called.

Complete

When the Complete option is on, the compiler evaluates all terms in Boolean expressions.

See Also

Compiler Options dialog box


Memory Sizes options

The Memory Sizes options consist of two input boxes where you specify the size of the stack segment and the local heap. Memory-size settings can also be specified in your source code with the $M compiler directive.

Stack Size input box

Use the Stack Size input box to specify the size of the stack segment.

Heap Size input box

Use the Heap size input box to specify the size of the local heap for local window allocations.

See Also

Compiler Options dialog box


Stack Size input box

The Stack Size input box is where you enter the the size of the stack segment (in bytes).

-	Default = 8192 bytes

-	Maximum size = 65536 bytes

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered sizes.


Heap Size input box

The Heap Size input box is where you enter the size (in bytes) of the local heap for local window allocations.

-	Default = 0 bytes

If you attempt to run your program and there is not enough heap space to satisfy the specified requirement, the program aborts with a run-time error.

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered sizes.


Conditional Defines input box

The Conditional Defines input box is where you enter define symbols that are referenced in conditional compilation directives.

You can separate multiple defines with semicolons. For example,

TestCode;DebugCode

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered symbols.

See Also

Compiler Options dialog box


Options|Linker

The Options|Linker command displays the Linker Options dialog box, where you choose options governing how your program files are linked.


Linker Options dialog box

The Linker Options dialog is where you choose options governing how your program files are linked.

Map File options

The Map File options (Off, Segments, Publics, and Detailed) determine the type of map file produced.

Link Buffer File options

The Link Buffer File options (Memory or Disk) specify the location of the link buffer.

Debug Info in EXE option

The Debug Info in EXE option puts debug information in your program's executable file.


Map File options

You use the Map File options to choose the type of map file to be produced at link time. For options other than Off, the map file is placed in the EXE and TPU directory defined in the Options|Directories dialog box.

-	The Map File options produce complete debugging information for a module only if that module has been compiled with the Options|Compiler|Debug Information option checked.

-	The Map File options produce local symbol information for a module only if that module has been compiled with the Local Symbols option checked.

Off

When the Off option is on, the linker does not create a map file.

Segments

When the Segments option is on, the linker produces a map file that includes a list of segments, the program start address, and any warning or error messages produced during the link. This is equivalent to the /GS command-line option.

Publics

When the Publics option is on, the linker produces the same map file that Segments produces, with a list of public symbols added (sorted alphabetically). This is equivalent to the /GP command-line option.

Detailed

When the Detailed option is on, the linker produces the same map file that Publics produces, with a detailed segment map added. This is equivalent to the /GD command-line option.

The detailed segment map includes the address, length in bytes, segment name, group, and module information.

See Also

Linker dialog box


Link Buffer File options

The Link Buffer options tell Turbo Pascal to use memory or disk space for the link buffer. This is equivalent to the /L command-line compiler option.

You might need to consider tradeoffs between speed and memory consumption when choosing one of these options.

Memory

When the Memory option is on, linking speeds up, but you might run out of memory for large programs.

Disk

Turning the Disk option on frees up memory, but slows the linking process.

See Also

Linker dialog box


Debug Info option
Debug Information in EXE option

When the Debug Info in EXE option is on, the linker puts debug information in your program's executable file. It also makes your programs larger. This is equivalent to the /V command-line compiler option.

Make sure you turn on this option if you are debugging your program with Turbo Debugger for Windows.

See Also

Linker dialog box


Options|Directories

This command opens the Directories dialog box, where you specify the directories Turbo Pascal uses when running and storing your programs.


Directories dialog box

With the options in this dialog box, you tell Turbo Pascal where to find the files it needs to compile, link, and output executable files.

EXE and TPU Directory input box

The EXE and TPU Directory input box specifies the directory that stores your .EXE and .TPU (object code) files.

Include Directories input box

The Include Directories input box specifies the directories that contain your standard Include files.

Unit Directories input box

Unit Directories specifies the directories that contain your Turbo Pascal unit files.

Object Directories input box

Object Directories specifies the directories that contain your .OBJ files (assembly language routines).

Resource Directories input box

Resource Directories specifies the directories where you keep your resource files.

See Also

Guidelines for entering directory names


Guidelines for Entering Directories
Guidelines for Entering Directory Names

Use the following guidelines when entering directories in the Options|Directories input boxes:

-	You must separate multiple directory path names (if allowed) with a semicolon (;).

-	You can use up to a maximum of 127 characters (including whitespace).

-	Whitespace before and after the semicolon is allowed but not required.

-	Relative and absolute path names are allowed, including path names relative to the logged position in drives other than the current one.

For example,

C:;C:;A:TPW

C:\;C:\TPW;A:\TPW


EXE and TPU Directory input box

This input box specifies the directory that stores your .EXE and .TPU (object code) files. If this input box is blank, your .EXE and .TPU files are stored in the directory where your source code is. This is equivalent to the /E command-line option.

If the Map File option is set to anything other than Off, .MAP files are also stored in this directory.

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered directory names.

See Also

Guidelines for entering directory names

Directories dialog box


Include Directories input box

This input box specifies the directories that contain your standard Include files.

This is equivalent to the /I command-line option.

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered directory names.

See Also

Guidelines for entering directory names

Directories dialog box


Unit Directories input box

This input box specifies the directories that contain your Turbo Pascal unit files. This is equivalent to the /U command-line option.

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered directory names.

See Also

Guidelines for entering directory names

Directories dialog box


Object Directories input box

This input box specifies the directories that contain your .OBJ files (assembly language routines).

This is equivalent to the /O command-line option.

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered directory names.

See Also

Guidelines for entering directory names

Directories dialog box


Resource Directory input box
Resource Directories input box

This input box specifies the directories that contains your resource files. This is equivalent to the /R command-line option.

Click the down-arrow icon or press Alt+Down arrow to display the history list of previously entered directory names.

See Also

Guidelines for entering directory names

Directories dialog box


Preferences dialog box
Options|Preferences

The Options|Preferences menu command leads to the Preferences dialog box, where you make some choices about the behavior and physical appearance of the Turbo Pascal environment.


Options|Preferences
Preferences dialog box

The Preferences dialog box is where you make some choices about the behavior and physical appearance of the Turbo Pascal environment.

Editor Options

The Editor Options group has several check boxes that control text handling in edit windows.

Create Backup File

Auto Indent Mode

Use Tab Character

Optimal Fill

Backspace Unindents

Cursor through Tabs

Group Undo

Block Overwrite

Auto Save options

The Auto Save options define when and how often Turbo Pascal saves information about your open files, settings, and options.

Editor Files

Desktop

Configuration

Font list box

The Font list box changes the size and appearance of the text when you select a new font displayed in the list box.

Tab Size input box

The Tab Size input box controls how many columns the cursor moves for each tab stop.

Right Mouse Button options

The Right Mouse Button options (Nothing or Topic Search) determine whether or not Turbo Pascal uses the right button to perform a topic search in Help.

Command Set options

The Command Set options (CUA or Alternate) determine if your editor uses Common User Access (CUA) or Alternate commands.


Create Backup Files option

When the Create Backup Files option is on, Turbo Pascal automatically creates a backup of the source file in the active edit window when you choose File|Save, and gives the backup file the extension .BAK.

See Also

Preferences dialog box


Auto Indent Mode option

When the Auto Indent Mode option is on, pressing Enter in an edit window positions the cursor under the first nonblank character in the preceding nonblank line.

This feature can help you keep your program code more readable.

You can use Optimal Fill in conjunction with Auto Indent Mode.

See Also

Preferences dialog box


Use Tab Character option

When the Use Tab Character option is on, Turbo Pascal inserts a true tab character (ASCII 9) when you press Tab.

When this option is off, Turbo Pascal replaces tabs with spaces.

Tab Size determines the number of spaces used to replace a tab.

See Also

Preferences dialog box


Optimal Fill option

When the Optimal Fill option is on, Turbo Pascal begins every autoindented line with the minimum number of characters possible, using tabs and spaces as necessary.

This produces lines that have fewer characters than lines produced when Optimal Fill is not on.

For example, if Tab Size is set to 3 and you have these lines of code:

  begin

     if A <= B then

        DoSomething

the lines (with spaces shown as "b" and tabs shown as "T") will actually be as follows:

Without Optimal Fill            With Optimal Fill

  begin                 begin

  bbbif A <= B then     Tif A <= B then

  bbbbbbDoSomething      TTDoSomething

See Also

Preferences dialog box


Backspace Unindents option

When the Backspace Unindents option is on and the cursor is on a blank line (or on the first nonblank character of a line), the BACKSPACE key aligns (outdents) the line. (Default = On)

Outdenting aligns the line to the previous indentation level.

If the Backspace Unindents option is off,  the BACKSPACE key merely moves the cursor to the left one character each time you press it.

See Also

Preferences dialog box


Cursor through Tabs option

When the Cursor through Tabs option is on, the arrow keys move the cursor to the beginning of each tab.

When this option is off, the cursor jumps several columns when you move the cursor over multiple tabs.

See Also

Preferences dialog box


Group Undo option

With the Group Undo option on, if you press Alt+Backspace or choose Edit|Undo, the editor undoes your last group of editing commands.

With the Group Undo option off, the editor undoes only individual (ungrouped) editing commands when you press Alt+Backspace or choose Undo.

Insertions, deletions, overstrikes, and cursor movements are types of editing commands that can be grouped.

The Turbo Pascal editor sees inserting a carriage return (pressing Enter) as an insertion followed by a cursor movement.

The grouping of inserted characters halts when you press Enter because the type of editing has changed (you inserted characters, then moved the cursor).

This option also affects Edit|Redo.

Example

If Group Undo is on and you type OOPS then choose Undo, the entire word is deleted.

 -	If you select Redo after undoing OOPS, the entire OOPS group appears in the window all at once.

If Group Undo is off and you type OOPS, only the last typed character is undone when you choose Undo.

 -	You would need to choose Undo four times to undo the word OOPS. Only one letter will appear each time you choose Redo.

See Also

Preferences dialog box


Block Overwrite option

When the Block Overwrite option is on and a block of text is marked, typing a letter replaces the marked block with the letter typed.

If the Block Overwrite option is off, typing a letter inserts that letter after the marked text.

See Also

Preferences dialog box


Auto Save options

The Auto Save options specify which files and options Turbo Pascal saves automatically.

Editor Files 	saves files in the active edit window.

Desktop 	saves the desktop setup when you exit.

Configuration 	saves the name of your primary file and all the settings made with the Options menu when you exit.

When you start another session, the options from the previous session are in effect.

See Also

Preferences dialog box


Editor Files option

When the Editor Files option is on, Turbo Pascal automatically saves the modified file in the active edit window when you choose Run|Run or Run|Debugger.

See Also

Preferences dialog box


Desktop option

When you turn the Desktop option on, Turbo Pascal saves your desktop setup when you exit.

When you start another sesssion, your desktop appears as you left it.

The settings are stored in the TPW.INI file.

See Also

Preferences dialog box


Configuration option

When the Configuration option is on, the name of your primary file and the settings made with the Options menu are saved when you exit Turbo Pascal.

When starting another session, all the options selected in the previous session are in effect.

The Configuration option directs the IDE to save your .CFG file in the directory specified in the primary file or in the same directory as the file in the active edit window.

You can create a configuration file with the Options|Open command.

See Also

Preferences dialog box


Font list box

You can change the size and appearance of the text by selecting a new font displayed in the Font list box.

Windows supplies a selection of screen fonts, and when you installed your printer, any screen fonts your printer uses were installed.

If you purchase additional fonts from a font or printer vendor, you may get additional screen fonts.

Turbo Pascal displays and uses only monospaced screen fonts, such as Courier.

Select the font you want. The new font takes effect when you choose OK.

See Also

Preferences dialog box


Tab Size input box

The Tab Size input box is where you dictate how many characters the cursor will move for each tab stop.

Enter a value between 2 and 16. (Default = 8)

To change the way Turbo Pascal displays tabs in a file, just change the Tab Size value to the size you prefer.

Turbo Pascal redisplays all tabs in that file at the new size you chose.

You can save this new tab size with the Options|Save command.

See Also

Preferences dialog box


Right Mouse Button options

By default, Turbo Pascal uses the right mouse button to perform a topic search.

Topic Search

When the Topic Search option is on and you press the right mouse button, a Help window displays language help about the token your cursor was on in the active edit window.

Nothing

If you don't want Topic Search active, select the Nothing option.

See Also

Preferences dialog box


Command Set options

The Command Set options determine if your editor uses Common User Access (CUA) or Alternate commands.

CUA

Common User Access commands are used by many Windows editors.

Alternate

Alternate commands are similar to those used by the editors in other Borland language products.

See Also

Preferences dialog box

Editor Commands


Options|Open command

The Options|Open command displays the Open Configuration File dialog box, where you can retrieve new configuration file settings.


Open Configuration File dialog box

The Open Configuration File dialog box is where you can retrieve new configuration file settings.

File Name input box

This input box is where you type in the name of the configuration file containing the settings you want; choose OK or press Enter to load that file.

The default configuration file name is TPW.CFG.

Files list box

The Files list box lists the names of files in the current directory that match the file-name mask in the File Name input box, plus the parent directory and all subdirectories.

Directories list box

The Directories list box is where you choose a different directory to view. Press Alt + D to put the cursor in this list box.


Options|Save command

The Options|Save command saves the primary file name, the settings you selected with the Options menu, and the desktop setup into your current configuration file.

Use Options|Save As to save options to a different configuration file. The name of your current configuration file appears next to the Options|Save command.

-	All options and the editor command table are stored in TPW.CFG, the default saved-options file.

-	History lists, the desktop state, and breakpoint locations are stored in TPW.INI.


Options|Save As command

The Options|Save As command opens the Configuration Save As dialog box, where you enter a new name for your configuration file.

You can create a new configuration file by setting options and then selecting Options|Save As and typing in a new configuration file name. The newly created configuration file will be the one that is in effect.


Configuration Save As dialog box

The Configuration Save As dialog box is where you enter the name of a new configuration file.

File Name input box

This is where you enter a new name for the configuration file. Choose OK or press Enter to create a .CFG file with the new name.

If you leave out the file extension, Turbo Pascal adds .CFG. For example, MY becomes MY.CFG.

A history list is attached to the File Name input box.

If the Configuration option is on, settings made to the current configuration file are saved when you exit.

Directories list box

Use the Directories list box to change to another directory. Press Alt+D to place the cursor in the Directories list box.


Run menu

The Run menu provides commands to run your program, start up Turbo Debugger for Windows, and specify command-line parameters.

These are the Run menu commands:

Run

Debugger

Parameters

Check the Options|Linker|Debug Info in EXE check box before you compile and link your program if you want to use the debugger on it.

The Debug Info in EXE option puts the necessary information in your executable file.


Run|Run

The Run|Run command runs your program, using any parameters you pass to it with the Run|Parameters command.

If the source code has been modified since the last compilation, the compiler will automatically do a make and link your program.


Run|Debugger

The Run|Debugger command starts up Turbo Debugger for Windows so you can debug your program.

Turbo Pascal tells Turbo Debugger which program to debug.

Check the Options|Linker|Debug Info in EXE check box before you compile and link your program if you want to use the debugger on it.

The Options|Linker|Debug Info in EXE check box puts the necessary debug information in your executable file.

To use Turbo Debugger's symbolic debugging capabilities to their fullest, you should also check the Options|Compiler|Debug Information box and the Options|Compiler|Local Symbols box before compiling your program.


Run|Parameters

The Run|Parameters command passes parameters to your program when you run it just as if you were running the program from the Program Manager's File|Run menu.

When you choose this command, the Parameters dialog box appears where you type in command-line arguments for your running programs.


Parameters dialog box

The Parameters dialog box is where you type in command-line arguments for your running programs.

Command Line Parameters input box

This input box is where you enter the parameters you want Turbo Pascal to pass to the running program.


Command Line Parameters input box
Command-Line Parameters input box

Enter the parameters you want Turbo Pascal to pass to your running program in this input box.

Parameters take effect only when your program is started.

You don't need to enter the program name in this input box.

You can use the history list that's attached to the Enter Command-Line Parameters input box to automatically re-enter parameters you've previously typed.

For a list of the command-line options, see the Command-Line Options Help screen.


Search menu

The Search menu provides commands to search for text and error locations in your files.

These are the Search menu commands:

Find

Replace

Search Again

Go to Line Number

Show Last Compile Error

Find Error


Search|Find

The Find command displays the Find Text dialog box, where you type in the text you want to search for.

You can set several options in this dialog box that affect the search.


Find Text dialog box

You use the Find Text dialog box to specify the text you want to search for.

Text to Find input box

This input box is where you enter the search string. Choose OK to begin the search, or choose Cancel to forget it.

Press the Down arrow key if you want to show the history list associated with the input box.

Find Text Options

This group of options governs the kind of strings that Turbo Pascal searches for.

Case Sensitive

Whole Words Only

Regular Expression

Direction options

Direction specifies which way you want Turbo Pascal to search, starting from the current cursor position. Forward (from the current position to the end of the file) is the default.

Scope options

Scope determines how much of the file Turbo Pascal searches in. Global (entire file) is the default scope.

Origin options

Origin specifies where the search should start.


Text to Find input box

The Text to Find input box is where you enter the search string.

To begin the search, choose OK; choose Cancel to forget it.

If you want to enter a string that you've searched for previously, press the Down arrow key to show the history list, then choose from that list.

You can also pick up the word that your cursor is currently on in the edit window and use it as the search string; simply invoke Find from the Search menu.


Case Sensitive option

When the Case Sensitive option is on, Turbo Pascal differentiates uppercase from lowercase when performing a search.

Case Sensitive Off is the default.


Whole Words Only option

When the Whole Words Only option is on, Turbo Pascal searches for words only.

When the Whole Words Only is off, the search might find the search string within longer words.


Regular Expression option

When the Regular Expression option is on, Turbo Pascal recognizes GREP-like wildcards in the search string.


GREP-like wildcards

The GREP-like wildcards are ^, $, ., *, +, [ ], [^], and [-]

 ^	A circumflex at the start of the string matches the start of a line.

 $	A dollar sign at the end of the expression matches the end of a line.

 .	A period matches any character.

 *	An asterisk after a character matches any number of occurrences (including zero) of that character. For example, bo* matches bot, b, boo, and also be.

 +	A plus sign after a character matches one or more occurrences (but not zero occurences) of that character. For example, bo+ matches bot and boo, but not b or be.

[ ]	Characters in brackets match any one character that appears in the brackets, but no others. For example [bot] matches b, o, or t.

[^]	A circumflex at the start of the string in brackets means NOT. Hence, [^bot] matches any characters except b, o, or t.

[-]	A hyphen within the brackets signifies a range of characters. For example, [b-o] matches any character from b through o.

  \  	A backslash before a wildcard character tells Turbo Pascal to treat that character literally, not as a wildcard. For example, \^ matches ^ and does not look for the start of a line.


Direction options

The Direction options specify the direction you want Turbo Pascal to search starting from the Origin setting.

Forward

The Forward radio button searches toward the end of the file. Forward is the default Direction setting.

Backward

The Backward radio button searches toward the beginning of the file.


Scope options

You use the Scope options to specify how much of the file you want to search in.

Global

The Global option searches the entire file, in the direction specified by the Direction setting. Global is the default scope.

Selected Text

The Selected Text option searches only in the block of marked text, in the direction specified by the Direction setting.

You can use the mouse or block commands to mark a block of text.


Origin options

The Origin options determine where the search begins.

From Cursor

The From Cursor option starts the search at the cursor's current position.

The search then proceeds either forward to the end of the scope, or backward to the beginning of the scope (depending on the Directionsetting).

Entire Scope

The Entire Scope option searches either the entire block of selected text or the entire file (no matter where the cursor is in the file).

The scope is defined by the Scope options.


Search|Replace

The Replace command displays the Replace Text dialog box, where you type in the text you want to search for and text you want to replace it with.


Replace Text dialog box

The Replace Text dialog box is where you specify the text to search for and what to replace it with.

Most components of the Replace Text dialog box are identical to those in the Find Text dialog box.

Text to Find input box

Enter the search string in the Text to Find input box and choose OK to begin the search, or choose Cancel to forget it.

Press the Down arrow key if you want to show the history list associated with the input box.

New Text input box

Enter the replacement string in the New Text input box.

You can also use the history list to the right of the box to select a string you've used previously.

Find Text options

This group of options governs the kind of strings that Turbo Pascal searches for, and whether the replacement is automatic.

Case sensitive

Whole words only

Regular expression

Prompt to Replace

Direction options

Direction specifies which way you want Turbo Pascal to search, starting from the current cursor position. Forward (from the current position to the end of the file) is the default.

Scope options

Scope determines how much of the file Turbo Pascal searches in. Global (entire file) is the default scope.

Origin options

Origin specifies where the search should start.

Replace All button

Choose Replace All if you want Turbo Pascal to replace all occurrences of the search string found, as defined by the Direction, Scope, and Origin options.


New Text input box

Type the text you want to search for in the Text to Find input box and type the text you want to replace it with in the New Text input box.

Click the down-arrow icon or press Alt+Down arrow to display the history list.


Prompt on Replace option

When the Prompt on Replace option is on, Turbo Pascal prompts you before replacing each time it finds the search string.

When Prompt on Replace is off, Turbo Pascal automatically replaces the search string.


Replace All button

Once you've entered the search string and the replacement string in the input boxes, you can choose OK or Replace All to begin the search; or choose Cancel to forget it.

If Turbo Pascal finds the specified text, it asks if you want to make the replacement.

-	If you chose Replace All, it asks you for every instance.

If you want to enter a search string you used previously, press the Down arrow key to show a history list to choose from.


Search|Search Again

The Search Again command repeats the last Find or Replace command.

The last settings made in the Find Text or Replace Text dialog box remain in effect when you choose Search Again.

In CUA mode, press F3 to search again.


Search|Go to Line Number

The Go to Line Number command displays the Go To Line Number dialog box, which prompts for the line number you want to find.

Turbo Pascal displays the current line number and column number in the lower left corner of every edit window.


Go to Line Number dialog box

The Go to Line Number dialog box consists of an input box with a history list, and the standard OK, Cancel, and Help buttons.

You use the Go to Line Number dialog box to find the line number you need.

Enter New Line Number input box

Type the number of the line you want, or pick a previously entered line number from the history list, then press Enter (or choose OK).


Enter New Line Number input box

The Enter New Line Number input box is where you specify which line of source code you want to go to.

You can enter and search for a specific line number in your file, or you can use the history list to select a previously used number.

Current line and column numbers for your file are displayed in the lower left corner of the Turbo Pascal desktop window.


Search|Show Last Compile Error

The Search|Show Last Compile Error command finds the location of the last compiler error. The cursor moves to the line that caused the error.

If the error isn't in the active window, Turbo Pascal makes the window with the last compiler error active, even opening a closed file if necessary.

The error number and message appear on the status bar.


Search|Find Error

The Search|Find Error command brings up the Find Error dialog box, where you specify the address of the most recent run-time error.


Find Error dialog box

The Find Error dialog box is where you specify the address of the most recent run-time error.

Error Address input box

This input box is where you type the address of the most recent run-time error.

When you choose OK, the compiler will recompile your program and stop at the address location you entered, highlighting the line that caused the run-time error to occur.


Error Address input box

The Error Address input box is where you type in the address of the run-time error you want to go to.

You can enter and search for a specific error address.


Window menu

The Window menu contains commands for manipulating and opening windows.

Most of the windows you open from this menu have all the standard window elements, like scroll bars, Minimize and Maximize buttons, and a Control menu box.

Open windows with the File|Open or File|New commands.

At the bottom of the Window menu is a list of open windows. If there is more than one, you can switch to another window and make it active by selecting it from the list.

These are the Window menu commands:

Tile

Cascade

Arrange Icons

Close All


Window|Tile

Choose Window|Tile to tile your open windows.

This option arranges the windows so they cover the entire desktop without overlapping one another.


Window|Cascade

Choose Window|Cascade to stack all open edit windows.

This option overlaps open windows so each is the same size as all others and only part of each underlying window is visible.


Window|Arrange Icons

Select Window|Arrange Icons to rearrange the icons.

Rearranged icons are evenly spaced, beginning at the lower left corner on the desktop.

The open files must be Minimized or this command is disabled.


Window|Close All

Choose Window|Close All to close all open windows on the desktop.

If text was modified since the last time you saved it, a dialog box asks if you want to save the file before closing the window. Choose Yes, No, or Cancel.


Window|(List of open windows)
List of open windows (Window menu)

At the bottom of the Window menu is a list of open windows.

If more than one window is open, you can switch to another window and make it active by choosing it (either click it in the list, or type the number associated with the window you want).


Input Box

The input box is where you do the following:

-	Type text in explicitly

-	Enter a word, phrase, file name, or project name with standard DOS * and ? wildcards

-	Enter a directory name

All the regular text-editing keys work in this box.

If you keep typing once you reach the end of the box, the contents automatically scroll so you can keep on typing.

If there is a Down-arrow icon to the right of the input box, a history list is attached to the input box.

Entering and Listing File Names

-	If you enter the entire file name and then press Enter, Turbo Pascal opens that file.

-	If you enter a file name that Turbo Pascal can't find, it automatically creates and opens a new file with that name.

-	To filter names appearing in the Files list box, enter part of a file name or use DOS wildcards (* and ?).


Files List Box

The Files list box displays all these things:

-	All file names in the current directory that match the specifications in the input box

-	The parent directory

-	All subdirectories

To make the list box active, click it or press Tab until the list box name is highlighted.

The Files list box is updated to show the files in the directory you've currently chosen.

You can use the Up or Down arrow keys to move around and select a file name. Once you've found the file you want, press Enter or choose OK to open it.

You can also double-click any file name in the box to open that file. You might have to scroll the box to see all the names.

Another way to move between files listed in the Files list box is to type the first letter(s) of the file name you want to go to.

Above the Files list box is a file information panel that shows the selected file's path name and file name. (None of the items on this panel are  selectable.)

As you scroll through the list, the panel is updated for each file.


Edit Window
The Edit Window

Edit windows are where you type in and edit your Turbo Pascal code. You can also do the following in an edit window:

-	compile your programs

-	run your programs

-	read them from disk files

-	save them to disk files

You can open as many edit windows as you want, but Turbo Pascal only numbers the first nine windows (of any kind) you open.

Opening Edit Windows

To open an edit window, choose File|Open. You can open the same file in more than one window.

For More Information

Choose one of these for more information:

Using Turbo Pascal windows

Using the editor

Find dialog box (text search)

Replace dialog box

Edit menu

File Save command

File Save As command


Turbo Pascal's Windows

Most of what you see and do in the Turbo Pascal environment happens in a window.

A window is a bordered screen area that you can move, resize, maximize, rearrange, close, open, or shrink to an icon.

Turbo Pascal makes it easy to spot the active window; it always has these elements:

Control menu box

Title Bar

Scroll Bars

You can have up to 32 windows open in Turbo Pascal (memory allowing), but only one window can be active at any time. The active window is the one that you're currently working in.

Generally, any command you choose or text you type applies only to the active window. (But if you have the same file open in several windows, the action applies to the file in each of those windows.)

If your windows overlap, the active window is always the topmost one (the one on top of all the others).

The Turbo Pascal desktop window shows the cursor's position (the current line and column number) as YY:XX on the status bar, where YY is the line number and XX is the column number.


TApplication
TApplication     (WObjects unit)

TApplication provides the structure for all ObjectWindows applications.

All ObjectWindows applications will derive an object type from TApplication primarily to construct a main window of a user-defined object type.

Fields

HAccTable

KBHandlerWnd

MainWindow

Name

Status

Methods

Init

Done

CanClose

Error

ExecDialog

InitApplication

InitInstance

InitMainWindow

MakeWindow

MessageLoop

ProcessAccels

ProcessAppMsg

ProcessDlgMsg

ProcessMDIAccels

Run

SetKBHandler

ValidWindow


TApplication.HAccTable     (field)

Syntax

HAccTable: THandle;   (Read/Write)

Description

HAccTable holds a handle to a Windows accelerator table resource defined for the application.

See Also

TApplication


TApplication.KBHandlerWnd     (field)

Syntax

KBHandlerWnd: PWindowsObject;   (Read only)

Description

KBHandlerWnd points to the currently active window if that window's keyboard handler mechanism is enabled. This mechanism allows a window with controls to process keyboard input like a dialog.

KBHandlerWnd is nil if the mechanism is disabled for the active window.

See Also

TApplication


TApplication.MainWindow     (field)

Syntax

MainWindow: PWindowsObject;   (Read/Write)

Description

MainWindow points to the application's main, overlapped window, which should be instantiated by your application type's InitMainWindow method

See Also

TApplication


TApplication.Name     (field)

Description

Name holds the name of the application. This can be used internally by the application's code.

See Also

TApplication


TApplication.Status field
TApplication.Status     (field)

Syntax

Status: Integer;

Description

Status indicates the current state of the running application. It is running successfully if Status is greater than or equal to 0.

Error values include em_InvalidMainWindow for an invalid main window object.

See Also

TApplication


TApplication.Init     (method)

Syntax

constructor Init(AName: PChar);

Description

(Override: Sometimes)  Constructs the application object.

-	Calls TObject.Init.

-	Sets the global variable Application to @Self

-	Sets the Name field to AName

-	Sets the HAccTable field and the Status field to 0.

-	Initializes the MainWindow and the KBHandlerWnd fields to nil.

If this is the first running instance of this application, Init calls InitApplication. If InitApplication succeeds, InitInstance is called.

See Also

TApplication

TObject.Init


TApplication.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Sometimes)  Disposes of the application's owned objects by disposing MainWindow then calls TObject.Done to terminate the application.

See Also

TApplication


TApplication.CanClose     (method)

Syntax

function CanClose: Boolean; virtual;

Description

(Override: Seldom)  Returns True if it is OK for the application to close.

As a default, it calls the CanClose method of its main window and returns that method's return value.

This method will seldom be overridden; closing behavior can be overridden in the main window's CanClose method.

See Also

TApplication

TWindowsObject.CanClose

TWindowsObject.WMDestroy


TApplication.MakeWindow     (method)

Syntax

function MakeWindow(AWindowsObject: PWindowsObject): PWindowsObject; virtual;

Description

(Override: Never)  Attempts to create a window or modeless dialog element associated with the object, passed in AWindowsObject, after performing checks of safety pool usage.

If memory is low, or if the window or dialog cannot be created, MakeWindow disposes the object and returns nil.

If successful, it returns AWindowsObject.

See Also

TApplication

TWindow.Create


TApplication.Error     (method)

Syntax

procedure Error(ErrorCode: Integer); virtual;

Description

(Override: Sometimes)  Error processes errors identified by the error value passed in ErrorCode. These errors can be generated by the application object or by any window or dialog object.

ErrorCode can be one of the following errors detected and reported by ObjectWindows, or an error you define:

em_OutOfMemory

em_InvalidClient

em_InvalidChild

em_InvalidMainWindow

em_InvalidWindow

Error displays the error code in a message box and asks the user if it is okay to proceed. If not, program execution stops.

See Also

em_XXXX constants

TApplication


TApplication.ExecDialog     (method)

Syntax

function ExecDialog(ADialog: PWindowsObject): Integer; virtual;

Description

(Override: Never)  Executes the modal dialog object passed in ADialog, after checking ValidWindow, by calling the dialog object's Execute method.

If memory is low, or if the dialog cannot be executed, ExecDialog disposes the object and returns a negative error status.

See Also

TApplication

TDialog.Execute


TApplication.InitApplication     (method)

Syntax

procedure InitApplication; virtual;

Description

(Override: Sometimes)  Performs any initialization necessary only for the first executing instance of the application.

TApplication.InitApplication does nothing. Your application object type may override InitApplication to perform application-specific initialization.

See Also

TApplication


TApplication.InitInstance     (method)

Syntax

procedure InitInstance; virtual;

Description

(Override: Sometimes)  Performs any initialization necessary for every executing instance of the application.

TApplication.InitInstance calls InitMainWindow, and creates and shows the main window element by calling MakeWindow and TWindowsObject.Show.

If you override this method, be sure to explicitly call TApplication.InitInstance.

See Also

TApplication


TApplication.InitMainWindow     (method)

Syntax

procedure InitMainWindow; virtual;

Description

(Override: Always)  Override InitMainWindow to construct a main window object and store it in MainWindow.

Typical use:

procedure MyApplication.InitMainWindow;

begin

   MainWindow := New(PMyWindow, Init('Window Caption'));

end;

By default, InitMainWindow produces a generic TWindow object with no title.

See Also

TApplication


TApplication.MessageLoop
TApplication.MessageLoop     (method)

Syntax

procedure MessageLoop; virtual;

Description

(Override: Never)  Operates the application's general message loop which runs during the lifetime of the application.

TApplication.MessageLoop calls ProcessAppMsg to handle special messages for modeless dialogs, accelerators and MDI accelerators.

See Also

TApplication


TApplication.ProcessAppMsg     (method)

Syntax

function ProcessAppMsg(var Message: TMsg): Boolean; virtual;

Description

(Override: Sometimes)  Checks for special processing for modeless dialog, accelerator and MDI accelerator messages.

Calls ProcessDlgMsg, ProcessMDIAccels, and ProcessAccels, and returns True if any of these special messages are encountered.

If your application does not create modeless dialogs, does not respond to accelerators, and is not an MDI application, you can improve performance by overriding this method to simply return False.

See Also

TApplication


TApplication.ProcessDlgMsg     (method)

Syntax

function ProcessDlgMsg(var Message: TMsg): Boolean; virtual;

Description

(Override: Sometimes)  Handles special modeless dialog and window message processing for handling keyboard input for controls.

If your application creates no modeless dialogs or windows with controls, you can improve performance by overriding this method to simply return False.

See Also

TApplication


TApplication.ProcessAccels     (method)

Syntax

function ProcessAccels(var Message: TMsg): Boolean; virtual;

Description

(Override: Sometimes)  Handles special accelerator message processing.

If your application windows' do not respond to accelerators, you can improve performance by overriding this method to simply return False.

See Also

TApplication


TApplication.ProcessMDIAccels     (method)

Syntax

function ProcessMDIAccels(var Message: TMsg): Boolean; virtual;

Description

Handles special accelerator message processing for MDI-compliant applications.

If your application is not an MDI application, you can improve performance by overriding this method to simply return False.

See Also

TApplication


TApplication.Run     (method)

Syntax

procedure Run; virtual;

Description

(Override: Seldom)  Sets the application in motion by calling MessageLoop if initialization was successful.

See Also

TApplication


TApplication.SetKBHandler     (method)

Syntax

procedure SetKBHandler(AWindowsObject: PWindowsObject);

Description

(Override: Never)  Activates keyboard handling for the given value by setting KBHandlerWnd to AWindowsObject.

See Also

TApplication


TApplication.ValidWindow     (method)

Syntax

function ValidWindow(AWindowsObject: PWindowsObject):PWindowsObject;

Description

Determines whether AWindowsObject is a valid object. If it is valid, ValidWindow returns a pointer to it; otherwise it returns nil.

AWindowsObject is invalid if:

-	allocation of the object ate into the safety pool

-	the status field of AWindowsObject is non-zero

See Also

TApplication

TWindowsObject.Status


TBufStream
TBufStream     (WObjects unit)

TBufStream implements a buffered version of TDosStream. The additional fields specify the size and location of the buffer, together with the current and last positions within the buffer.

In addition to overriding the eight methods of TDosStream, TBufStream defines the abstract TStreamFlush method. The TBufStream constructor creates and opens a named file by calling TDosStream.Init, then creates the buffer with GetMem.

TBufStream is significantly more efficient than TDosStream when a large number of small data transfers take place on the stream, such as when loading and storing objects using TStream.Get and TStream.Put.

Fields

Buffer

BufSize

BufPtr

BufEnd

Methods

Init

Done

Flush

GetPos

GetSize

Read

Seek

Truncate

Write


TBufStream.Buffer     (field)

Syntax

Buffer: Pointer;   (Read only)

Description

A pointer to the start of the stream's buffer.

See Also

TBufStream


TBufStream.BufSize     (field)

Syntax

BufSize: Word;   (Read only)

Description

The size of the buffer in bytes.

See Also

TBufStream


TBufStream.BufPtr     (field)

Syntax

BufPtr: Word;   (Read only)

Description

An offset from the Buffer pointer indicating the current position within the buffer.

See Also

TBufStream


TBufStream.BufEnd     (field)

Syntax

BufEnd: Word;   (Read only)

Description

If the buffer is not full, BufEnd gives an offset from the Buffer pointer to the last used byte in the buffer.

See Also

TBufStream


TBufStream.Init     (method)

Syntax

constructor Init(FileName: FNameStr; Mode, Size: Word);

Description

Creates and opens the named file with access mode Mode by calling TDosStream.Init. Also creates a buffer of Size bytes with a GetMem call. The Handle, Buffer, and BufSize fields are suitably initialized. Typical buffer sizes range from 512 bytes to 2,048 bytes.

See Also

TBufStream

TDosStream.Handle


TBufStream.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Never)  Closes and disposes of the file stream; flushes and disposes of its buffer.

See Also

Flush

TBufStream


TBufStream.Flush     (method)

Syntax

procedure Flush; virtual;

Description

(Override: Never)  Flushes the calling file stream's buffer provided the stream is stOK.

See Also

Done

TBufStream


TBufStream.GetPos     (method)

Syntax

function GetPos: Longint; virtual;

Description

(Override: Never)  Returns the value of the calling stream's current position (not to be confused with BufPtr, the current location within the buffer).

See Also

Seek

TBufStream


TBufStream.GetSize     (method)

Syntax

function GetSize: Longint; virtual;

Description

(Override: Never)  Flushes the buffer then returns the total size in bytes of the calling stream.

See Also

TBufStream


TBufStream.Read     (method)

Syntax

procedure Read(var Buf; Count: Word); virtual;

Description

(Override: Never)  If stOK, reads Count bytes into the Buf buffer starting at the calling stream's current position.

Note that Buf is not the stream's buffer, but an external buffer to hold the data read in from the stream.

See Also

stXXXX constants

TBufStream

Write


TBufStream.Seek     (method)

Syntax

procedure Seek(Pos: Longint); virtual;

Description

(Override: Never)  Flushes the buffer then resets the current position to Pos bytes from the start of the calling stream. The start of a stream is position 0.

See Also

GetPos

TBufStream


TBufStream.Truncate     (method)

Syntax

procedure Truncate; virtual;

Description

(Override: Never)  Flushes the buffer then deletes all data on the calling stream from the current position to the end. The current position is set to the new end of the stream.

See Also

GetPos

Seek

TBufStream


TBufStream.Write     (method)

Syntax

procedure Write(var Buf; Count: Word); virtual;

Description

(Override: Never)  If stOK, writes Count bytes from the Buf buffer to the calling stream, starting at the current position.

Note that Buf is not the stream's buffer, but an external buffer to hold the data being written to the stream. When Write is called, Buf will point to the variable whose value is being written.

See Also

Read

stXXXX constants

TBufStream


TButton
TButton     (WObjects unit)

TButton is an interface object that represents a corresponding push button element in Windows.

TButton objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used when you want to display a standalone button as a child window in another window's client area.

There are two types of push buttons:

 -	A regular button appears with a thin border.

 -	A default button appears with a thick border and represents the default action of the window.

There can only be one default push button in a window.

Methods

Init

InitResource

GetClassName


TButton.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnId: Integer; AText: PChar; X,Y,W,H: Integer; IsDefault: Boolean);

Description

Constructs a button object with the:

-	passed parent window (AParent)

-	control ID (AnId)

-	associated text (AText)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H).

Calls TControl.Init and then adds bs_DefPushButton to the Attr.Style field if IsDefault is True, else adds bs_PushButton.

See Also

bs_ Button styles

TButton


TButton.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject, ResourceID: Word);

Description

Associates the button by constructing an ObjectWindows object to correspond to a button element created by a dialog resource definition.

Calls TControl.InitResource and TWindowsObject.DisableTransfer to exclude the button from the transfer mechanism, since they have no data to be transferred.

See Also

TButton


TButton.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Never)  Returns the name of TButton's window class, 'Button'.

See Also

TButton


TCheckBox
TCheckBox     (WObjects unit)

TCheckBox is an interface object that represents a corresponding check box element in Windows. TCheckBox objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used to display a standalone check box as a child window in another window's client area.

Check boxes have two states: checked and unchecked. TCheckBox methods are concerned primarily with managing the check box's state. Optionally, a check box can be part of a group (TGroupBox) which visually and functionally groups its controls.

Fields

Group

Methods

Init

InitResource

Load

BNClicked

Check

GetCheck

SetCheck

Store

Toggle

Transfer

Uncheck


TCheckBox.Group     (field)

Syntax

Group: PGroupBox;   (Read only)

Description

Group points the TGroupBox control object that unifies the check box with other check boxes and radio buttons (TRadioButton).

If the check box is not part of a group, Group is equal to nil.

See Also

TCheckBox


TCheckBox.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnID: Integer; ATitle: PChar; X,Y,W,H: Integer; AGroup: PGroupBox);

Description

(Override: Sometimes)  Constructs a check box object with the:

-	 passed parent window (AParent)

-	control ID (AnId)

-	associated text (ATitle)

-	position (X, Y) relative to the origin of the parent window's client area

-	 width (W)

-	height (H)

-	associated group box (AGroup).

Init sets the check box's Attr.Style field to ws_Child or ws_Visible or ws_TabStop or bs_AutoCheckBox.

See Also

TCheckBox

ws_ Window Styles


TCheckBox.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject; ResourceID: Word);

Description

Associates a TCheckBox object with the resource given by ResourceID. It then enables the transfer mechanism by calling EnableTransfer.

See Also

TCheckBox


TCheckBox.Load     (method)

Syntax

constructor Load(var S: TStream);

Constructs and loads a check box from the stream S by first calling TButton.Load and then reading the additional field (Group) introduced by TCheckBox.

See Also

TCheckBox

TWindow.Load


TCheckBox.BNClicked     (method)

Syntax

procedure BNClicked(var Msg: TMessage); virtual nf_First + bn_Clicked;

Description

(Override: Sometimes)  Automatically responds to notification messages indicating that the check box was clicked by toggling its state. If the check box's Group is not nil, BNClicked notifies the TGroupBox by calling its SelectionChanged method.

See Also

TCheckBox

TGroupBox.SelectionChanged


TCheckBox.Check     (method)

Syntax

procedure Check; virtual;

Description

(Override: Seldom)  Forces the check box into the checked state by calling SetCheck.

See Also

SetCheck

TCheckBox


TCheckBox.GetCheck     (method)

Syntax

function GetCheck: Word; virtual;

Description

(Override: Seldom)  Returns bf_Unchecked (zero) if the check box is unchecked, bf_Checked (1) if it is checked, or bf_Grayed (2) if it is grayed.

See Also

bf_XXXX constants

TCheckBox


TCheckBox.SetCheck     (method)

Syntax

procedure SetCheck(CheckFlag: Word); virtual;

Description

(Override: Seldom)  Forces the check box into the state specified by CheckFlag.

-	If CheckFlag is zero, the state will be unchecked.

-	If it is one, the state will be checked.

-	If it is 2, the state will be grayed.

SetCheck also informs the check box's group that the selection has changed.

See Also

TCheckBox

TGroupBox.SelectionChanged


TCheckBox.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the check box on the stream S by first calling TControl.Store and then writing the additional field (Group) introduced by TCheckBox.

See Also

TCheckBox

TWindow.Store


TCheckBox.Toggle     (method)

Syntax

procedure Toggle; virtual;

Description

(Override: Seldom)  Toggles the state of the check box by calling Check or Uncheck. For a 3-state check box, toggles through all three states: checked, unchecked, and grayed.

See Also

Check

TCheckBox

Uncheck


TCheckBox.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word): Word; virtual;

Description

(Override: Sometimes)  Transfers the  state of the check box in a Word type value to or from the memory location pointed to by DataPtr.

-	If TransferFlag is tf_GetData, the check box's state data is transferred to the memory location.

-	If TransferFlag is tf_SetData, the check box is set to the state indicated in the memory location.

Transfer returns the number of bytes stored in or retrieved from the memory location. If you pass tf_SizeData, Transfer returns the size of the transfer data.

See Also

TCheckBox

tf_XXXX constants


TCheckBox.Uncheck     (method)

Syntax

procedure Uncheck; virtual;

Description

(Override: Seldom)  Forces the check box into the unchecked state by calling SetCheck.

See Also

SetCheck

TCheckBox


TCollection
TCollection     (WObjects unit)

TCollection is an abstract type for implementing any collection of items, including other objects. TCollection is a more general concept than the traditional array, set, or list.

TCollection objects size themselves dynamically at run time and offer a base type for many specialized types, such as TSortedCollection and TStrCollection.

In addition to methods for adding and deleting items, TCollection offers several iterator routines that call a procedure or function for each item in the collection.

Fields

Count

Delta

Items

Limit

Methods

Init

Load

Done

AtDelete

AtFree

AtInsert

AtPut

At

Delete

DeleteAll

Error

FirstThat

ForEach

FreeAll

FreeItem

Free

GetItem

IndexOf

Insert

LastThat

Pack

PutItem

SetLimit

Store


TCollection.Items     (field)

Syntax

Items: PItemList;   (Read only)

Description

A pointer to an array of item pointers.

See Also

TCollection

TItemList Type


TCollection.Count     (field)

Syntax

Count: Integer;   (Read only)

Description

The current number of items in the collection, up to MaxCollectionSize.

See Also

TCollection


TCollection.Limit     (field)

Syntax

Limit: Integer;   (Read only)

Description

The currently allocated size (in elements) of the Items list.

See Also

Delta

Init

TCollection


TCollection.Delta     (field)

Syntax

Delta: Integer;   (Read only)

Description

The number of items by which to increase the Items list whenever it becomes full. If Delta is zero, the collection cannot grow beyond the size set by Limit.

Increasing the size of a collection is fairly costly in terms of performance. To minimize the number of times it has to occur, try to set the initial Limit to an amount that will encompass all the items you might want to collect, and set Delta to a figure that will allow a reasonable amount of expansion.

See Also

Init

Limit

TCollection


TCollection.Init     (method)

Syntax

constructor Init(ALimit, ADelta: Integer);

Description

Creates a collection with Limit set to ALimit and Delta set to ADelta. The initial number of items will be limited to ALimit, but the collection is allowed to grow in increments of ADelta until memory runs out or the number of items reaches MaxCollectionSize.

See Also

Delta

Limit

TCollection


TCollection.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Creates and loads a collection from the given stream. Load calls GetItem for each item in the collection.

See Also

GetItem

TCollection


TCollection.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Often)  Deletes and disposes all of the items in the collection by calling FreeAll and setting Limit to 0.

See Also

FreeAll

Init

TCollection


TCollection.At     (method)

Syntax

function At(Index: Integer): Pointer;

Description

Returns a pointer to the item indexed by Index in the collection. This method lets you treat a collection as an indexed array. If Index is less than zero or greater than or equal to Count, the Error method is called with an argument of coIndexError, and a value of nil is returned.

See Also

IndexOf

TCollection


TCollection.AtDelete     (method)

Syntax

procedure AtDelete(Index: Integer);

Description

Deletes the item at the Index'th position and moves the following items up by one position.

Count is decremented by 1, but the memory allocated to the collection (as given by Limit) is not reduced.

If Index is less than zero or greater than or equal to Count, the Error method is called with an argument of coIndexError.

See Also

Delete

Free

FreeItem

TCollection


TCollection.AtFree     (method)

Syntax

procedure AtFree(Index: Integer);

Description

Disposes and deletes the item at the Index'th position.

See Also

TCollection


TCollection.AtInsert     (method)

Syntax

procedure AtInsert(Index: Integer; Item: Pointer);

Description

Inserts Item at the Index'th position and moves the following items down by one position.

-	If Index is less than zero or greater than Count, the Error method is called with an argument of coIndexError and the new Item is not inserted.

-	If Count is equal to Limit before the call to AtInsert, the allocated size of the collection is expanded by Delta items using a call to SetLimit.

-	If the SetLimit call fails to expand the collection, the Error method is called with an argument of coOverflow and the new Item is not inserted.

See Also

At

AtPut

TCollection


TCollection.AtPut     (method)

Syntax

procedure AtPut(Index: Integer; Item: Pointer);

Description

Replaces the item at index position Index with the item given by Item. If Index is less than zero or greater than or equal to Count, the Error method is called with an argument of coIndexError.

See Also

At

AtInsert

TCollection


TCollection.Delete     (method)

Syntax

procedure Delete(Item: Pointer);

Description

Deletes the item given by Item from the collection. Equivalent to AtDelete(IndexOf(Item)).

See Also

AtDelete

DeleteAll

TCollection


TCollection.DeleteAll     (method)

Syntax

procedure DeleteAll;

Description

Deletes all items from the collection by setting Count to zero.

See Also

AtDelete

Delete

TCollection


TCollection.Error     (method)

Syntax

procedure Error(Code, Info: Integer); virtual;

Description

(Override: Sometimes)  Called whenever a collection error is encountered. By default, this method produces a run-time error of (212 - Code).

See Also

coXXXX constants

TCollection


TCollection.FirstThat     (method)

Syntax

function FirstThat(Test: Pointer): Pointer;

Description

FirstThat applies a Boolean function, given by the function pointer Test, to each item in the collection until Test returns True. The result is the item pointer for which Test returned True, or nil if the Test function returned False for all items. Test must point to a far local function taking one Pointer parameter and returning a Boolean value.

For example

function Matches(Item: Pointer): Boolean; far;

The Test function cannot be a global function.

Assuming that List is a TCollection, the statement

P := List.FirstThat(@Matches);

corresponds to

I := 0;

while (I < List.Count) and not Matches(List.At(I)) do Inc(I);

if I < List.Count then P := List.At(I) else P := nil;

See Also

ForEach

LastThat

TCollection


TCollection.ForEach     (method)

Syntax

procedure ForEach(Action: Pointer);

Description

ForEach applies an action, given by the procedure pointer Action, to each item in the collection. Action must point to a far local procedure taking one Pointer parameter. For example

function PrintItem(Item: Pointer); far;

The Action procedure cannot be a global procedure.

Assuming that List is a TCollection, the statement

List.ForEach(@PrintItem);

corresponds to

for I := 0 to List.Count - 1 do PrintItem(List.At(I));

See Also

FirstThat

LastThat

TCollection


TCollection.Free     (method)

Syntax

procedure Free(Item: Pointer);

Description

Deletes and disposes of the given Item. Equivalent to

Delete(Item);

FreeItem(Item);

See Also

Delete

FreeItem

TCollection


TCollection.FreeAll     (method)

Syntax

procedure FreeAll;

Description

Deletes and disposes of all items in the collection.

See Also

DeleteAll

TCollection


TCollection.FreeItem     (method)

Syntax

procedure FreeItem(Item: Pointer); virtual;

Description

(Override: Sometimes)  The FreeItem method must dispose the given Item. The default FreeItem assumes that Item is a pointer to a descendant of TObject, and thus calls the Done destructor:

if Item <> nil then Dispose(PObject(Item), Done);

FreeItem is called by Free and FreeAll, but it should never be called directly.

See Also

Free

FreeAll

FreeItem

TCollection


TCollection.GetItem     (method)

Syntax

function TCollection.GetItem(var S: TStream): Pointer; virtual;

Description

(Override: Sometimes)  Called by Load for each item in the collection.

This method can be overridden but should not be called directly.

The default GetItem assumes that the items in the collection are descendants of TObject, and thus calls TStream.Get to load the item:

GetItem := S.Get;

See Also

GetItem

Load

Store

TCollection


TCollection.IndexOf     (method)

Syntax

function IndexOf(Item: Pointer): Integer; virtual;

Description

(Override: Never)  Returns the index of the given Item. The converse operation to At. If Item is not in the collection, IndexOf returns -1.

See Also

At

TCollection


TCollection.Insert     (method)

Syntax

procedure Insert(Item: Pointer); virtual;

Description

(Override: Never)  Inserts Item into the collection, and adjusts other indexes if necessary. By default, insertions are made at the end of the collection by calling AtInsert(Count, Item);

See Also

AtInsert

TCollection


TCollection.LastThat     (method)

Syntax

function LastThat(Test: Pointer): Pointer;

Description

LastThat applies a Boolean function, given by the function pointer Test, to each item in the collection in reverse order until Test returns True.

The result is the item pointer for which Test returned True, or nil if the Test function returned False for all items.

Test must point to a far local function taking one Pointer parameter and returning a Boolean, for example

function Matches(Item: Pointer): Boolean; far;

The Test function cannot be a global function.

Assuming that List is a TCollection, the statement

P := List.LastThat(@Matches);

corresponds to

I := List.Count - 1;

while (I >= 0) and not Matches(List.At(I)) do Dec(I);

if I >= 0 then P := List.At(I) else P := nil;

See Also

FirstThat

ForEach

TCollection


TCollection.Pack     (method)

Syntax

procedure Pack;

Description

Deletes all nil pointers in the collection.

See Also

Delete

DeleteAll

TCollection


TCollection.PutItem     (method)

Syntax

procedure PutItem(var S: TStream; Item: Pointer); virtual;

Description

(Override: Sometimes)  Called by Store for each item in the collection.

This method can be overridden but should not be called directly.

The default PutItem assumes that the items in the collection are descendants of TObject, and thus calls TStream.Put to store the item:

S.Put(Item);

See Also

GetItem

Store

TCollection


TCollection.SetLimit     (method)

Syntax

procedure SetLimit(ALimit: Integer); virtual;

Description

(Override: Seldom)  Expands or shrinks the collection by changing the allocated size to ALimit.

If ALimit is less than Count it is set to Count, and if ALimit is greater than MaxCollectionSize it is set to MaxCollectionSize.

Then, if ALimit is different from the current Limit, a new Items array of ALimit elements is allocated, the old Items array is copied into the new array, and the old array is disposed.

See Also

Count

Limit

TCollection


TCollection.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the collection and all its items on the stream S.

Store calls PutItem for each item in the collection.

See Also

PutItem

TCollection


TComboBox
TComboBox     (WObjects unit)

TComboBox is an interface object that represents a corresponding combo box element in Windows. TComboBox objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used to display a standalone combo box as a child window in another window's client area. Combo box object inherit most of their functionality from TListBox.

There are three styles of combo boxes:

-	simple

-	drop down

-	drop down list

These styles are governed by the Windows style constants, cbs_Simple, cbs_DropDown, and cbs_DropDownList (see the cbs_ComboBoxStylesHelp screen). These constants are passed to the Init constructor, which in turn tells Windows which type of combo box element to create.

Fields

TextLen

Methods

Init

InitResource

Load

GetClassName

HideList

ShowList

Store

Transfer


TComboBox.TextLen     (field)

Syntax

TextLen: Word; Read only

Description

TextLen contains the length of the character buffer in the edit portion of the combo box, which is also the number of bytes transferred by Transfer.

TextLen is set by Init.

See Also

TComboBox


TComboBox.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnID: Integer; X,Y,W,H: Integer; CanDropList: Boolean; HasStaticControl: Boolean);

Description

(Override: Sometimes)  By calling TListBox.Init, constructs a combo box object with the:

-	passed parent window (AParent)

-	control ID (AnId)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H)

Sets TextLen to ATextLen. Sets Attr.Style to (Attr.Style and not lbs_Notify) or AStyle or cbs_Sort or ws_VScroll or ws_HScroll.

See Also

cbs_ Combo box styles

TComboBox


TComboBox.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject; ResourceID: Integer; ATextLen: Word);

Description

Associates a TComboBox object with the resource indicated by ResourceID, with a maximum text length of ATextLen-1.

See Also

TComboBox


TComboBox.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a combo box from the stream S by first calling TListBox.Load and then reading the additional fields (IsDropDown, IsList) introduced by TComboBox.

See Also

TComboBox

TWindow.Load


TComboBox.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Never)  Returns the name of TComboBox's window class, 'ComboBox'.

See Also

TComboBox


TComboBox.HideList     (method)

Syntax

procedure HideList; virtual;

Description

(Override: Seldom)  Forces the hiding of the drop down list of a drop down or drop down list combo box.

See Also

TComboBox


TComboBox.ShowList     (method)

Syntax

procedure ShowList; virtual;

Description

(Override: Seldom)  Forces the display of the drop down list of a drop down or drop down list combo box.

See Also

TComboBox


TComboBox.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the combo box on the stream S by first calling TListBox.Store and then writing the additional field (TextLen) introduced by TComboBox.

See Also

TComboBox

TWindow.Store


TComboBox.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word);virtual;

Description

Transfers data to or from the record pointed to by DataPtr.

The record should first be a pointer to a string collection that holds the entries of the combo box's list. Then an array of characters holding the currently selected entry is transferred.

-	If TransferFlag is tf_GetData, the combo box's data is transferred to the DataPtr record. Transfer returns the size of the data transferred.

-	If TransferFlag is tf_SetData, the data is transferred to the combo box from the record. Transfer returns the size of the data transferred.

-	If TransferFlag is tf_SizeData, Transfer returns the size of the transfer data.

See Also

TComboBox

TListBox.Transfer


TControl
TControl     (WObjects unit)

TControl is an abstract object type that, as an ancestor type, unifies all of the control object types, such as TScrollBar and TButton.

It is also ancestor to TMDIClient, a specialized control for MDI-compliant applications.

Control objects are generally not used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but only as stand-alone controls in the client area of other windows.

Methods

Init

GetClassName

InitResource

Register

WMPaint


TControl.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnId: Integer; ATitle: PChar; X,Y,W,H: Integer);

Description

Constructs a control object with the:

-	associated parent window (AParent)

-	control ID (AnId)

-	associated text (ATitle)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H)

With these arguments, it fills the control's Attr field inherited from TWindow.

As a default, it sets Attr.Style to ws_Child or ws_Visible or ws_Group or ws_TabStop, so that all control objects are visible child windows.

See Also

TControl

ws_Window styles


TControl.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject; ResourceID: Word);

Description

Associates a control object with the control element in the resource specified by ResourceID.

Calls TWindow.InitResource and EnableTransfer to enable the transfer mechanism.

See Also

TControl

TWindowsObject.EnableTransfer


TControl.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Always)  Abstract method to be overridden by descendant objects.

See Also

TControl


TControl.Register     (method)

Syntax

function Register: Boolean; virtual;

Description

(Override: Never)  Simply returns True to indicate that TControl descendants use pre-registered window classes.

See Also

TControl


TControl.WMPaint     (method)

Syntax

procedure WMPaint(var Msg: TMessage); virtual wm_First + wm_Paint;

Description

(Override: Seldom)  Calls DefWndProc for standard repainting of control objects.

See Also

TControl


TDialog
TDialog     (WObjects unit)

TDialog defines objects that serve as the modal and modeless dialog boxes used in Windows applications. A TDialog object has an associated dialog resource that describes the appearance and placement of its controls. This resource is specified in the call to Init.

Dialog box objects can be associated with either modal or modeless dialog elements, through calls to Execute or Create, respectively. Note that the creation of a modal dialog disables the continued operations of its parent window.

Fields

Attr

DialogProc

IsModal

Methods

Init

Load

Done

Cancel

Create

DefWndProc

EndDlg

Execute

GetItemHandle

Ok

SendDlgItemMsg

Store

WMClose

WMInitDialog


TDialog.Attr     (field)

Syntax

Attr: TDialogAttr;

Description

Attr holds the dialog box's creation attributes. Attr is defined as follows:

TDialogAttr = record

   Name: PChar;

   Param: Longint;

end;

The Name field holds the name or ID of the dialog resource. The Param field holds a parameter that is passed to the dialog procedure when the dialog is created.

See Also

TDialog


TDialog.DialogProc     (field)

Syntax

DialogProc: TFarProc;   (Read only)

Description

DialogProc points to the procedure-instance address of the dialog function.

See Also

TDialog


TDialog.IsModal     (field)

Syntax

IsModal: Boolean;   (Read only)

Description

IsModal is True if the dialog is modal and False if it is modeless.

See Also

TDialog


TDialog.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AName: PChar);

Description

(Override: Sometimes)  Constructs the dialog object by calling TWindowsObject.Init, passing the parent window, AParent.

Then Init sets the Attr.Name field to the string passed in AName. The string can be the symbolic name of the dialog resource or an integer ID cast to type PChar.

Init also calls TWindowsObject.DisableAutoCreate so that dialogs are not automatically created and displayed along with their parent windows.

See Also

TDialog


TDialog.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a dialog box from the stream S by first calling TWindowsObject.Load and then reading the additional fields (Attr and IsModal) introduced by TDialog.

See Also

TDialog


TDialog.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Sometimes)  Disposes the dialog box object. Calls TWindowsObject.Done.

See Also

TDialog


TDialog.Cancel     (method)

Syntax

procedure Cancel(var Msg: TMessage); virtual id_First + id_Cancel;

Description

(Override: Sometimes)  Automatically responds to the pressing of a dialog's Cancel button by calling EndDlg with the value id_Cancel.

See Also

EndDlg

TDialog


TDialog.Create     (method)

Syntax

function Create: Boolean; virtual;

Description

(Override: Never)  Creates a modeless dialog object's corresponding dialog element. Create returns True if successful. If unsuccessful, it calls Error with the error code em_InvalidWindow.

See Also

Execute

TDialog


TDialog.DefWndProc     (method)

Syntax

procedure DefWndProc(var Msg: TMessage); virtual;

Description

(Override: Never)  Elicits Windows' default message processing by setting the result of the passed message equal to zero.

See Also

TDialog


TDialog.EndDlg     (method)

Syntax

procedure EndDlg(ARetValue: Integer); virtual;

Description

(Override: Never)  Destroys modal and modeless dialog boxes. ARetValue is passed back as the return value from Execute for modal dialog boxes.

See Also

Create

Execute

TDialog


TDialog.Execute     (method)

Syntax

function Execute: Integer; virtual;

Description

(Override: Never)  Creates and displays a modal dialog object's corresponding dialog element. This method executes during the entire time the dialog box is on screen, until its EndDlg method is called.

Before the method finishes, it resets HWindow to 0. Execute returns the integer value returned by EndDlg if successful. If unsuccessful, Execute calls Error with the error code em_InvalidWindow.

See Also

Create

EndDlg

TDialog


TDialog.GetItemHandle     (method)

Syntax

function GetItemHandle(DlgItemID: Integer): HWnd;

Description

(Override: Never)  Returns the handle to the dialog's control identified by the passed ID, DlgItemID.

See Also

TDialog


TDialog.Ok     (method)

Syntax

procedure Ok(var Msg: TMessage); virtual id_First + id_OK;

Description

(Override: Sometimes)  Automatically responds to the pressing of a dialog's OK button by calling CanClose, and EndDlg with the value id_OK. Also calls TransferData to transfer data from the controls to the transfer buffer.

See Also

EndDlg

TDialog


TDialog.SendDlgItemMsg     (method)

Syntax

function SendDlgItemMsg(DlgItemID: Integer; AMsg, WParam: Word; LParam: Longint): Longint;

Description

(Override: Never)  Sends a Windows control message, identified by AMsg, to the dialog's control identified by its passed ID, DlgItemID.

WParam and LParam become parameters in the Windows message. SendDlgItemMsg returns the value returned by the control, or zero if the control ID is invalid.

See Also

TDialog


TDialog.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the dialog box on the stream S by first calling TWindowsObject.Store and then writing the additional fields (Attr and IsModal) introduced by TDialog.

See Also

TDialog


TDialog.WMClose     (method)

Syntax

procedure WMClose(var Msg: TMessage); virtual wm_First + wm_Close;

Description

If the dialog box is modal, calls EndDlg to close the dialog box.

If the dialog box is modeless, it calls its WMClose method inherited from TWindowsObject.

See Also

TDialog

TWindowsObject.WMClose


TDialog.WMInitDialog     (method)

Syntax

procedure WMInitDialog(var Msg: TMessage); virtual wm_First + wm_InitDialog;

Description

(Override: Never)  WMInitDialog is automatically called just before the dialog is displayed. It calls SetupWindow to perform any initialization needed for the dialog or its controls.

See Also

TDialog

TWindowsObject.SetupWindow


TDlgWindow
TDlgWindow     (WObjects unit)

Dialog windows, defined by TDlgWindow, combine some characteristics of dialogs and of windows.

A dialog window has an associated dialog resource which describes the appearance and position of its controls.

It also has a window class that can specify icons and cursors.

To create and display dialog windows, use the modeless dialog Create methods. Do not use the Execute method.

Methods

Init

Create

GetWindowClass


TDlgWindow.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AName: PChar);

Description

Constructs a new TDlgWindow object by calling TDialog.Init.

It also calls EnableAutoCreate so that, as a child window, it is automatically created and displayed along with its parent window.

See Also

TDlgWindow

TWindowsObject.EnableAutoCreate


TDlgWindow.Create     (method)

Syntax

function Create: Boolean; virtual;

Description

(Override: Never)  Registers the dialog window's class and calls TDialog.Create.

Create returns True if successful.

See Also

TDlgWindow

TWindowsObject.Register


TDlgWindow.GetWindowClass     (method)

Syntax

procedure GetWindowClass(var AWndClass: TWndClass); virtual;

Description

(Override: Often)  Defines the default window class record and passes it back in AWndClass. This window class specifies no menu and a standard icon and cursor.

Redefine GetWindowClass, as well as GetClassName for your TDlgWindow descendants.

Make sure your GetWindowClass method calls this GetWindowClass before modifying any TWndClass fields.

See Also

TDlgWindow


TDosStream
TDosStream     (WObjects unit)

TDosStream is a specialized TStream derivative implementing unbuffered DOS file streams. The constructor lets you create or open a DOS file by specifying its name and access mode: stCreate, stOpenRead, stOpenWrite, or stOpen (see the stXXXX constants Help screen).

The one additional field of TDosStream is Handle, the traditional DOS file handle used to access an open file. Most applications will use the buffered derivative of TDosStream called TBufStream. TDosStream overrides all the abstract methods of TStream except for TStream.Flush.

Fields

Handle

Methods

Init

Done

GetPos

GetSize

Read

Seek

Truncate

Write


TDosStream.Handle     (field)

Syntax

Handle: Word   (Read only)

Description

Handle is the DOS file handle used to access an open file stream.

See Also

TDosStream


TDosStream.Init     (method)

Syntax

constructor Init(FileName: FNameStr; Mode: Word);

Description

Creates a DOS file stream with the given FileName and access mode. If successful, the Handle field is set with the DOS file handle. Failure is signaled by a call to Error with an argument of stInitError.

The Mode argument must be set to one of the values stCreate, stOpenRead, stOpenWrite, or stOpen.

See Also

stXXXX

TDosStream


TDosStream.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Never)  Closes and disposes of the DOS file stream.

See Also

Init

TDosStream


TDosStream.GetPos     (method)

Syntax

function GetPos: Longint; virtual;

Description

(Override: Never)  Returns the value of the calling stream's current position.

See Also

Seek

TDosStream


TDosStream.GetSize     (method)

Syntax

function GetSize: Longint; virtual;

Description

(Override: Never)  Returns the total size in bytes of the calling stream.

See Also

TDosStream


TDosStream.Read     (method)

Syntax

procedure Read(var Buf; Count: Word); virtual;

Description

(Override: Never)  Reads Count bytes into the Buf buffer starting at the calling stream's current position.

See Also

Write

stXXXX Constants

TDosStream


TDosStream.Seek     (method)

Syntax

procedure Seek(Pos: Longint); virtual;

Description

(Override: Never)  Resets the current position to Pos bytes from the beginning of the calling stream.

See Also

GetPos

GetSize

TDosStream


TDosStream.Truncate     (method)

Syntax

procedure Truncate; virtual;

Description

(Override: Never)  Deletes all data on the calling stream from the current position to the end.

See Also

GetPos

Seek

TDosStream


TDosStream.Write     (method)

Syntax

procedure Write(var Buf; Count: Word); virtual;

Description

Writes Count bytes from the Buf buffer to the calling stream, starting at the current position.

See Also

Read

stXXXX Constants

TDosStream


TEdit
TEdit     (WObjects unit)

TEdit is an interface object that represents a corresponding edit control element in Windows.

TEdit objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used to display a stand-alone edit control as a child window in another window's client area.

There are two styles of edit control objects: single line and multiline. Multiline edit controls allow vertical scroll bars and editing in multiple lines. Most of TEdit's methods manage the edit control's text.

TEdit also includes some command-based message response methods for automatically responding to cut, copy, paste, delete, clear and undo menu selections from the edit control's parent window.

Two important methods inherited from TEdit's ancestor, TStatic, are GetText and SetText.

Methods

Init

CanUndo

ClearModify

CMEditClear

CMEditCopy

CMEditCut

CMEditDelete

CMEditPaste

CMEditUndo

Copy

Cut

DeleteLine

DeleteSelection

DeleteSubText

GetClassName

GetLine

GetLineFromPos

GetLineIndex

GetLineLength

GetNumLines

GetSelection

GetSubText

Insert

IsModified

Paste

Scroll

Search

SetSelection

SetupWindow

Transfer

Undo


TEdit.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnId: Integer; ATitle: PChar; X,Y,W,H: Integer; Multiline : Boolean);

Description

(Override: Sometimes)  Constructs an edit control object with a parent window (AParent).

It fills its Attr fields with the:

-	passed control ID (AnId)

-	initial text (ATitle)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H)

If Multiline is True, the edit control will be a multiline edit control with horizontal and vertical scroll bars. In that case, the Attr.Style field will include the Windows style constants es_Multiline, es_AutoVScroll, es_AutoHScroll, es_Left, ws_VScroll, and ws_HScroll.

If Multiline is False, the edit control will have a single line of text and a border (ws_Border), and will be left justified (es_Left).

See Also

es_ Edit control styles

TEdit


TEdit.CanUndo     (method)

Syntax

function CanUndo: Boolean; virtual;

Description

(Override: Seldom)  Returns True if it is possible to undo the last edit.

See Also

TEdit

Undo


TEdit.CMEditClear     (method)

Syntax

procedure CMEditClear(var Msg: TMessage); virtual cm_First + cm_EditClear;

Description

(Override: Never)  Automatically responds to a menu selection with a menu ID of cm_EditClear by calling the Clear method.

See Also

TEdit

TStatic.Clear


TEdit.GetLineIndex     (method)

Syntax

function GetLineIndex(LineNumber: Integer): Integer; virtual;

Description

(Override: Seldom)  Returns, from a multiline edit control, the number of characters that appear before the line number specified by LineNumber. Line breaks count as two characters.

If the specified line does not exist, GetLineIndex returns the total number of characters in the edit control.

See Also

TEdit


TEdit.Copy     (method)

Syntax

procedure Copy; virtual;

Description

(Override: Seldom)  Copies the currently selected text into the clipboard.

See Also

CMEditCopy

TEdit


TEdit.CMEditCopy     (method)

Syntax

procedure CMEditCopy(var Msg: TMessage); virtual cm_First + cm_EditCopy;

Description

(Override: Never)  Automatically responds to a menu selection with a menu ID of cm_EditCopy by calling the Copy method.

See Also

Copy

TEdit


TEdit.Cut     (method)

Syntax

procedure Cut; virtual;

Description

(Override: Seldom)  Cuts (copies and deletes) the currently selected text into the clipboard.

See Also

CMEditCut

TEdit


TEdit.CMEditCut     (method)

Syntax

procedure CMEditCut(var Msg: TMessage); virtual cm_First + cm_EditCut;

Description

(Override: Never)  Automatically responds to a menu selection with a menu ID of cm_EditCut by calling the Cut method.

See Also

Cut

TEdit


TEdit.CMEditDelete     (method)

Syntax

procedure CMEditDelete(var Msg: TMessage); virtual cm_First + cm_EditDelete;

Description

(Override: Never)  Automatically responds to a menu selection with a menu ID of cm_EditDelete by calling the DeleteSelection method.

See Also

DeleteSelection

TEdit


TEdit.DeleteLine     (method)

Syntax

function DeleteLine(LineNumber: Integer): Boolean; virtual;

Description

(Override: Sometimes)  Deletes the text in the line specified by LineNumber in a multiline edit control. DeleteLine does not delete the line break and affects no other lines.

The method returns True if successful.

See Also

TEdit


TEdit.DeleteSelection     (method)

Syntax

function DeleteSelection: Boolean; virtual;

Description

(Override: Seldom)  Clears the currently selected text, and returns False if no text is selected.

See Also

CMEditDelete

TEdit


TEdit.DeleteSubText     (method)

Syntax

function DeleteSubText(StartPos, EndPos: Integer): Boolean; virtual;

Description

(Override: Seldom)  Deletes the text between the starting and ending positions specified by StartPos and EndPos.

The first character is in position 0, and the position numbers continue sequentially throughout all lines in a multiline edit control.

Line breaks count as two characters. DeleteSubText returns True if successful.

See Also

TEdit


TEdit.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Never)  Returns the name of TEdit's window class, 'Edit'.

See Also

TEdit


TEdit.GetLine     (method)

Syntax

function GetLine(ATextString: PChar; StrSize, LineNumber: Integer): Boolean; virtual;

Description

(Override: Seldom)  Retrieves a multiline edit control's text from the line specified by LineNumber and returns it in ATextString.

StrSize indicates how many characters to retrieve.

GetLine returns False if it is unable to retrieve the text or if it is too long.

See Also

GetNumLines

GetLineLength

TEdit

TStatic.GetText


TEdit.GetSubText     (method)

Syntax

procedure GetSubText(ATextString: PChar; StartPos, EndPos: Integer); virtual;

Description

(Override: Seldom)  Retrieves, in ATextString, the text in an edit control from indexes StartPos to EndPos.

When specifying the range, the first character is at index 0.

In a multiline edit control, the characters are counted sequentially throughout all of the lines, and line breaks are counted as two characters.

See Also

GetSelection

TEdit


TEdit.GetSelection     (method)

Syntax

procedure GetSelection(var StartPos, EndPos: Integer); virtual;

Description

(Override: Seldom)  Retrieves the starting and ending positions of the currently selected text and returns them in the StartPos and EndPos arguments. The first character is at position 0.

In a multiline edit control, the positions are counted sequentially throughout all lines, and line breaks count for two characters.

When using GetSelection in conjunction with GetSubText, you can get the currently selected text.

See Also

GetSubText

TEdit


TEdit.IsModified     (method)

Syntax

function IsModified: Boolean; virtual;

Description

(Override: Seldom)  Returns True if the user has changed the text in the edit control.

See Also

ClearModify

TEdit


TEdit.Insert     (method)

Syntax

procedure Insert(ATextString: PChar); virtual;

Description

(Override: Seldom)  Inserts the text passed in ATextString into the edit control at the current text insertion point, and replaces any currently selected text.

Insert is similar to Paste, but does not affect the clipboard.

See Also

Paste

TEdit


TEdit.GetLineFromPos     (method)

Syntax

function GetLineFromPos(CharPos: Integer): Integer; virtual;

Description

(Override: Seldom)  Returns, from a multiline edit control, the line number on which the character position specified by CharPos occurs.

The position of the first character is 0 and the numbers continue sequentially throughout all of the lines. Line breaks count as two characters.

See Also

TEdit


TEdit.GetLineLength     (method)

Syntax

function GetLineLength(LineNumber: Integer): Integer; virtual;

Description

(Override: Seldom)  Returns, from a multiline edit control, the number of characters in the line specified by LineNumber. GetLineLength should be called before calling GetLine.

See Also

GetLine

TEdit


TEdit.GetNumLines     (method)

Syntax

function GetNumLines: Integer; virtual;

Description

(Override: Seldom)  Returns the number of lines that have been entered in a multiline edit control.

GetNumLines should be called before calling GetLine.

See Also

GetLine

TEdit


TEdit.Paste     (method)

Syntax

procedure Paste; virtual;

Description

(Override: Seldom)  Inserts text from the clipboard into the edit control at the current insertion point.

See Also

CMEditPaste

TEdit


TEdit.CMEditPaste     (method)

Syntax

procedure CMEditPaste(var Msg: TMessage); virtual cm_First + cm_EditPaste;

Description

(Override: Never)  Automatically responds to a menu selection with a menu ID of cm_EditPaste by calling the Paste method.

See Also

Paste

TEdit


TEdit.ClearModify     (method)

Syntax

procedure ClearModify; virtual;

Description

(Override: Seldom)  Resets the changes flag for the edit control.

See Also

IsModified

TEdit


TEdit.SetSelection     (method)

Syntax

function SetSelection(StartPos, EndPos: Integer): Boolean; virtual;

Description

(Override: Seldom)  Forces the selection of the text between the positions specified by StartPos and EndPos, but not including the character at EndPos.

The first character is in position 0, and the position numbers continue sequentially throughout all lines in a multiline edit control. Line breaks count as two characters.

See Also

TEdit


TEdit.Search     (method)

Syntax

procedure Search(StartPos: Integer; AText: PChar; CaseSensitive: Boolean): Integer;

Description

Search looks through the edit control's text, starting with the character at StartPos, until it finds a match for AText.

-	If the text is found, the matching text will be selected, and Search returns the position of the start of the matched text.

-	If AText is not found, Search returns -1.

Pass -1 in StartPos to begin the search at the current position.

See Also

TEdit


TEdit.Scroll     (method)

Syntax

procedure Scroll(HorizontalUnit, VerticalUnit: Integer); virtual;

Description

(Override: Seldom)  Scrolls a multiline edit control horizontally and vertically by the numbers of characters specified in HorizontalUnit and VerticalUnit.

Positive values result in a scroll to the right or down, and negative values scroll to the left or up.

See Also

TEdit


TEdit.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word): Word; virtual;

Description

(Override: Sometimes)  Transfers TextLen characters of the current text of the edit control to or from the memory location pointed to by DataPtr.

-	If TransferFlag is tf_GetData, the text is transferred to the memory location.

-	If TransferFlag is tf_SetData, the edit control's text is set to the text at the memory location. Transfer returns TextLen (the number of bytes stored in or retrieved from the memory location).

-	If TransferFlag is tf_SizeData, Transfer returns the size of the transfer data.

See Also

TEdit


TEdit.Undo     (method)

Syntax

procedure Undo; virtual;

Description

(Override: Seldom)  Undoes the last edit.

See Also

CanUndo

CMEditUndo

TEdit


TEdit.CMEditUndo     (method)

Syntax

procedure CMEditUndo(var Msg: TMessage); virtual cm_First + cm_EditUndo;

Description

(Override: Never)  Automatically responds to a menu selection with a menu ID of cm_EditUndo by calling the Undo method.

See Also

TEdit

Undo


TEdit.SetupWindow     (method)

Syntax

procedure SetupWindow; virtual;

Description

Limits the number of charcters that can be entered into the edit control by calling TStatic.SetupWindow.

If the TextLen field is non-zero, the value TextLen-1 is send to Windows though an em_LimitText message.

See Also

TEdit

Undo

TWindow.SetupWindow


TEmsStream
TEmsStream     (WObjects unit)

TEmsStream is a specialized TStream derivative for implementing streams in EMS memory. The additional fields provide an EMS handle, a page count, stream size, and current position. TEmsStream overrides the six abstract methods of TStream as well as providing a specialized constructor and destructor.

When debugging a program using EMS streams, the IDE cannot recover EMS memory allocated by your program if your program terminates prematurely or if you forget to call the Done destructor for an EMS stream. Only the Done method (or rebooting) can release the EMS pages owned by the stream.

Fields

Handle

PageCount

Size

Position

Methods

Init

Done

GetPos

GetSize

Read

Seek

Truncate

Write


TEmsStream.Handle     (field)

Syntax

Handle: Word;   (Read only)

Description

The EMS handle for the stream.

See Also

TEmsStream


TEmsStream.PageCount     (field)

Syntax

PageCount: Word;   (Read only)

Description

The number of allocated pages for the stream, with 16K per page.

See Also

TEmsStream


TEmsStream.Size     (field)

Syntax

Size: Longint;   (Read only)

Description

The size of the stream in bytes.

See Also

TEmsStream


TEmsStream.Position     (field)

Syntax

Position: Longint;   (Read only)

Description

The current position within the stream. The first position is 0.

See Also

TEmsStream


TEmsStream.Init     (method)

Syntax

constructor Init(MinSize: Longint);

Description

Creates an EMS stream with the given minimum size in bytes. Calls Init then sets Handle, Size and PageCount. Calls Error with an argument of stInitError if initialization fails.

See Also

Done

TEmsStream

TObject.Init


TEmsStream.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Never)  Disposes of the EMS stream and releases EMS pages used.

See Also

Init

TEmsStream


TEmsStream.GetPos     (method)

Syntax

function GetPos: Longint; virtual;

Description

(Override: Never)  Returns the value of the calling stream's current position.

See Also

Seek

TEmsStream


TEmsStream.GetSize     (method)

Syntax

function GetSize: Longint; virtual;

Description

(Override: Never)  Returns the total size of the calling stream.

See Also

TEmsStream


TEmsStream.Read     (method)

Syntax

procedure Read(var Buf; Count: Word); virtual;

Description

(Override: Never)  Reads Count bytes into the Buf buffer starting at the calling stream's current position.

See Also

stXXXXConstants

TEmsStream

Write


TEmsStream.Seek     (method)

Syntax

procedure Seek(Pos: Longint); virtual;

Description

(Override: Never)  Resets the current position to Pos bytes from the start of the calling stream.

See Also

GetPos

GetSize

TEmsStream


TEmsStream.Truncate     (method)

Syntax

procedure Truncate; virtual;

Description

(Override: Never)  Deletes all data on the calling stream from the current position to the end. The current position is set to the new end of the stream.

See Also

GetPos

Seek

TEmsStream


TEmsStream.Write     (method)

Syntax

procedure Write(var Buf; Count: Word); virtual;

Description

(Override: Never)  Writes Count bytes from the Buf buffer to the calling stream, starting at the current position.

See Also

GetPos

Seek

TEmsStream

TStreamRead


TGroupBox
TGroupBox     (WObjects unit)

TGroupBox is an interface object that represents a corresponding group box element in Windows.

TGroupBox objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used when you want to display a stand-alone group box as a child window in another window's client area.

While group boxes don't serve an active purpose on the screen, they visually unify a group of selection boxes (check boxes and radio buttons). Internally, they manage the states of their selection boxes.

Fields

NotifyParent

Methods

Init

Load

GetClassName

InitResource

SelectionChanged

Store


TGroupBox.NotifyParent     (field)

Syntax

NotifyParent: Boolean;   (Read/write)

Description

Flag which indicates whether or not parent is to be notified when the state of the group box's selection boxes has changed.

See Also

TGroupBox


TGroupBox.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnID: Integer; AText: PChar; X,Y,W,H: Integer);

Description

(Override: Sometimes)  Constructs a group box object with the:

-	passed parent window (AParent)

-	control ID (AnId)

-	associated text (AText)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H)

Calls TControl.Init and then adds the Windows style bs_GroupBox to, and removes the style ws_TabStop from, the group box's Attr.Style field. NotifyParent is set to True; by default, the group box's parent is notified when the state of its selection boxes changes.

See Also

TGroupBox


TGroupBox.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject; ResourceID: Word);

Description

Subclasses the group box by constructing an Object Windows object to correspond to a group box element created by a dialog resource definition.

Calls TControl.InitResource and TWindowsObject.DisableTransfer to exclude group boxes from the transfer mechanism, since they have no data to be transferred.

See Also

TGroupBox


TGroupBox.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a group box from the stream S by calling TControl.Load and reading the additional field (NotifyParent) introduced by TGroupBox.

See Also

TGroupBox

TWindow.Load


TGroupBox.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Sometimes)  Returns the name of TGroupBox's window class, 'Button'.

See Also

TGroupBox


TGroupBox.SelectionChanged     (method)

Syntax

procedure SelectionChanged(ControlId: Integer); virtual;

Description

(Override: Sometimes)  If NotifyParent is True, notifies the parent window of the group box that one of its selections has changed by sending it a child-ID-based message. This method could be overridden to allow the group box to respond to its selections.

See Also

TGroupBox


TGroupBox.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the group box on the stream S by first calling TControl.Store and then writing the additional field (NotifyParent) introduced by TGroupBox.

See Also

TWindow.Store

TGroupBox


TListBox
TListBox     (WObjects unit)

TListBox is an interface object that represents a corresponding list box element in Windows.

TListBox objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but display a standalone list box as a child window in another window's client area.

TListBox's methods also serve object instances of its descendant, TComboBox.

Methods

Init

AddString

ClearList

DeleteString

GetClassName

GetCount

GetMsgID

GetSelIndex

GetSelString

GetStringLen

GetString

InsertString

SetSelIndex

SetSelString

Transfer


TListBox.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnId: Integer; X,Y,W,H: Integer);

Description

(Override: Sometimes)  Constructs a list box object with the:

-	passed parent window (AParent)

-	control ID (AnId)

-	position (X, Y) relative to the origin of the parent window's client area

-	 width (W)

-	height (H).

It calls TControl.Init and adds to the list box object's Attr.Style field the Windows style constant lbs_Standard, which provides the scroll bar with:

-	A border (ws_Border)

-	A vertical scroll bar (ws_VScroll)

-	Automatic alphabetic sorting of list items (lbs_Sort)

-	Parent window notification upon selection (lbs_Notify)

These styles can be overridden in a descendant class, or in the Init constructor of the list box's parent window object.

See Also

TListBox


TListBox.AddString     (method)

Syntax

function AddString(AString: PChar): Integer; virtual;

Description

(Override: Sometimes)  Adds AString as a list item in the list box object, and returns the item's position index (starting at zero) or a negative value in the case of an error.

The list items are automatically sorted unless the style lbs_Sort is removed from the list box object's Attr.Style field before creation.

See Also

TListBox


TListBox.ClearList     (method)

Syntax

procedure ClearList; virtual;

Description

(Override: Sometimes)  Removes all of the list items from the list box.

See Also

TListBox


TListBox.DeleteString     (method)

Syntax

function DeleteString(Index: Integer): Integer; virtual;

Description

(Override: Sometimes)  Removes the list item at the position index (starting at zero) passed in Index. DeleteString returns the number of remaining list items, or a negative value in the case of an error.

See Also

TListBox


TListBox.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Never)  Returns the name of the TListBox window class, 'ListBox'.

See Also

TListBox


TListBox.GetCount     (method)

Syntax

function GetCount: Integer; virtual;

Description

(Override: Seldom)  Returns the number of list items in the list box, or a negative value in the case of an error.

See Also

TListBox


TListBox.GetSelIndex (method)
TListBox.SelIndex     (method)

Syntax

function GetSelIndex: Integer; virtual;

Description

(Override: Seldom)  Returns the position index (starting at zero) of the currently selected list item, or a negative value in the case that no item is selected.

See Also

TListBox


TListBox.GetMsgID     (method)

Syntax

function GetMsgID(AMsg: TMsgName): virtual;

Description

Translates list box messages for use by TComboBox objects.

See Also

TListBox


TListBox.GetSelString     (method)

Syntax

function GetSelString(AString: PChar; MaxChars: Integer): Integer; virtual;

Description

(Override: Seldom)  Retrieves in AString the currently selected list item, as long as it is no longer than MaxChars.

GetSelString returns the string length or a negative value in the case of an error.

See Also

TListBox


TListBox.GetString     (method)

Syntax

function GetString(AString: PChar; Index: Integer): Integer; virtual;

Description

(Override: Seldom)  Retrieves in AString the list item at the position index (starting at zero) passed in Index, and returns the string length or a negative value in the case of an error.

See Also

TListBox


TListBox.GetStringLen     (method)

Syntax

function GetStringLen(Index: Integer): Integer; virtual;

Description

(Override: Seldom)  Returns the string length of the list item at the position index passed in Index, or a negative value in the case of an error.

See Also

TListBox


TListBox.InsertString     (method)

Syntax

function InsertString(AString: PChar; Index: Integer): Integer; virtual;

Description

(Override: Sometimes)  Inserts AString as a list item in the list box at the position index passed in Index, and returns the item's actual position (starting at zero) or a negative value in the case of an error. The list box items are not resorted. If Index  is -1, the string is appended to the end of the list.

See Also

TListBox


TListBox.SetSelIndex     (method)

Syntax

function SetSelIndex(Index: Integer): Integer; virtual;

Description

(Override: Seldom)  Forces the selection of the list item at the position index (starting at zero) passed in Index. If Index is -1, the list box is cleared of any selection. SetSelIndex returns a negative number in the case of an error.

See Also

TListBox


TListBox.SetSelString     (method)

Syntax

function SetSelString(AString: PChar; AIndex: Integer): Integer; virtual;

Description

(Override: Seldom)  Forces the selection of the first list item matching the text passed in AString that appears beyond the position index (starting at zero) passed in AIndex.

If AIndex is -1, the entire list is searched from the beginning. SetSelString returns the position index of the newly selected item, or a negative value in the case of an error.

See Also

TListBox


TListBox.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word): Word; virtual;

Description

Transfers the list of entries and selected item(s) to or from the transfer record pointed to by DataPtr.

-	If TransferFlag is tf_GetData, the list box's data is transferred to the memory location. The number of bytes transferred is returned.

-	If TransferFlag is tf_SetData, the list box is loaded with the data from the memory location. The number of bytes transferred is returned.

-	If TransferFlag is tf_SizeData, Transfer returns the size of the transfer data.

The record varies, depending on where the box allows multiple items to be selected: The first item transferred is always a pointer to a collection of strings, which are the list box's entires.

-	For single-selection list boxes, the pointer is followed by an integer index to the selected item.

-	For multiple-selection list boxes, the collection is followed by a pointer to a TMultiSelRec record, which contains an array of integers, each indicating a selected item.

See Also

TListBox


TMDIClient
TMDIClient     (WObjects unit)

Multiple Document Interface (MDI) client windows, represented by TMDIClient, are controls that manage the MDI child windows of an MDI-compliant application. TMDIClient's methods are concerned with managing MDI child windows.

Fields

ClientAttr

Methods

Init

Load

ArrangeIcons

CascadeChildren

GetClassName

Store

TileChildren


TMDIClient.ClientAttr     (field)

Syntax

ClientAttr: TClientCreateStruct;

Description

ClientAttr holds a record of the MDI client window's attributes. TClientCreateStruct is defined as:

type

   PClientCreateStruct = ^TClientCreateStruct;

   TClientCreateStruct = record

      hWindowMenu: THandle;

      idFirstChild: Word;

  end;

See Also

TMDIClient


TMDIClient.Init     (method)

Syntax

constructor Init(AParent: PMDIWindow);

Description

(Override: Seldom)  Constructs the MDI client window object with AParent as the parent window. Init sets the fields of ClientAttr. Calls TControl.Init and adds the Windows style ws_ClipChildren to the window object's Attr.Style field.

In addition, Init removes the client window from its parent's child window list, so it is not treated as other child windows, such as list boxes and buttons.

See Also

TMDIClient


TMDIClient.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads an MDI client window from the stream S by first calling TControl.Load and then reading the additional field (ClientAttr) introduced by TMDIClient.

See Also

TMDIClient

TWindow.Load


TMDIClient.ArrangeIcons     (method)

Syntax

procedure ArrangeIcons; virtual;

Description

(Override: Seldom)  Arranges the minimized MDI child windows into a neat row at the bottom of the MDI client window.

See Also

TMDIClient


TMDIClient.CascadeChildren     (method)

Syntax

procedure CascadeChildren; virtual;

Description

(Override: Seldom)  Sizes and arranges all of the non-minimized MDI child windows within the MDI client window so as to overlap and display the title bar of each one.

See Also

TMDIClient


TMDIClient.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

Returns TControl's window class name, 'MDIClient'.

See Also

TMDIClient


TMDIClient.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the MDI client window on the stream S by first calling TControl.Store and then writing the additional field (ClientAttr) introduced by TMDIClient.

See Also

TMDIClient

TWindow.Store


TMDIClient.TileChildren     (method)

Syntax

procedure TileChildren; virtual;

Description

(Override: Seldom)  Sizes and arranges all of the non-minimized MDI child windows within the MDI client window so as to take up all the available space without overlapping.

See Also

TMDIClient


TMDIWindow
TMDIWindow     (WObjects unit)

Multiple Document Interface (MDI) frame windows, represented by TMDIWindow, are overlapped windows that serve as the main window of MDI-compliant applications.

One major feature of TMDIWindow objects is that they own a TMDIClient object and store it in the ClientWnd field.

Another feature is the child window menu that offers options for manipulating the application's MDI child windows. This window is automatically modified to reflect all displayed MDI child windows.

Fields

ChildMenuPos

ClientWnd

Methods

Init

Load

Done

ArrangeIcons

CascadeChildren

CloseChildren

CMArrangeIcons

CMCascadeChildren

CMCloseChildren

CMCreateChild

CMTileChildren

CreateChild

DefWndProc

GetClassName

GetClient

GetWindowClass

InitChild

InitClientWindow

SetupWindow

Store

TileChildren


TMDIWindow.ChildMenuPos     (field)

Syntax

ChildMenuPos: Integer;   (Read/write)

Description

ChildMenuPos specifies an index identifying the position of the child window management menu. The index counts only top-level menu items and the top-left item is at position zero.

See Also

TMDIWindow


TMDIWindow.ClientWnd     (field)

Syntax

ClientWnd: PMDIClient;   (Read only)

Description

ClientWnd points to the MDI frame window's MDI client window, an object instance of TMDIClient.

See Also

TMDIWindow


TMDIWindow.Init     (method)

Syntax

constructor Init(ATitle: PChar; AMenu: HMenu);

Description

(Override: Often)  Constructs an MDI frame window object using the caption passed in ATitle and the menu passed in AMenu.

MDI frame windows are required to have menus. An MDI frame window has no parent window, and must be the main window of the application. As a default, Init sets ChildMenuPos to zero, indicating that the child window menu is the top-left menu.

To modify ChildMenuPos, override Init in your descendant types. For example:

constructor MyMDIWindow.Init(ATitle: PChar; AMenu: HMenu);

begin

   TMDIWindow.Init(ATitle, AMenu);

   ChildMenuPos := 3;

end;

See Also

InitClientWindow

TMDIWindow


TMDIWindow.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads an MDI frame window from the stream S by first calling TWindow.Load and then getting and reading the additional fields (ClientWnd and ChildMenuPos) introduced by TMDIWindow.

See Also

TMDIWindow


TMDIWindow.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Sometimes)  Disposes the MDI client window object stored in ClientWnd before calling TWindow.Done to dispose the MDI frame window object.

See Also

TMDIWindow


TMDIWindow.ArrangeIcons     (method)

Syntax

procedure ArrangeIcons;

Description

(Override: Seldom)  Arranges the minimized MDI child windows into a neat row at the bottom of the MDI client window. Calls ClientWnd^.ArrangeIcons.

See Also

TMDIClient.ArrangeIcons

TMDIWindow


TMDIWindow.CMArrangeIcons     (method)

Syntax

procedure CMArrangeIcons(var Msg: TMessage); virtual cm_First + cm_ArrangeIcons;

Description

(Override: Seldom)  Responds to a menu selection with an ID of cm_ArrangeChildIcons by calling ArrangeIcons.

See Also

TMDIWindow


TMDIWindow.CascadeChildren     (method)

Syntax

procedure CascadeChildren;

Description

(Override: Seldom)  Sizes and arranges all of the non-minimized MDI child windows within the MDI client window so as to overlap and display the title bar of each one. Calls ClientWnd^.CascadeChildren.

See Also

TMIDClient.CascadeChildren

TMDIWindow


TMDIWindow.CMCascadeChildren     (method)

Syntax

procedure CMCascadeChildren(var Msg: TMessage); virtual cm_First + cm_CascadeChildren;

Description

(Override: Seldom)  Responds to a menu selection with an ID of cm_CascadeChildren by calling CascadeChildren.

See Also

TMDIWindow


TMDIWindow.CMCloseChildren     (method)

Syntax

procedure CMCloseChildren(var Msg: TMessage); virtual cm_First + cm_CloseChildren;

Description

(Override: Seldom)  Responds to a menu selection with an ID of cm_CloseChildren by calling CloseChildren.

See Also

TMDIWindow


TMDIWindow.CloseChildren     (method)

Syntax

procedure CloseChildren;

Description

(Override: Seldom)  Destroys all of the created MDI child windows for which CanClose returns True.

See Also

TMDIWindow


TMDIWindow.CreateChild     (method)

Syntax

function CreateChild: PWindowsObject; virtual;

Description

Constructs and creates a new MDI child window by calling InitChild and MakeWindow. You need not override CreateChild to accommodate descendant MDI child window types, as is true with InitChild.

CreateChild returns a pointer to the new MDI child window.

See Also

TApplication.MakeWindow

TMDIWindow


TMDIWindow.CMCreateChild     (method)

Syntax

procedure CMCreateChild(var Msg: TMessage); virtual cm_First + cm_CreateChild;

Description

(Override: Never)  Responds to a menu selection with a menu ID of cm_CreateChild by calling CreateChild to produce a new child window.

See Also

TMDIWindow


TMDIWindow.DefWndProc     (method)

Syntax

procedure DefWndProc(var Msg: TMessage); virtual;

Description

Overrides TWindow's default Windows message processing by calling the Windows function DefFrameProc rather than DefWindowProc.

See Also

TMDIWindow

TWindow.DefWndProc


TMDIWindow.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Sometimes)  Returns the name of TMDIWindow's window class name, 'TurboMDIWindow'.

See Also

TMDIWindow


TMDIWindow.GetClient     (method)

Syntax

function GetClient: PMDIClient; virtual;

Description

(Override: Never)  Returns a pointer to the MDI client window stored in ClientWnd.

See Also

TMDIWindow


TMDIWindow.GetWindowClass     (method)

Syntax

procedure GetWindowClass(var AWndClass: TWndClass); virtual;

Description

(Override: Sometimes)  Modifies the default window class record and passes it back in AWndClass. GetWindowClass sets the style field to zero to remove the styles set by TWindow.GetWindowClass.

See Also

TMDIWindow


TMDIWindow.InitClientWindow     (method)

Syntax

procedure InitClientWindow; virtual;

Description

(Override: Sometimes)  Constructs the MDI client window as a TMDIClient object and stores it in ClientWnd.

See Also

TMDIWindow


TMDIWindow.InitChild     (method)

Syntax

function InitChild: PWindowsObject; virtual;

Description

(Override: Often)  Constructs an MDI child window object (TWindow) with a caption of 'MDI Child' and returns a pointer to it.

If you define an MDI child window type descending from TWindow, override InitChild to construct a window of your new MDI child window type. For example:

function MyMDIWindow.InitChild: PWindowsObject;

begin

   InitChild := New(PMyMDIChild, Init(@Self, 'Untitled Window'));

end;

See Also

CreateChild

TMDIWindow


TMDIWindow.SetupWindow     (method)

Syntax

procedure SetupWindow; virtual;

Description

(Override: Often)  Constructs the MDI client window (ClientWnd) object's corresponding window element by calling InitClientWindow, and creates it by calling MakeWindow.

If you override SetupWindow in a descendant type, be sure to call TMDIWindow.SetupWindow explicitly.

See Also

InitClientWindow

TApplication.MakeWindow

TMDIWindow


TMDIWindow.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the MDI frame window on the stream S by first calling TWindow.Store and then putting and writing the additional fields (ClientWnd and ChildMenuPos) introduced by TMDIWindow.

See Also

TMDIWindow


TMDIWindow.TileChildren     (method)

Syntax

procedure TileChildren;

Description

(Override: Seldom)  Sizes and arranges all of the non-minimized MDI child windows within the MDI client window so as to take up all the available space without overlapping. Calls ClientWnd^.TileChildren.

See Also

TMDIClient.TileChildren

TMDIWindow


TMDIWindow.CMTileChildren     (method)

Syntax

procedure CMTileChildren(var Msg: TMessage); virtual cm_First + cm_TileChildren;

Description

(Override: Seldom)  Responds to a menu selection with an ID of cm_TileChildren by calling TileChildren.

See Also

TMDIWindow


TObject
TObject     (WObjects unit)

TObject is the starting point of the Object Windows object hierarchy. As the base object, it has no parents but many descendants. Apart from TPoint and TRect, all ObjectWindows standard objects are ultimately derived from TObject. Any object that uses the ObjectWindows streams facilities must trace its ancestry back to TObject.

Methods

Init

Free

Done


TObject.Init     (method)

Syntax

constructor Init;

Description

Allocates space on the heap for the object.

Called by all derived objects' constructors.

See Also

TObject


TObject.Free     (method)

Syntax

procedure Free;

Description

Disposes of the object and calls the Done destructor.

See Also

TObject


TObject.Done     (method)

Syntax

destructor Done; virtual;

Description

Performs the necessary cleanup and disposal for dynamic objects.

See Also

TObject


TRadioButton
TRadioButton     (WObjects unit)

TRadioButton is an interface object that represents a corresponding radio button element in Windows.

TRadioButton objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used when you want to display a stand-alone radio button as a child window in another window's client area.

Radio buttons have two states: checked and unchecked.

TRadioButton inherits its state-management methods from its ancestor, TCheckBox.

Optionally, a check box can be part of a group (TGroupBox), which visually and conceptually groups its controls.

Methods

Init


TRadioButton.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnID: Integer; ATitle: PChar; X,Y,W,H: Integer; AGroup: PGroupBox);

Description

(Override: Sometimes)

Constructs a radio button object with the:

-	passed parent window (AParent)

-	control ID (AnId)

-	associated text (ATitle)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H)

-	associated group box (AGroup).

Init sets the check box's Attr.Style field to ws_Child or ws_Visible or bs_RadioButton.

See Also

TRadioButton

ws_ Window styles


TScrollBar
TScrollBar     (WObjects unit)

TScrollBar objects represent stand-alone scroll bar controls, but not the scroll bars that are attached to windows.

Scroll bars can be vertical (scrolls up and down) or horizontal (scrolls right and left). Most of TScrollBar's methods manage the scroll bar's thumb position and range.

One special feature of the type TScrollBar is the set of methods that automatically respond to the Windows scroll bar messages, wm_HScroll and wm_VScroll.

The methods, such as SBLineUp and SBPageDown, are defined as notify-based methods. They automatically adjust the scroll bar's thumb position.

Fields

LineMagnitude

PageMagnitude

Methods

Init

Load

DeltaPos

GetClassName

GetPosition

GetRange

SBBottom

SBLineDown

SBLineUp

SBPageDown

SBPageUp

SBThumbPosition

SBThumbTrack

SBTop

SetPosition

SetRange

SetupWindow

Store

Transfer


TScrollBar.LineMagnitude     (field)

Syntax

LineMagnitude: Integer;   (Read/write)

Description

LineMagnitude is the number of range units to scroll the scroll bar when the user requests a small movement by clicking on the scroll bar's arrows.

Init sets LineMagnitude to 1 by default. SetupWindow sets the scroll range from zero to 100 by default.

See Also

TScrollBar


TScrollBar.PageMagnitude     (field)

Syntax

PageMagnitude: Integer;   (Read/write)

Description

PageMagnitude is the number of range units to scroll the scroll bar when the user requests a large movement by clicking in the scroll bar's scrolling area.

Init sets PageMagnitude to 10 by default. (The scroll range is set to from zero to 100 by default.)

See Also

TScrollBar


TScrollBar.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnID: Integer; X,Y,W,H: Integer; IsHScrollBar: Boolean);

Description

Constructs and initializes a TScrollBar object with the:

-	given parent window (AParent)

-	AnID as a control ID

-	a position of (X, Y)

-	a width of W

-	a height of H

The scroll bar is horizontal (style sbs_Horz) if IsHScrollBar is True and vertical (style sbs_Vert) if it is False.

If the supplied height for a horizontal scroll bar or the supplied width for a vertical scroll bar is zero, a standard value is used. LineMagnitude is initialized to 1 and PageMagnitude to 10.

See Also

sbs_ Scroll bar styles

TScrollBar


TScrollBar.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a scroll bar control from the stream S by first calling TControl.Load and then reading the additional fields (LineMagnitude and PageMagnitude) introduced by TScrollBar.

See Also

TScrollBar

TWindow.Load


TScrollBar.DeltaPos     (method)

Syntax

function DeltaPos(Delta: Integer): Integer; virtual;

Description

(Override: Seldom)  Changes the scroll bar's thumb position by the value passed in Delta. (Calls SetPosition.) A negative value moves the thumb up or left. The new thumb position is returned.

See Also

TScrollBar


TScrollBar.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Never)  Returns the name of TScrollBar's window class, 'Scrollbar'.

See Also

TScrollBar


TScrollBar.GetPosition     (method)

Syntax

function GetPosition: Integer; virtual;

Description

(Override: Seldom)  Returns the scroll bar's current thumb position.

See Also

SetPosition

TScrollBar


TScrollBar.GetRange     (method)

Syntax

procedure GetRange(var LoVal, HiVal: Integer); virtual;

Description

(Override: Seldom)  Retrieves the allowed range of scroll bar thumb positions in LoVal and HiVal.

See Also

SetRange

TScrollBar


TScrollBar.SBBottom     (method)

Syntax

procedure SBBottom(var Msg: TMessage); virtual nf_First + sb_Bottom;

Description

(Override: Seldom)  Sets the thumb position to the highest allowable value in response to the user's request.

This method is called in response to a scroll-based message carrying the code sb_Bottom. (Calls SetPosition.)

See Also

TScrollBar


TScrollBar.SBLineDown     (method)

Syntax

procedure SBLineDown(var Msg: TMessage); virtual nf_First + sb_LineDown;

Description

(Override: Seldom)  Moves the thumb position down or right by LineMagnitude.

SBLineDown is called automatically in response to a scroll-based message carrying the code sb_LineDown. (Calls SetPosition.)

See Also

TScrollBar


TScrollBar.SBLineUp     (method)

Syntax

procedure SBLineUp(var Msg: TMessage); virtual nf_First + sb_LineUp;

Description

(Override: Seldom)  Moves the thumb position up or left by LineMagnitude.

sb_LineUp is called automatically in response to a scroll-based message carrying the code sb_LineUp . (Calls SetPosition.) Sent when the user clicks on the scrollbar's "up" arrow, etc.

See Also

TScrollBar


TScrollBar.SBPageDown     (method)

Syntax

procedure SBPageDown(var Msg: TMessage); virtual nf_First + sb_PageDown;

Description

(Override: Seldom)  Moves the thumb position down or right by PageMagnitude. SBPageDown is called automatically in response to a scroll-based message carrying the code sb_PageDown. (Calls SetPosition.)

See Also

TScrollBar


TScrollBar.SBPageUp     (method)

Syntax

procedure SBPageUp(var Msg: TMessage); virtual nf_First + sb_PageUp;

Description

(Override: Seldom)  Moves the thumb position up or left by PageMagnitude. SBPageUp is called automatically in response to a scroll-based message carrying the code sb_PageUp. (Calls SetPosition.)

See Also

TScrollBar


TScrollBar.SBThumbPosition     (method)

Syntax

procedure SBThumbPosition(var Msg: TMessage); virtual nf_First + sb_ThumbPosition;

Description

(Override: Seldom)  Changes the thumb position to position chosen by the user and passed in a scroll-based message carrying the code sb_ThumbPosition. (Calls SetPosition.)

See Also

TScrollBar


TScrollBar.SBThumbTrack     (method)

Syntax

procedure SBThumbTrack(var Msg: TMessage); virtual nf_First + sb_ThumbTrack;

Description

(Override: Sometimes)  Changes the thumb position as the user drags the thumb. (Calls SetPosition.)

This method is called in response to a scroll-based message carrying the code sb_ThumbTrack.

See Also

TScrollBar


TScrollBar.SBTop     (method)

Syntax

procedure SBTop(var Msg: TMessage); virtual nf_First + sb_Top;

Description

(Override: Seldom)  Sets the thumb position to the lowest allowable value in response to the user's request.

This method is called in response to a scroll-based message carrying the code sb_Top. (Calls SetPosition.)

See Also

TScrollBar


TScrollBar.SetPosition     (method)

Syntax

procedure SetPosition(ThumbPos: Integer); virtual;

Description

(Override: Sometimes)  Sets the scroll bar's thumb position to ThumbPos.

-	If ThumbPos is higher than the allowable range, the thumb position is set to the highest allowable value.

-	If ThumbPos is lower than the allowable range, the thumb is set to the lowest possible value.

See Also

GetPosition

TScrollBar


TScrollBar.SetRange     (method)

Syntax

procedure SetRange(LoVal, HiVal: Integer); virtual;

Description

(Override: Seldom)  Sets the scroll bar's allowable range of thumb positions from LoVal to HiVal.

See Also

GetRange

TScrollBar


TScrollBar.SetupWindow     (method)

Syntax

procedure SetupWindow; virtual;

Description

(Override: Sometimes)  Initializes the scroll bar's range from zero to 100. To override this range, call SetRange.

See Also

TScrollBar


TScrollBar.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the scroll bar control on the stream S by first calling TControl.Store and then writing the additional fields (LineMagnitude and PageMagnitude) introduced by TScrollBar.

See Also

TScrollBar

TWindow.Store


TScrollBar.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word): Word; virtual;

Description

(Override: Sometimes)  Transfers the scroll bar's range and current position to or from the memory location pointed to by DataPtr.

-	If TransferFlag is tf_GetData, a special record holding the range and position is transferred to the memory location.

-	If TransferFlag is tf_SetData, the special record at the memory location retrieved its values are used to set the range and position of the scroll bar.

In both cases, Transfer returns the number of bytes stored in or retrieved from the memory location.

The special record is defined as follows:

ScrollBarTransferRec = record

   LowValue: Integer;

   HighValue: Integer;

   Position: Integer;

end;

See Also

TScrollBar


TScroller
TScroller     (WObjects unit)

TScroller objects exist in the Scroller field of TWindow and descendant objects.

The TScroller object provides a window an automatic window scrolling mechanism that works in conjunction with horizontal or vertical window scroll bars or without any scroll bars.

It supports a technique called auto-scrolling, which does not require scroll bars.

Typically, you will construct and manipulate TScroller objects from within the methods of their owner window objects.

Fields

AutoMode

AutoOrg

HasHScrollBar

HasVScrollBar

TrackMode

Window

XLine

XPage

XPos

XRange

XUnit

YLine

YPage

YPos

YRange

YUnit

Methods

Init

Load

AutoScroll

BeginView

EndView

HScroll

IsVisibleRect

ScrollBy

ScrollTo

SetPageSize

SetRange

SetSBarRange

SetUnits

Store

VScroll


TScroller.Window     (field)

Syntax

Window: PWindow;   (Read only)

Description

Window points to the TScroller's owner window.

See Also

TScroller


TScroller.XUnit     (field)

Syntax

XUnit: Integer;   (Read only)

Description

XUnit is the smallest number of device units (pixels) that the window can be horizontally scrolled.

XUnit values are specified in the Init constructor, but can be modified later.

See Also

TScroller


TScroller.YUnit     (field)

Syntax

YUnit: Integer;   (Read only)

Description

YUnit is the smallest number of device units (pixels) that the window can be vertically scrolled.

YUnit values are specified in the Init constructor, but can be modified later.

See Also

TScroller


TScroller.XPos     (field)

Syntax

XPos: Longint;   (Read only)

Description

XPos is the scroller's current horizontal position in terms of XUnit units.

See Also

TScroller


TScroller.YPos     (field)

Syntax

YPos: Longint;   (Read only)

Description

YPos is the scroller's current vertical position in terms of YUnit units.

See Also

TScroller


TScroller.XRange     (field)

Syntax

XRange: Longint;   (Read only)

Description

XRange is the total number of horizontal XUnit units the window can be scrolled.

XRange values are specified in the Init constructor, but can be modifed later.

See Also

TScroller


TScroller.YRange     (field)

Syntax

YRange: Longint;   (Read only)

Description

YRange is the total number of vertical YUnit units the window can be scrolled.

YRange values are specified in the Init constructor, but can be modifed later.

See Also

TScroller


TScroller.XLine     (field)

Syntax

XLine: Integer;   (Read/write)

Description

XLine is the number of XUnit units to scroll horizontally in response to a click on the scroll bar arrow.

The default value is 1.

See Also

TScroller


TScroller.YLine     (field)

Syntax

YLine: Integer;   (Read/write)

Description

YLine is the number of YUnit units to scroll vertically in response to a click on the scroll bar arrow. The default value is 1.

See Also

TScroller


TScroller.XPage     (field)

Syntax

XPage: Integer;   (Read/write)

Description

XPage is the number of XUnit units to scroll horizontally in response to a click on the scroll bar's thumb area.

By default, XPage is equal to the current width of the window in XUnit units. Resizing the window updates this value.

See Also

TScroller


TScroller.YPage     (field)

Syntax

YPage: Integer;   (Read/write)

Description

YPage is the number of YUnit units to scroll vertcially in response to a click on the scroll bar's thumb area.

By default, YPage is equal to the current height of the window in YUnit units. Resizing the window updates this value.

See Also

TScroller


TScroller.AutoMode     (field)

Syntax

AutoMode: Boolean;   (Read/write)

Description

AutoMode is True if the scroller is in auto-scrolling mode.

By default, AutoMode is True.

See Also

TScroller


TScroller.AutoOrg     (field)

Syntax

AutoOrg: Boolean;

Description

AutoOrg is used to control automatic adjustment of the origin of the display context used for painting the window.

-	If AutoOrg is True (the default), the origin of the Paint method's display context will be set to the origin of the scroller.

-	If False, the display context's origin is (0,0) and Paint must read the scroll bar offsets itself to determine how to position objects on the display context.

See Also

TScroller


TScroller.TrackMode     (field)

Syntax

TrackMode: Boolean;   (Read/write)

Description

TrackMode is True if the scroller automatically tracks scroll bar thumb movements by scrolling the window.

By default, TrackMode is True.

See Also

TScroller


TScroller.HasHScrollBar     (field)

Syntax

HasHScrollBar: Boolean;   (Read/write)

Description

If the owner window has a horizontal window scroll bar, HasHScrollBar is True.

See Also

TScroller


TScroller.HasVScrollBar     (field)

Syntax

HasVScrollBar: Boolean;   (Read/write)

Description

If the owner window has a vertical window scroll bar, HasVScrollBar is False.

See Also

TScroller


TScroller.Init     (method)

Syntax

constructor Init(TheWindow: PWindow; TheXUnit, TheYUnit: Integer; TheXRange, TheYRange: Longint);

Description

Constructs a new TScroller object with TheWindow as the owner window, and TheXUnit, TheYUnit, TheXRange, and TheYRange as XUnit, YUnit, XRange and YRange, respectively.

Sets AutoMode and TrackMode to True and sets HasHScrollBar and HasVScrollBar depending on the scroll bar attributes of the owner window.

See Also

TScroller


TScroller.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a scroller from the stream S by first calling TObject.Init and then reading the TScroller fields, with the exception of XPage, YPage, XPos and YPos.

See Also

TScroller


TScroller.AutoScroll     (method)

Syntax

procedure AutoScroll; virtual;

Description

(Override: Sometimes)  Depending on the position of the mouse cursor, performs auto-scrolling.

See Also

TScroller


TScroller.BeginView     (method)

Syntax

procedure BeginView(PaintDC: HDC; var PaintInfo: TPaintStruct); virtual;

Description

(Override: Sometimes)  Sets the origin of the owner window's paint display context (PaintDC) according to the current scroller position.

See Also

TScroller


TScroller.EndView     (method)

Syntax

procedure EndView; virtual;

Description

(Override: Sometimes)  Updates the position of the owner window's scroll bars to be in sync with the position of the TScroller.

See Also

TScroller


TScroller.HScroll     (method)

Syntax

procedure HScroll(ScrollRequest: Word; ThumbPos: Integer); virtual;

Description

(Override: Never)  Responds to horizontal scroll bar events by changing the position of the scroller and the horizontal scroll bar.

See Also

TScroller

TWindow.WMHScroll


TScroller.IsVisibleRect     (method)

Syntax

function IsVisibleRect(X, Y: Longint; XExt, YExt: Integer): Boolean; virtual;

Description

(Override: Seldom)  Returns True if any portion of the rectangle specified by the passed arguments is currently visible in the owner window.

See Also

TScroller


TScroller.ScrollBy     (method)

Syntax

procedure ScrollBy(Dx, Dy: Longint); virtual;

Description

(Override: Seldom)  Scrolls by the amounts specified by Dx and Dy. Also updates the window's display.

See Also

TScroller


TScroller.ScrollTo     (method)

Syntax

procedure ScrollTo(X, Y: Longint); virtual;

Description

(Override: Sometimes)  Scrolls to the position specified by X and Y. Also updates the window's display.

See Also

TScroller


TScroller.SetPageSize     (method)

Syntax

procedure SetPageSize; virtual;

Description

(Override: Sometimes)  Sets the XPage and YPage fields to be the owner window's current width and height, respectively.

See Also

TScroller

TWindow.WMSize


TScroller.SetRange     (method)

Syntax

procedure SetRange(TheXRange, TheYRange: Longint); virtual;

Description

(Override: Never)  Overrides the XRange and YRange values passed in the call to Init by setting them to TheXRange and TheYRange.

Then calls SetSBarRange to set the range of the owner window's scroll bars.

See Also

TScroller


TScroller.SetSBarRange     (method)

Syntax

procedure SetSBarRange; virtual;

Description

(Override: Never)  Sets the range of the of the owner window's scroll bars to be in sync with the range of the TScroller.

See Also

TScroller

TWindow.SetupWindow


TScroller.SetUnits     (method)

Syntax

procedure SetUnits(TheXUnit, TheYUnit: Longint);virtual;

Description

Sets the XUnit and YUnit fields to TheXUnit and TheYUnit, respectively.

See Also

TScroller


TScroller.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the scroller on the stream S by writing the TScroller fields, with the exception of XPage, YPage, XPos and YPos.

See Also

TScroller


TScroller.VScroll     (method)

Syntax

procedure VScroll(ScrollRequest: Word; ThumbPos: Integer); virtual;

Description

(Override: Never)  Responds to vertical scroll bar events by changing the position of the scroller and the vertical scroll bar.

See Also

TScroller

TWindow.WMVScroll


TSortedCollection
TSortedCollection     (WObjects unit)

TSortedCollection is a specialized derivative of TCollection. It implements collections sorted by key without duplicates.

Sorting is implied by a virtual TSortedCollection.Compare method which you override to provide your own definition of element ordering.

As new items are added, they are automatically inserted in the order given by the Compare method.

Items can be located using the binary search method, TSortedCollection.Search.

The virtual KeyOf method that returns a pointer for Compare can also be overridden if Compare needs additional information.

Fields

Duplicates

Methods

Load

Compare

IndexOf

Insert

KeyOf

Search

Store


TSortedCollection.Duplicates     (field)

Syntax

Duplicates: Boolean;

Description

The Duplicates field determines whether items with duplicates keys will be accepted by the stream.

-	If Duplicates is True, duplicate-key entries will be inserted into the collection.

-	If Duplicates is False, a new duplicate-key item will replace the existing item with that key.

The default value is false.

See Also

TSortedCollection


TSortedCollection.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a sorted collection from the stream S by first calling TCollection.Load. It then reads the Duplicates field.

See Also

TSortedCollection


TSortedCollection.Compare     (method)

Syntax

function Compare(Key1, Key2: Pointer): Integer; virtual;

Description

(Override: Always)  Compare is an abstract method that must be overridden in all descendant types.

Compare should compare the two key values, and return a result as follows:

-1	if Key1 < Key2

 0	if Key1 = Key2

 1	if Key1 > Key2

Key1 and Key2 are pointer values, as extracted from their corresponding collection items by the KeyOf method. The Search method implements a binary search through the collection's items using Compare to compare the items.

See Also

TSortedCollection


TSortedCollection.IndexOf     (method)

Syntax

function IndexOf(Item: Pointer): Integer; virtual;

Description

(Override: NeverUses)  Search to find the index of the given Item. If the item is not in the collection, IndexOf returns -1. The actual implementation of IndexOf is:

if Search(KeyOf(Item), I) then IndexOf := I else IndexOf := -1;

See Also

TSortedCollection


TSortedCollection.Insert     (method)

Syntax

procedure Insert(Item: Pointer); virtual;

Description

(Override: Never)  If the target item is not found in the sorted collection, it is inserted at the correct index position. Calls Search to determine if the item exists, and if not, where to insert it.

The actual implementation of Insert is:

if not Search(KeyOf(Item), I) then AtInsert(I, Item);

See Also

TSortedCollection


TSortedCollection.KeyOf     (method)

Syntax

function KeyOf(Item: Pointer): Pointer; virtual;

Description

(Override: Sometimes)  Given an Item from the collection, KeyOf should return the corresponding key of the item. The default KeyOf simply returns Item.

KeyOf is overridden in cases where the key of the item is not the item itself.

See Also

IndexOf

TSortedCollection


TSortedCollection.Search     (method)

Syntax

function Search(Key: Pointer; var Index: Integer): Boolean; virtual;

Description

(Override: Seldom)  Returns True if the item identified by Key is found in the sorted collection.

If the item is found, Index is set to the found index; otherwise Index is set to the index where the item would be placed if inserted.

See Also

Compare

Insert

TSortedCollection


TSortedCollection.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the sorted collection and all its items on the stream S by calling TCollection.Store to write the collection.

It then writes the Duplicates field to the stream.

See Also

TSortedCollection


TStatic
TStatic     (WObjects unit)

TStatic is an interface object that represents a corresponding static control element in Windows. TStatic objects are not normally used in dialog boxes (TDialog) or dialog windows (TDlgWindow), but are used to display a standalone static control as a child window in another window's client area.

Fields

TextLen

Methods

Init

InitResorce

Load

Clear

GetClassName

GetText

SetText

Store

Transfer


TStatic.TextLen     (field)

Syntax

TextLen: Word;

Description

TextLen holds the size of the text buffer for static controls.

The number of characters that can actually be stored in the static control is one less than TextLen, because of the null terminator on the string.

TextLen is also the number of bytes transferred by the Transfer method.

See Also

TStatic


TStatic.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; AnID: Integer; ATitle: PChar; X,Y,W,H: Integer);

Description

(Override: Seldom)  Constructs a static control object with the:

-	passed parent window (AParent)

-	control ID (AnID)

-	text (ATitle)

-	position (X, Y) relative to the origin of the parent window's client area

-	width (W)

-	height (H)

-	text length (ATextLen)

The static control will be left justified because Init adds the Windows style ss_Left to the object's Attr.Style field. It also removes the ws_TabStop style.

Init then calls DisableTransfer to exclude TStatic objects from the transfer mechanism, by default.

See Also

TStatic


TStatic.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject; ResourceID, ATextLen: Word);

Description

Associates a TStatic object with the static control resource specified by ResourceID and sets the TextLen field to ATextLen.

Calls TControl.InitResource to construct and associate the object.

See Also

TStatic


TStatic.Clear     (method)

Syntax

procedure Clear; virtual;

Description

(Override: Seldom)  Clears the static control's text.

See Also

TStatic


TStatic.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a static control from the stream S by calling TControl.Load and then reading the TextLen field.

See Also

TStatic

TWindow.Load


TStatic.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Seldom)  Returns the name of TStatic's window class, 'Static'.

See Also

TStatic


TStatic.GetText     (method)

Syntax

function GetText(ATextString: PChar; MaxChars: Integer): Integer; virtual;

Description

(Override: Seldom)  Retrieves the static control's text and stores it in the ATextString argument.

MaxChars specifies the maximum size of ATextString. GetText returns the size of the retrieved string.

See Also

TStatic


TStatic.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the static control on the stream S by calling TControl.Store and then writing the TextLen field.

See Also

TStatic

TWindow.Store


TStatic.SetText     (method)

Syntax

procedure SetText(ATextString: PChar); virtual;

Description

(Override: Seldom)  Sets the static control's text to be the string passed in ATextString.

See Also

TStatic


TStatic.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word): Word; virtual;

Description

(Override: Sometimes)  Transfers TextLen characters of the current text of the static control to or from the memory location pointer to by DataPtr.

-	If TransferFlag is tf_GetData, the text is transferred to the memory location.

-	If TransferFlag is tf_SetData, the static control's text is set to the text at the memory location. Transfer returns TextLen (the number of bytes stored in or retrieved from the memory location).

-	If TransferFlag is tf_SizeData, Transfer returns the size of the transfer data.

See Also

TStatic


TStream
TStream     (WObjects unit)

TStream is a general abstract object providing polymorphic I/O to and from a storage device.

You can create your own derived stream objects by overriding the virtual methods: GetPos, GetSize, Read, Seek, Truncate, and Write.

Object Windows itself does this to derive TDosStream and TEmsStream.

For buffered derived streams, you must also override Flush.

Fields

ErrorInfo

Status

Methods

CopyFrom

Error

Flush

Get

GetPos

GetSize

Put

Read

ReadStr

Reset

Seek

StrRead

StrWrite

Truncate

Write

WriteStr


TStream.Status     (field)

Syntax

Status: Integer    (Read/write)

Description

Indicates the current status of the stream as follows:

TStream error codes

stOk	No error

stError	Access error

stInitError	Cannot initialize stream

stReadError	Read beyond end of stream

stWriteError	Cannot expand stream

stGetError	Get of unregistered object type

stPutError	Put of unregistered object type

If Status is not stOk all operations on the stream are suspended until Reset is called.

See Also

TStream


TStream.ErrorInfo     (field)

Syntax

ErrorInfo: Integer   (Read/write)

Description

ErrorInfo contains additional information when Status is not stOk:

Status Values	ErrorInfo

stError	DOS or EMS error code; if available

stInitError	DOS or EMS error code; if available

stReadError	DOS or EMS error code; if available

stWriteError	DOS or EMS error code; if available

stGetError	object type ID of unregistered object type

stPutError	VMT data segment offset of unregistered object type

See Also

TStream


TStream.CopyFrom     (method)

Syntax

procedure CopyFrom(var S: TStream; Count: Longint);

Description

Copy Count bytes from stream S to the calling stream object. For example:

{Create a copy of entire stream}

NewStream := New(TEmsStream, Init(OldStream^.GetSize));

OldStream^.Seek(0);

NewStream^.CopyFrom(OldStream, OldStream^.GetSize);

See Also

GetSize

TObject.Init

TStream


TStream.Error     (method)

Syntax

procedure Error(Code, Info: Integer); virtual;

Description

(Override: Sometimes)  Called whenever a stream error occurs. The default Error stores Code and Info in the Status and ErrorInfo fields and then, if the global variable StreamError is not nil, calls the procedure pointed to by StreamError.

Once an error has occurred, all stream operations on the stream are suspended until Reset is called.

See Also

TStream


TStream.Flush     (method)

Syntax

procedure Flush; virtual;

Description

(Override: Sometimes)  An abstract method that must be overridden if your descendant implements a buffer. This method can flush any buffers by clearing the read buffer, by writing the write buffer, or both.

The default Flush does nothing.

See Also

TBufStream.Flush

TStream


TStream.Get     (method)

Syntax

function Get: PObject;

Description

Reads an object from the stream. The object must have been previously written to the stream by Put.

-	Get first reads an object type ID (a word) from the stream.

-	It then finds the corresponding object type by comparing the ID to the ObjType field of all registered object types (see the TStreamRec type)

-	It finally calls the Load constructor of that object type to create and load the object.

If the object type ID read from the stream is zero, Get returns a nil pointer. If the object type ID has not been registered (using RegisterType), Get calls Error and returns a nil pointer. Otherwise, Get returns a pointer to the newly created object.

See Also

TStream


TStream.GetPos     (method)

Syntax

function GetPos: Longint; virtual;

Description

(Override: Always)  Returns the value of the calling stream's current position. This is an abstract method that must be overridden.

See Also

Seek

TStream


TStream.GetSize     (method)

Syntax

function GetSize: Longint; virtual;

Description

(Override: Always)  Returns the total size of the calling stream. This is an abstract method that must be overridden.

See Also

TStream


TStream.Put     (method)

Syntax

procedure Put(P: PObject);

Description

Writes an object to the stream. The object can later be read from the stream using Get.

-	Put first finds the type registration record of the object by comparing the object's VMT offset to the VmtLink field of all registered object types (see the TStreamRec type).

-	It then writes the object type ID (the ObjType field of the registration record) to the stream.

-	It finally calls the Store method of that object type to write the object.

If the P argument passed to Put is nil, Put writes a word containing zero to the stream. If the object type of P has not been registered (using RegisterType), Put calls Error and doesn't write anything to the stream.

See Also

TStream


TStream.Read     (method)

Syntax

procedure Read(var Buf; Count: Word); virtual;

Description

(Override: Always)  This is an abstract method that must be overridden in all descendant types. Read should read Count bytes from the stream into Buf and advance the current position of the stream by Count bytes.

If an error occurs, Read should call Error, and fill Buf with Count bytes of zero.

See Also

TStream

Write


TStream.ReadStr     (method)

Syntax

function ReadStr: PString;

Description

Reads a string from the current position of the calling stream, returning a PString pointer. ReadStr calls GetMem to allocate (Length+1) bytes for the string.

See Also

TStream

WriteStr


TStream.Reset     (method)

Syntax

procedure Reset;

Description

Resets any stream error condition by setting Status and ErrorInfo to zero. This method lets you continue stream processing following an error condition that you have corrected.

See Also

stXXXX

TStream


TStream.Seek     (method)

Syntax

procedure Seek(Pos: Longint); virtual;

Description

(Override: Always)  This is an abstract method that must be overridden by all descendants. Seek sets the current position to Pos bytes from the start of the calling stream. The start of a stream is position 0.

See Also

GetPos

TStream


TStream.StrRead     (method)

Syntax

function StrRead: PChar;

Description

Reads a null-terminated string from the stream by first reading the length of the string and then reading that number of characters. Returns a pointer to the null-terminated string read.

See Also

StrWrite

TStream


TStream.StrWrite     (method)

Syntax

function StrWrite(P: PChar);

Description

Writes the null-terminated string P to the stream by first writing the length of the string and then writing the number of characters.

See Also

StrRead

TStream


TStream.Truncate     (method)

Syntax

procedure Truncate; virtual;

Description

(Override: Always)  This is an abstract method that must be overridden by all descendants. Truncate deletes all data on the calling stream from the current position to the end.

See Also

GetPos

Seek

TStream


TStream.Write     (method)

Syntax

procedure Write(var Buf; Count: Word); virtual;

Description

(Override: Always)  This is an abstract method that must be overridden in all descendant types.

Write should write Count bytes from Buf onto the stream and advance the current position of the stream by Count bytes.

If an error occurs, Write should call Error.

See Also

Read

TStream


TStream.WriteStr     (method)

Syntax

procedure WriteStr(P: PString);

Description

Writes the string P^ to the calling stream, starting at the current position.

See Also

ReadStr

TStream


TStrCollection
TStrCollection     (WObjects unit)

TStrCollection is a simple derivative of TSortedCollection. It implements a sorted list of ASCII strings.

The Compare method is overridden to provide the conventional lexicographic ASCII string ordering. You can override Compare to allow for other orderings, such as those for non-English character sets.

Methods

Compare

FreeItem

GetItem

PutItem


TStrCollection.Compare     (method)

Syntax

function Compare(Key1, Key2: Pointer): Integer; virtual;

Description

(Override: Sometimes)  Compares the strings Key1^ and Key2^ as follows: return -1 if Key1 < Key2; 0 if Key1 = Key2; and +1 if Key1 > Key2.

See Also

TSortedCollection.Search

TStrCollection


TStrCollection.FreeItem     (method)

Syntax

procedure FreeItem(Item: Pointer); virtual;

Description

(Override: Seldom)  Removes the string Item^ from the sorted collection and disposes of the string.

See Also

TStrCollection


TStrCollection.GetItem     (method)

Syntax

function GetItem(var S: TStream): Pointer; virtual;

Description

(Override: Seldom)  By default, reads a string from the TStream by calling S.ReadStr.

See Also

TStrCollection

TStream.ReadStr


TStrCollection.PutItem     (method)

Syntax

procedure PutItem(var S: TStream; Item: Pointer); virtual;

Description

(Override: Seldom)  By default, writes the string Item^ on to the TStream by calling S.WriteStr.

See Also

TStream.WriteStr

TStrCollection


TWindow
TWindow     (WObjects unit)

TWindow defines the fundamental behavior for all window and control objects.

Object instances of TWindow are empty generic windows, but they can define menus, cursors and icons.

Fields

Attr

DefaultProc

FocusChildHandle

Scroller

Methods

Init

InitResource

Load

Done

Create

DefWndProc

GetID

GetWindowClass

Paint

SetupWindow

Store

WMActivate

WMCreate

WMHScroll

WMLButtonDown

WMMove

WMPaint

WMSize

WMVScroll


TWindow.Attr     (field)

Syntax

Attr: TWindowAttr;

Description

Attr holds a TWindowAttr record, which defines the windows creation attributes.

These include:

-	the window's associated text, style, extended style, position and size

-	the window handle

-	the control ID

These attributes are traditionally set to defaults in the object's Init constructor, but can be overridden in a descendant type's Init constructor.

Here is the record definition for TWindowAttr:

TWindowAttr = record

   Title: PChar;

   Style: Longint;

   ExStyle: Longint;

   X, Y, W, H: Integer;

   Param: Pointer;

   case Integer of

    0: (Menu: HMenu);  { window menu's handle or... }

    1: (Id: Integer);  { control's child identifier }

end;

See Also

TWindow


TWindow.DefaultProc     (field)

Syntax

DefaultProc: TFarProc;   (Read only)

Description

Holds the address of the default window procedure, which defines the Windows default processing for Windows messages.

See Also

TWindow


TWindow.FocusChildHandle     (field)

Syntax

FocusChildHandle: THandle;   (Read only)

Description

FocusChildHandle stores the Windows handle to the window's child window that currently had the focus the last time the window was activated.

See Also

TWindow


TWindow.Scroller     (field)

Syntax

Scroller: PScroller;   (Read/write)

Description

Scroller holds a pointer to a TScroller object, which is the window's scroller, if any. A scroller should be constructed in the window's Init constructor.

See Also

TWindow


TWindow.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject; ATitle: PChar);

Description

(Override: Often)  Constructs a window object with the parent window passed in AParent and the associated text (caption for windows) passed in ATitle. AParent should be nil for main windows, which have no parent.

The object's Attr.Style field is set to ws_OverlappedWindow unless the window is an MDI child window, when the Attr.Style field is set to ws_ClipSiblings. (See ws_ Window styles.)

The position and extent fields in the Attr record are set to defaults appropriate for overlapped and popup windows. You can override Init in your descendant types as long as you first explicitly call Init. Then you can reset the Attr fields.

Scroller, by default, is set to nil.

See Also

TWindow


TWindow.InitResource     (method)

Syntax

constructor InitResource(AParent: PWindowsObject; ResourceID: Word);

Description

Constructs an Object Windows object to be associated with an interface element (usually a control) created by a resource definition. Calls TWindowsObject.Init.

See Also

TWindow


TWindow.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads a window from the stream S by first calling TWindowsObject.Load and then reading and getting the additional fields (Attr and Scroller) introduced by TWindow.

See Also

TWindow


TWindow.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Often)  Disposes the TScroller object in Scroller, if any, before calling TWindowsObject.Done to dispose of the entire object.

See Also

TWindow


TWindow.Create     (method)

Syntax

function Create: Boolean; virtual;

Description

Creates the window object's corresponding interface element unless the object was constructed with InitResource, in which case the interface element already exists.

Create first calls Register to register the window class if not already registered.

Create then creates the window and calls SetupWindow, which you can define to initialize the newly created window, usually by creating child windows and drawing graphics or text.

Create returns True if successful. If unsuccessful, it returns False and calls Error.

See Also

InitResource

TApplication.MakeWindow

TWindow

TWindowsObject.Register

TWindowsObject.SetupWindow


TWindow.DefWndProc     (method)

Syntax

procedure DefWndProc(var Msg: TMessage); virtual;

Description

(Override: Never)  Calls the window's default procedure which handles default processing for incoming Windows messages. It stores the result of this call in the Result field of the message record, Msg.

See Also

TWindow


TWindow.GetID     (method)

Syntax

function GetId: Integer; virtual;

Description

(Override: Seldom)  Returns the window identifier, such as a control ID.

See Also

TWindow


TWindow.GetWindowClass     (method)

Syntax

procedure GetWindowClass(var AWndClass: TWndClass); virtual;

Description

(Override: Often)  Fills a window class record, passed in AWndClass, with default values for its registration attributes.

The registration attributes and default values are:

Attribute	Default Value

Style field	cs_HRedraw or cs_VRedraw (see cs_ Class styles)

Icon	generic icon

Cursor	stock arrow cursor

Background color	system's window background color

The name of the class to be registered is retrieved through call to GetClassName.

See Also

Create

TWindow

TWindowsObject.GetClassName

TWindowsObject.Register


TWindow.Paint     (method)

Syntax

procedure Paint(PaintDC: HDC; var PaintInfo: TPaintStruct); virtual;

Description

(Override: Often)  Serves as a placeholder for descendant types that define Paint methods. Paint is called automatically in respond to a request (wm_Paint) from Windows to redisplay the window's contents.

Use PaintDC as the display context. It is already obtained before the call to Paint, and released after Paint. The PaintInfo paint structure passed contains information about the paint request directly.

See Also

TWindow

TPaintStruct


TWindow.SetupWindow     (method)

Syntax

procedure SetupWindow; virtual;

Description

(Override: Often)  Sets up the newly created window. If the window is an MDI child window, SetupWindow calls SetFocus to give the new window the focus. If the window has a scroller object, SetupWindow calls SetSBarRange to set the range of its scroll bars.

See Also

TScroller.SetSBarRange

TWindow


TWindow.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the window on the stream S by first calling TWindowsObject.Store and then writing and putting the additional fields (Attr and Scroller) introduced by TWindow.

See Also

TWindow


TWindow.WMCreate     (method)

Syntax

procedure WMCreate(var Msg: TMessage); virtual wm_First + wm_Create;

Description

Responds to the wm_Create message by calling Setup Window and then DefWndProc. Since window creation is handled differently under ObjectWindows than under Windows, the wm_Create message needs to be trapped and used to set up window object attributes.

See Also

TWindow


TWindow.WMActivate     (method)

Syntax

procedure WMActivate(var Msg: TMessage); virtual wm_First + wm_Activate;

Description

(Override: Sometimes)  For windows that intercept keyboard messages for its controls, responds to the window losing and receiving the focus by saving the handle of the child control that currently has the focus in FocusChildHandle and restoring the focus.

See Also

TWindow

TWindowsObject.EnableKBHandler


TWindow.WMHScroll     (method)

Syntax

procedure WMHScroll(var Msg: TMessage); virtual wm_First + wm_HScroll;

Description

(Sometimes)  For windows with scrollers, responds to horizontal window scroll bar events by calling the scroller's HScroll method and DefWndProc.

See Also

TScroller.HScroll

TWindow


TWindow.WMLButtonDown     (method)

Syntax

procedure WMLButtonDown(var Msg: TMessage); virtual wm_First + wm_LButtonDown;

Description

(Override: Sometimes)  For windows with auto-scrolling scrollers, responds to a left mouse button click by capturing all future mouse input until the mouse button is released. It also instructs Windows to send wm_Timer messages while the mouse button is down.

If you plan to override this method to process mouse clicks, but still plan to use auto-scrolling, be sure to call this method from your WMLButtonDown method.

See Also

TWindow


TWindow.WMMove     (method)

Syntax

procedure WMMove(var Msg: TMsg); virtual wm_First + wm_Move;

Description

Updates Attr.X and Attr.Y when the wm_Move message is received.

If the window is iconic or zoomed, the message is ignored.


TWindow.WMPaint     (method)

Syntax

procedure WMPaint(var Msg: TMessage); virtual wm_First + wm_Paint;

Description

(Override: Seldom)  Responds to the Windows wm_Paint message by calling the window object's Paint method. If the window has a scroller, WMPaint calls BeginView before calling Paint and EndView after calling Paint.

See Also

Paint

TWindow

TScroller.BeginView

TScroller.EndView


TWindow.WMSize     (method)

Syntax

procedure WMSize(var Msg: TMessage); virtual wm_First + wm_Size;

Description

(Override: Sometimes)  For windows with scrollers, responds to a window sizing event by calling SetPageSize to adjust for the new window size.

See Also

TScroller.SetPageSize

TWindow


TWindow.WMVScroll     (method)

Syntax

procedure WMVScroll(var Msg: TMessage); virtual wm_First + wm_VScroll;

Description

(Override: Sometimes)  For windows with scrollers, responds to vertical window scroll bar events by calling the scroller's VScroll method and DefWndProc.

See Also

TScroller.VScroll

TWindow


TWindowsObject
TWindowsObject     (WObjects unit)

TWindowsObject defines the fundamental behavior for all interface objects, including windows, dialog boxes and controls.

TWindowsObject is an abstract object type and its methods are useful only to descendant types.

Its methods implement the fundamental interface element creation and destruction behavior, window class registration behavior, and the automatic message response mechanism.

Fields

ChildList

Flags

HWindow

Instance

Parent

Status

TransferBuffer

Methods

Init

Load

Done

CanClose

ChildWithID

CloseWindow

CMExit

Create

CreateChildren

DefChildProc

DefCommandProc

DefNotificationProc

DefWndProc

Destroy

DisableAutoCreate

DisableTransfer

DispatchScroll

EnableAutoCreate

EnableKBHandler

EnableTransfer

FirstThat

ForEach

GetChildPtr

GetChildren

GetClassName

GetClient

GetID

GetSiblingPtr

GetWindowClass

IsFlagSet

Next

Previous

PutChildPtr

PutChildren

PutSiblingPtr

Register

SetFlags

SetupWindow

Show

Store

Transfer

TransferData

WMActivate

WMClose

WMCommand

WMDestroy

WMHScroll

WMNCDestroy

WMQueryEndSession

WMVScroll


TWindowsObject.ChildList     (field)

Syntax

ChildList: PWindowsObject;   (Read only)

Description

ChildList is a linked list of all of the interface object's child window objects, such as popup windows, dialog boxes and controls.

ChildList always points to the object most recently added.

See Also

TWindowsObject


TWindowsObject.Flags     (field)

Syntax

Flags: Byte;   (Read/write)

Description

Flags is a byte of data whose bits are used to store the following windows attributes: keyboard handling, auto-creation, transfer, MDI status, and resource creation.

See Also

IsFlagSet

SetFlags

TWindowsObject


TWindowsObject.HWindow     (field)

Syntax

HWindow: HWnd;   (Read only)

Description

HWindow holds a handle to the interface object's associated interface element.

If there is no associated element, HWindow is equal to 0, the value of an invalid handle.

Upon creation of the associated interface element (Create), HWindow is set to a new handle.

Upon destruction of the associated interface element (WMNCDestroy), HWindow is set to 0.

See Also

TWindowsObject


TWindowsObject.Instance     (field)

Syntax

Instance: TFarProc;   (Read only)

Description

Instance points to the code executed prior to entering the shared window procedure of Object Windows.

See Also

TWindowsObject


TWindowsObject.Parent     (field)

Syntax

Parent: PWindowsObject;   (Read only)

Description

PWindowsObject points to the interface object that serves as this interface object's parent window.

For example, the Parent field of a control object that appears in a window object would point to the window object, its parent.

See Also

TWindowsObject


TWindowsObject.Status     (field)

Syntax

Status: Integer;   (Read/write)

Description

Status indicates the success of the current effort to initialize an interface object and its associated interface element.

The process is successful so far if Status is greater than or equal to 0 and unsuccessful if it is negative.

Descendants of TWindowsObject, including TWindow and TDialog check Status before creating their associated elements.

Use Status in the code of your descendant types to flag an initialization error.

Possible error values include em_InvalidWindow, em_InvalidClient, em_InvalidChild, and em_InvalidMainWindow.

See Also

em_XXXX constants

TWindowsObject


TWindowsObject.TransferBuffer     (field)

Syntax

TransferBuffer: Pointer;   (Read/write)

Description

TransferBuffer points to a transfer record defined by an application that uses the tranfer mechanism. Otherwise it is nil.

See Also

TWindowsObject


TWindowsObject.Init     (method)

Syntax

constructor Init(AParent: PWindowsObject);

Description

(Override: Often)  Constructs and initializes the interface object.

Constructors of descendant types must result in a call to TWindowsObject.Init.

Calls EnableAutoCreate so that child windows will, by default, be created and displayed along with their parent windows.

Also adds the interface object to the child window list of its parent window object.

See Also

EnableAutoCreate

TWindowsObject


TWindowsObject.Load     (method)

Syntax

constructor Load(var S: TStream);

Description

Constructs and loads an inteface object from the stream S by reading the Status, other attributes, the size of ChildList and then by loading each child window.

See Also

TWindowsObject


TWindowsObject.Done     (method)

Syntax

destructor Done; virtual;

Description

(Override: Often)  Destroys the interface object by first destroying the associated interface element, if any, and calling Done.

Disposes all its child windows and removes itself from its parent's child window list.

Destructors of descendant types must result in a call to Done.

See Also

TWindowsObject


TWindowsObject.CanClose     (method)

Syntax

function CanClose: Boolean; virtual

Description

(Override: Sometimes)  Calls the CanClose method for each child window, and returns False if any child window returns False, indicating that it is not OK to close the interface element.

If all child windows' CanClose methods return True, CanClose returns True.

See Also

TWindowsObject


TWindowsObject.ChildWithID     (method)

Syntax

function ChildWithId(Id: Integer): PWindowsObject; virtual;

Description

(Override: Never)  Returns a pointer to the window in the child window list with the passed ID.

If no child window matches, ChildWithID returns nil.

If Id is -1, returns the first non-control object in the child window list.

See Also

TWindowsObject


TWindowsObject.CloseWindow     (method)

Syntax

procedure CloseWindow;

Description

Calls CanClose to see if the window is ready to close.

If CanClose returns True, disposes the window object and destroys the associated window element.

See Also

TWindowsObject


TWindowsObject.CMExit     (method)

Syntax

procedure CMExit(var Msg:TMessage); virtual cm_First + cm_Exit;

Description

If a call to CanClose returns True, responds to a cm_Exit command message by causing the application to terminate.

The cm_Exit message will normally only be sent to the application's main window.

See Also

TWindowsObject


TWindowsObject.Create     (method)

Syntax

function Create: Boolean; virtual;

Description

(Override: Never)  This is an abstract method which is overridden in descendant types to create the interface object's associated interface element.

See Also

TWindowsObject


TWindowsObject.CreateChildren     (method)

Syntax

function CreateChildren: Boolean;

Description

Calls Create for all child windows.

Called automatically by SetupWindow, so you don't normally need to call it directly.

To create visual elements for child window objects loaded from a stream, call CreateChildren after a call to GetChildren.


TWindowsObject.DefChildProc     (method)

Syntax

procedure DefChildProc(var Msg: TMessage); virtual;

Description

(Override: Sometimes)  Performs the default processing for an incoming child-ID-based message by setting the Result field of Msg to 0, indicating that the message was not processed.

See Also

TWindowsObject


TWindowsObject.DefCommandProc     (method)

Syntax

procedure DefCommandProc(var Msg: TMessage); virtual;

Description

(Override: Sometimes)  Performs the default processing for an incoming command-based message by setting the Result field of Msg to 0, indicating that the message was not processed.

See Also

TWindowsObject


TWindowsObject.DefNotificationProc     (method)

Syntax

procedure DefNotificationProc(var Msg: TMessage); virtual;

Description

(Override: Sometimes)  Performs the default processing for an incoming notification message by setting the Result field of Msg to 0, indicating that the message was not processed.

See Also

TWindowsObject


TWindowsObject.DefWndProc     (method)

Syntax

procedure DefWndProc(var Msg: TMessage); virtual;

Description

(Override: Often)  This default window procedure does nothing and is usually overridden.

It relies on the Result field of Msg to remain 0, indicating that the message was not processed.

TWindow overrides DefWndProc to call Windows-supplied default responses to Windows messages.

See Also

TWindow.DefWndProc

TWindowsObject


TWindowsObject.Destroy     (method)

Syntax

procedure Destroy; virtual;

Description

(Override: Never)  Forces the destruction of the interface object's associated element, removing it from the screen, by causing the window object to receive a wm_Destroy message.

Also calls EnableAutoCreate for any child window that has been created.

This ensures that, if recreated, the interface object will look like it did when destroyed.

See Also

EnableAutoCreate

TWindowsObject

WMDestroy


TWindowsObject.DisableAutoCreate     (method)

Syntax

procedure DisableAutoCreate;

Description

Disables the feature that allows the interface object, as a child window, to be created and displayed along with its parent window.

Call DisableAutoCreate for popup windows and controls if you wish to create and display them at a time later than their parent windows.

See Also

EnableAutoCreate

TWindowsObject


TWindowsObject.DisableTransfer     (method)

Syntax

procedure DisableTransfer;

Description

Disables, for the interface object, the transfer mechanism, which allows a control's state information to be transferred to and from a transfer buffer.

See Also

EnableTransfer

TWindowsObject


TWindowsObject.DispatchScroll     (method)

Syntax

procedure DispatchScroll(var Msg: TMessage); virtual;

Description

(Override: Never)  Called by WMHScroll and WMVScroll to dispatch window scrolling messages to the appropriate objects.

See Also

TWindowsObject

WMHScroll

WMVScroll


TWindowsObject.EnableAutoCreate     (method)

Syntax

procedure EnableAutoCreate;

Description

Ensures that the interface object, as a child window, is created and displayed along with its parent window.

This feature is enabled, by default, for windows and controls, but disabled for dialogs.

Call EnableAutoCreate to create a display a dialog along with its parent windows.

See Also

DisableAutoCreate

TWindowsObject


TWindowsObject.EnableKBHandler     (method)

Syntax

procedure EnableKBHandler;

Description

Enables a feature of windows and modeless dialogs that allows them to provide a keyboard interface to child controls, much like that provided by modal dialogs.

This allows the user to tab through controls, for example.

By default, this feature is off.

See Also

TWindowsObject


TWindowsObject.EnableTransfer     (method)

Syntax

procedure EnableTransfer;

Description

Enables, for the interface object, the transfer mechanism, which allows a control's state information to be transferred to and from a transfer buffer.

See Also

DisableTransfer

TWindowsObject


TWindowsObject.FirstThat     (method)

Syntax

function FirstThat(Test: Pointer): PWindowsObject;

Description

Iterates over the child window list and calls the Boolean function pointed to by Test, passing each child window object in turn as an argument.

FirstThat returns a pointer to the first child window object that returns True from the Boolean function (or nil if none returns True) and then stops iterating.

For example, you can write a method, GetFirstChecked, that uses FirstThat to retrieve the first child check box in a checked state:

function MyWindow.GetFirstChecked: PWindowsObject;

   function IsThisOneChecked(ABox: PWindowsObject); Boolean; far;

   begin

      IsThisOneChecked := ABox^.GetCheck <> 0;

   end;

begin

   GetFirstChecked := FirstThat(@IsThisOneChecked);

end;

See Also

TWindowsObject


TWindowsObject.ForEach     (method)

Syntax

procedure ForEach(Action: Pointer);

Description

Iterates over the child window list and, for each child window, calls the procedure pointed to by Action and passes the child window object as an argument.

For example, you can write a method, CheckAllBoxes, that uses ForEach to check every check box in the child window list:

procedure MyWindow.CheckAllBoxes;

   procedure CheckTheBox(ABox: PWindowsObject); far;

   begin

      PCheckBox(ABox)^.Check;

   end;

begin

   ForEach(@ChecktheBox);

end;

See Also

TWindowsObject


TWindowsObject.GetChildren     (method)

Syntax

procedure GetChildren(var S: TStream);

Description

Reads child windows from the given stream, and puts them in the window's child window list.

GetChildren assumes that ChildList is initially empty; pointers to children added prior to calling GetChildren will be lost.

See Also

PutChildren

TWindowsObject


TWindowsObject.GetClassName     (method)

Syntax

function GetClassName: PChar; virtual;

Description

(Override: Sometimes)  Returns the default window class name, 'TurboWindow'.

See Also

TWindowsObject


TWindowsObject.GetClient     (method)

Syntax

function GetClient: PMDIClient; virtual;

Description

(Override: Never)  Returns nil for all non-MDI interface objects, which have no MDI client windows.

TMDIWindow overrides this method to supply its MDI client window.

See Also

TWindowsObject


TWindowsObject.GetID     (method)

Syntax

function GetId: Integer; virtual;

Description

(Override: Seldom)  In general, GetID is used to return the window identifier.

By default, GetID simply returns -1.

GetID is redefined by TControl to return the object's control ID. All other interface objects have no control IDs.

See Also

TWindowsObject


TWindowsObject.GetWindowClass     (method)

Syntax

procedure GetWindowClass(var AWndClass:TWndClass); virtual;

Description

(Override: Sometimes)  Serves as a place holder for descendant types to define the window class record and return it in AWndClass.

This GetWindowClass does nothing.

See Also

TWindowsObject


TWindowsObject.IsFlagSet     (method)

Syntax

function IsFlagSet(Mask: Byte); Boolean;

Description

Returns the state of the bit flag in the Flags field specified by value in Mask.

IsFlagSet returns True if the bit flag is set on, and False if it is off.

See Also

SetFlags

TWindowsObject


TWindowsObject.Next     (method)

Syntax

function Next: PWindowsObject;

Description

Returns a pointer to the next object in the parent window's child window list.

See Also

Previous

TWindowsObject


TWindowsObject.PutChildren     (method)

Syntax

procedure PutChildren(var S: TStream);

Description

Iterates through the window's child window list, writing each of the child windows to the given stream.

PutChildren is called automatically by Store, but it can also be called directly in cases where you want to save the contents of a window without storing the window itself.

See Also

GetChildren

TWindowsObject


TWindowsObject.Previous     (method)

Syntax

function Previous: PWindowsObject;

Description

Returns a pointer to the previous object in the parent window's child window list.

See Also

Next

TWindowsObject


TWindowsObject.Register     (method)

Syntax

function Register: Boolean; virtual;

Description

(Override: Never)  Registers the window class defined in the object's GetWindowClass method and named in its GetClassName method if it is not already registered.

Register returns True if the class is registered successfully.

See Also

TWindowsObject


TWindowsObject.SetFlags     (method)

Syntax

procedure SetFlags(Mask: Byte; OnOff: Boolean);

Description

Turns a bit flag in the Flags field on or off, depending on the value of OnOff.

If OnOff is True, the bit in Mask is set. Otherwise, the bit is cleared.

Mask can be any of these values:

wb_KBHandler

wb_FromResource

wb_AutoCreate

wb_MDIChild

wb_Transfer

See Also

IsFlagSet

TWindowsObject

wb_XXXX constants


TWindowsObject.SetupWindow     (method)

Syntax

procedure SetupWindow; virtual;

Description

(Override: Often)  Performs initialization of the newly-created interface element, usually by creating child window elements, if any.

It creates only those child windows whose auto-create feature is enabled.

By default, this includes windows and controls, but not dialogs.

If Create is unable to create a child window, it sets Status to em_InvalidChild.

SetupWindow also calls TransferData to copy data into the new child windows.

See Also

TWindowsObject


TWindowsObject.Show     (method)

Syntax

procedure Show(ShowCmd: Integer); virtual

Description

(Override: Never)  Show displays the interface element on the screen in a manner specified by the value passed in ShowCmd.

The allowable values for ShowCmd include the following:

Value	Description

sw_Hide	Hidden.

sw_Show	In the window's current size and position.

sw_ShowMaximized	Maximized and active.

sw_ShowMinimized	Minimized and active.

sw_ShowNormal	Restored and active.

See Also

sw_ Show window constants

TWindowsObject


TWindowsObject.Store     (method)

Syntax

procedure Store(var S: TStream);

Description

Stores the interface object on the stream S by writing the Status, other attributes, and the size of ChildList.

Each child window is then stored.

See Also

TWindowsObject


TWindowsObject.Transfer     (method)

Syntax

function Transfer(DataPtr: Pointer; TransferFlag: Word): Word; virtual;

Description

(Override: Sometimes)  Returns 0.

Redefined by TControl descendants to transfer their state data to and from transfer buffer.

The return value from Transfer is the number of bytes of data transferred.

See Also

TWindowsObject


TWindowsObject.TransferData     (method)

Syntax

procedure TransferData(Direction: Word); virtual;

Description

(Override: Sometimes)  If the transfer mechanism is enabled, by setting TransferBuffer to a transfer record, transfers data from to or from the buffer and the interface object's participating child windows.

TransferData calls the Transfer method of each participating child window and passes a pointer to the transfer buffer as well as the direction specified in Direction.

Direction can be tf_SetData or tf_GetData.

See Also

EnableTransfer

DisableTransfer

SetupWindow

tf_XXXX constants

TWindowsObject


TWindowsObject.WMActivate     (method)

Syntax

procedure WMActivate(var Msg: TMessage); virtual wm_First + wm_Activate;

Description

(Override: Sometimes)  In the case that the interface object is participating in the keyboard handling mechanism, responds to the interface object becoming the active window by calling the application object's SetKeyboardHandler method.

See Also

TApplication.SetKBHandler

TWindowsObject


TWindowsObject.WMClose     (method)

Syntax

procedure WMClose(var Msg: TMessage); virtual wm_First + wm_Close;

Description

(Override: Sometimes)  Responds to a request to close the window by calling this object's CanClose method, or the application object's CanClose method in the case that this object is the application's main window.

If CanClose returns True, this interface element is destroyed by calling Destroy.

See Also

Destroy

TWindowsObject


TWindowsObject.WMCommand     (method)

Syntax

procedure WMCommand(var Msg: TMessage); virtual wm_First + wm_Command;

Description

(Override: Seldom)  Provides the mechanism for handling command-based and child-ID-based messages and calling the appropriate response methods.

See Also

TWindowsObject


TWindowsObject.WMDestroy     (method)

Syntax

procedure WMDestroy(var Msg: TMessage); virtual wm_First + wm_Destroy;

Description

(Override: Seldom)  In the case that this object is the application's main window, WMDestroy responds to this interface element's destruction by informing Windows that the application is ending.

A wm_Quit message results.

If the object is not the application's main window, the default window behavior is invoked.

See Also

TWindowsObject


TWindowsObject.WMHScroll     (method)

Syntax

procedure WMHScroll(var Msg: TMessage); virtual wm_First + wm_HScroll;

Description

(Override: Seldom)  Intercepts horizontal window scroll bar messages and calls DispatchScroll.

See Also

DispatchScroll

TWindowsObject


TWindowsObject.WMNCDestroy     (method)

Syntax

procedure WMNCDestroy(var Msg: TMessage); virtual wm_First + wm_NCDestroy;

Description

(Override: Never)  Responds to the last message an interface element receives before destruction by setting HWindow to 0.

See Also

TWindowsObject


TWindowsObject.WMQueryEndSession     (method)

Syntax

procedure WMQueryEndSession(var Msg: TMsg);

  virtual wm_First + wm_QueryEndSession

Description

If the window is the application's main window, it responds to the wm_QueryEndSession message by calling TApplication.CanClose.

If TApplication.CanClose returns True, Msg.Result is set to 1. Otherwise, it is set to 0.


TWindowsObject.WMVScroll     (method)

Syntax

procedure WMVScroll(var Msg: TMessage); virtual wm_First + wm_VScroll;

Description

(Override: Seldom)  Intercepts vertical window scroll bar messages and calls DispatchScroll.

See Also

DispatchScroll

TWindowsObject


TWindowsObject.PutChildPtr     (method)

Syntax

procedure PutChildPtr(var S: TStream; var P: PWindowsObject);

Description

Stores a child window pointer P on the stream S.

PutChildPtr should only be used inside a Store method to write pointer values that can later be read by a call to GetChildPtr from a Load constructor.

See Also

GetSiblingPtr

PutSiblingPtr

TWindowsObject


TWindowsObject.PutSiblingPtr     (method)

Syntax

procedure PutSiblingPtr(var S: TStream; var P: PWindowsObject);

Description

Stores a sibling pointer P on the stream S.

PutSiblingPtr should only be used inside a Store method to write pointer values that can later be read by a call to GetSiblingPtr from a Load constructor.

See Also

GetChildPtr

PutChildPtr

TWindowsObject


TWindowsObject.GetSiblingPtr     (method)

Syntax

procedure GetSiblingPtr(var S: TStream; var P:);

Description

Loads a sibling pointer P from the stream S.

GetSiblingPtr should only be used inside a Load constructor to read pointer values that were written by a call to PutSiblingPtr from a Store method.

The value loaded into P does not become valid until the window's parent completes its Load operation.

See Also

GetChildPtr

PutChildPtr

TWindowsObject


TWindowsObject.GetChildPtr     (method)

Syntax

procedure GetChildPtr(var S: TStream; var P);

Description

Loads a child window pointer P from the stream S.

GetChildPtr should only be used inside a Load constructor to read pointer values that were written by a call to PutChildPtr from a Store method..

See Also

GetSiblingPtr

PutSiblingPtr

TWindowsObject


Background modes

Description

These constants specify the how the background area is drawn when text or graphics with a hatched brush are drawn.

Constant	Meaning

Opaque	The background is filled with the current background color.

Transparent	The background is left alone.

They are used in the GetBkMode and SetBkMode functions.


bi_ Bitmap compression constants

Description

These constants are used as values in the biCompression field of the Windows record type TBitmapInfoHeader passed in calls to CreateDIBitmap.

Constant       Meaning

bi_RGB	The bitmap is not compressed.

bi_RLE8	The bitmap uses a run-length encoded format with 8 bits per pixel.

bi_RLE4	The bitmap uses a run-length encoded format with 4 bits per pixel.


bn_ Button notification codes

Description

These control notification codes are passed in wm_Command messages generated by button controls. They indicate the action that has occurred.

Constant	Meaning

bn_Clicked	This code notifies the parent of a button that the button has been clicked.

bn_DoubleClicked	This code notifies the parent of a button that the button has been double-clicked.

This code only applies to buttons with the bs_OwnerDraw style and radio buttons.


bs_ Brush Styles

Description

These constants specify logical brush styles and are used in the lbStyle field of the LogBrush record passed in the CreateBrushIndirect function.

Constant	Meaning

bs_DIBPattern	The brush pattern is specified by a device-independent bitmap.

bs_Hatched	A hatched brush.

bs_Hollow	A hollow, or null, brush.

bs_Null	Same as bs_Hollow.

bs_Pattern	The brush pattern is specified by a memory bitmap.

bs_Solid	A solid brush.


bs_ Button styles

Description

These constants are used to specify button styles when creating buttons with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

bs_3State	This style of button is a box that may be checked, unchecked, and grayed.

Graying is typically used to show that the box is disabled.

bs_Auto3State	This style of button is the same as bs_3State, except that the box toggles state automatically when clicked.

bs_AutoCheckBox	This style of button is the same as bs_CheckBox, except that the box toggles state automatically when clicked.

bs_AutoRadioButton	This style of button is the same as bs_RadioButton, except that when the button is clicked, the button is checked and the checkmarks are removed from all other buttons in the same group.

bs_CheckBox	This style of button is a box that may be checked and unchecked.

Associated text is placed to the right of the box.

bs_DefPushButton	This style of button is the same as bs_PushButton, except that in addition this button is the default selection unless another button or box is selected using the keyboard or mouse.

bs_GroupBox	This style of button is a box for grouping other buttons.

Associated text is placed in the upper left corner.

bs_LeftText	Used with bs_3State, bs_CheckBox, or bs_RadioButton, this style causes associated text to be placed to the left of the button or box instead of to the right.

bs_OwnerDraw	This style of button is an owner-draw button.

In addition to normal notification codes sent via wm_Command messages, the parent also receives requests to paint, invert, and disable the button.

bs_PushButton	This style of button is a button with any associated text placed inside.

bs_RadioButton	This style of button is a small round button that can be checked and unchecked.

Associated text is placed to the right of the button.

Radio buttons are usually used in groups where one and only one button is checked at a time.


cb_ Combo box return values

Description

These values are returned from Windows combo box messages such as cb_AddString. A negative value indicates an error.

Constant	Meaning

cb_Err	An error has occurred and the action was not performed.

cb_ErrSpace	There is not enough space in the combo box to perform the action.

cb_Okay	No error.


cbm_Init CreateDIBitmap constant

Description

When passed in the Usage parameter of the function CreateDIBitmap, cbm_Init indicates that the memory bitmap is to be initialized.


cbn_ Combo box notification codes

Description

These control notification codes are passed in wm_Command messages generated by combo box controls. They indicate the action that has occurred.

Constant	Meaning

cbn_DblClk	This code notifies the parent of a combo box that an entry in the combo box's list box has been double-clicked with the mouse.

cbn_DropDown	This code notifies the parent of a combo box that the combo box's list box is about to be dropped down.

cbn_EditChange	This code notifies the parent of a combo box that the text of the combo box's edit control has changed.

cbn_EditUpdate	This code notifies the parent of a combo box that the combo box's edit control is about to redisplay its text because the text has been modified.

cbn_ErrSpace	This code notifies the parent of a combo box that the system has run out of memory.

cbn_KillFocus	This code notifies the parent of a combo box that the combo box has lost the input focus.

cbn_SelChange	This code notifies the parent of a combo box that the selection in the combo box's list box has been changed.

cbn_SetFocus	This code notifies the parent of a combo box that the combo box has received the input focus.


cbs_ Combo box styles

Description

These constants are used to specify combo box styles when creating combo boxes with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

cbs_AutoHScroll	This style of combo box scrolls the text in the edit control to the right when the user types a character at the end of the line.

Without this style, no text is allowed outside the boundary of the edit control.

cbs_DropDown	This style is the same as cbs_Simple, except that the list box is displayed only when an icon next to the selection field is selected.

cbs_DropDownList	This style is the same as cbs_DropDown, except that a static text item is used to display the current selection instead of an edit control.

cbs_HasStrings	This style may be used in conjunction with the cbs_OwnerDrawFixed or cbs_OwnerDrawVariable style.

This style of combo box uses strings as its entries. The strings are managed by the system and may be retrieved using the cb_GetLBText message.

cbs_NoIntegralHeight	This style of combo box is exactly the size given when the combo box is created.

Normally the size of the combo box used to create a combo box may be changed so that the combo box does not display partial entries.

cbs_OEMConvert	This style may be used in conjunction with the cbs_Simple or cbs_DropDown styles.

This style of combo box translates each character entered into the combo box's edit control from the ANSI character set to the OEM character set and then back to ANSI.

The AnsiToOem function will then behave correctly when it is applied to entries in the combo box's list box or to the text in the combo box's edit control.

The cbs_OEMConvert style is useful for combo boxes which contain file names.

cbs_OwnerDrawFixed	This style of combo box must be drawn by its owner. The entries in the combo box's list box are all the same height.

cbs_OwnerDrawVariable	This style of comb-box must be drawn by its owner. The entries in the combo box's list box are variable in height.

cbs_Simple	This style of combo box has its list box displayed at all times. The current list box selection is displayed in the edit control.

cbs_Sort	This style of combo box has a sorted list box.

The sort order may be different for combo boxes with the cbs_OwnerDrawFixed or cbs_OwnerDrawVariable style.


cc_ Curve capabilities

Description

These constants represent the curve rendering capabilities of a device.

Constant	Meaning

cc_None	Curves not supported.

cc_Chord	Can do chord arcs.

cc_Circles	Can do circles.

cc_Ellipses	Can do ellipses.

cc_Interiors	Can do interiors.

cc_Pie	Can do pie wedges.

cc_Styled	Can do styled lines.

cc_Wide	Can do wide lines.

cc_WideStyled	Can do wide styled lines.


cchDeviceName Device name length constant

Description

The cchDeviceName constant limits the size of a device name string to 32 characters.


ce_ Comm error flags

Description

These flags specify a communications error when returned from the GetCommError function.

Constant	Meaning

ce_Break	Break detected.

ce_STSTO	Clear-to-send timeout.

ce_DNS	LPTx device is not selected.

ce_DSRTO	Data-set-ready timeout.

ce_Frame	Framing error.

ce_IOE	LPTx I/O error.

ce_Mode	Requested mode unsupported or invalid CID.

ce_OOP	LPTx out-of-paper.

ce_Overrun	Received character is overrun by next character and not read.

ce_PTO	LPTx timeout.

ce_RLSDTO	Receive-line-signal-detect timeout.

ce_RxOver	Receive queue overflow.

ce_RxParity	Parity error.

ce_TxFull	Transmit queue is full.


cf_ Clipboard formats

Description

These constants identify clipboard formats when passing data to and from the Windows clipboard.

Constant	Meaning

cf_Bitmap	Windows bitmap.

cf_DIB	Windows device independent bitmap.

cf_DIF	Software Arts' Data Interchange Format.

cf_DSPBitmap	A private bitmap format's display information.

cf_DSPMetaFilePict	A private metafile format's display information.

cf_DSPText	A private text format's display information.

cf_MetaFilePict	Windows metafile.

cf_OEMText	Text using the OEM character set.

cf_OwnerDisplay	Owner display format.

cf_Palette	A color palette if needed for specific color rendering clipboard data.

cf_PrivateFirst	The first in a range of values for private data formats. Handles to data in these formats will not be automatically freed and should freed by the application before closing.

cf_PrivateLast	The last in the range of values for private data formats.

cf_SYLK	Microsoft Symbolic Link format.

cf_Text	Text.

cf_TIFF	Tag Image File Format.

These constants are also used in the dynamic data exchange (DDE) protocol and in the following functions:

EnumClipboardFormats

GetClipboardData

GetClipboardFormatName

GetPriorityClipboardFormat

IsClipboardFormatAvailable

SetClipboardData


clip_ Font clipping precision flags

Description

These constants specify the clipping precision of fonts produced with the CreateFont function. They govern how text appears when it is partially outside the clipping region.

clip_Character_Precis

clip_Default_Precis

clip_Stroke_Precis


color_ System color codes

Description

These codes specify aspects of the Windows user interface for which the programmer can directly set the color with the SetSysColors function.

Constant	Meaning

color_ActiveBorder	Active window border.

color_ActiveCaption	Actor window caption.

color_AppWorkSpace	Background of MDI frame windows.

color_Background	Windows desktop.

color_BtnFace	The face of push buttons.

color_BtnShadow	The edge of push buttons.

color_BtnText	The text of push buttons.

color_CaptionText	Caption text, size box and scroll bar arrow box.

color_GrayText	Grayed text.

color_Highlight	A control's selected items.

color_HighlightText	The text of a control's selected items.

color_InactiveBorder	Inactive window border.

color_InactiveCaption	Inactive window caption.

color_Menu	Menu bar background.

color_MenuText	Menu bar text.

color_ScrollBar	Scroll bar background.

color_Window	Window background.

color_WindowFrame	Window frame.

color_WindowText	Text in a window.


com_ Communication device status flags

Description

These flags can be used as bit masks to retrieve or set bit fields that make up the Flags field of a TComStat record.

Constant                  Bit Accessed

com_CtsHold	fCtsHold

com_DsrHold	fDsrHold

com_RlsdHold	fRlsdHold

com_XoffHold	fXoffHold

com_XoffSent	fXoffSent

com_Eof	fEof

com_Txim	fTxim


Comm configuration constants

Description

One of the following constants is used in the Parity field of the TDCB record type. These constants indicate the type of parity used by a serial communications device.

Constant             Parity Setting

EvenParity	Even

MarkParity	Mark

NoParity	No parity

OddParity	Odd

SpaceParity	Space

One of the following constants is used in the StopBits field of the TDCB record type. These constants indicate the number of stop bits used by a serial communications device.

Constant      Stop bits used

OneStopBit	One

One5StopBits	1.5

TwoStopBits	Two


cp_ Clipping capabilities

Description

These constants indicate the clipping abilities of the device.

Constant	Meaning

cp_None	No clipping of output.

cp_Rectangle	Output clipped to rectangles.


cs_ Class styles

Description

These window class style constants are used in the style field of the TWndClass data structure. They can be combined using or.

Constant	Meaning

cs_ByteAlignClient	The window's client area is aligned on the byte boundary, in the x direction.

cs_ByteAlignWindow	The window is aligned on the byte boundary, in the x direction.

cs_ClassDC	Instances of the window class share their own display context.

cs_DblClks	The window will get mouse double-click messages.

cs_GlobalClass	The window class can be used by all running applications.

cs_HRedraw	The entire window will be redrawn if its horizontal size changes.

cs_NoClose	The window's Control menu's Close option is disabled.

cs_OwnDC	Each window instance gets its own display context. Uses 800 bytes of memory per window.

cs_ParentDC	The window uses its parent's display context.

cs_SaveBits	The window's contents are saved to a bitmap when they are not currently displayed. This bitmap is used to redisplay its contents. Use minimally.

cs_VRedraw	The entire window will be redrawn if its vertical size changes.


ctlcolor_ Control color flags

Description

These flags indicate the type of control or dialog box that is about to be drawn, and are passed in a wm_CtlColor message.

Constant	Meaning

ctlcolor_Btn	A button control

ctlcolor_Dlg	A dialog box

ctlcolor_Edit	An edit control

ctlcolor_ListBox	A list box

ctlcolor_MsgBox	A message box

ctlcolor_ScrollBar	A scroll bar

ctlcolor_Static	A static control


cw_ Use Default
cw_UseDefault constant

Description

cw_UseDefault is used as a parameter to CreateWindow or CreateWindowEx.

It tells Windows to assign a default size or position to the window being created.


dc_ Device capabilities index constants

Description

These constants are used in the Index parameter of calls to DeviceCapabilities to indicate the specific capability of the printer driver to query. The Index argument can be any one of these values:

Constant             Meaning

dc_BinNames	Information on available paper bins

dc_Bins	The list of available bins

dc_Driver	The printer driver version number

dc_Duplex	The level of duplex printing support

dc_Extra	The number of bytes at the end of the TDevMode record to be used for device-specific data

dc_Fields	The dmFields field of the TDevMode record

dc_MaxExtent	The maximum paper size

dc_MinExtent	The minimum paper size

dc_Papers	A list of supported paper sizes

dc_Papersize	A list of the exact sizes of the supported papersizes

dc_Size	The dmSize field of the TDevMode record

dc_Version	The specification version the printer driver uses


dcb_ Communication device control block flags

Description

These flags can be used as bit masks to retrieve or set bit fields that make up the Flags field of a TDCB record.

Constant	Bit Accessed

dcb_Binary	fBinary

dcb_RtsDisable	fRtsDisable

dcb_Parity	fParity

dcb_OutxCtsFlow	fOutxCtsFlow

dcb_OutxDsrFlow	fOutxDsrFlow

dcb_DtrDisable	fDtrDisable

dcb_OutX	fOutX

dcb_InX	fInX

dcb_PeChar	fPeChar

dcb_Null	fNull

dcb_ChEvt	fChEvt

dcb_Dtrflow	fDtrflow

dcb_Rtsflow	fRtsflow


dde_ DDE Record type flags

Description

These flags can be used as bit masks to retrieve or set bit fields that make up the Flags fields in a TDDEAdvise, TDDEData, or TDDEPoke record.

Constant	FIeld

dde_AckReq	The fAckReq field (TDDEAdvise or TDDEData).

dde_DeferUpdt	The fDeferUpd field (TDDEAdvise).

dde_Response	The fResponse field (TDDEData).

dde_Release	The fRelease field (TDDEData or TDDEPoke).


dde_ DDE Return codes

Description

These codes are passed to DDE-active applications in fields of the records TDDEAdvise, TDDEData and TDDEPoke.

These bit masks are used to specify bits in the TDDEAck record.

Constant	       BIt mask

dde_Ack	The Ack bit of the TDDEAck.Status word.

If LParamLo and dde_Ack = 1, the request is accepted.

If LParamLo and dde_Ack = 0, the request is denied.

dde_AppReturnCode	Reserved for application-specific return codes.

dde_Busy	The Busy bit of the TDDEAck.Status word.

If the request is denied, LParamLo and dde_Busy = 1 indicated that the application was unable to respond.


Device capabilities

Description

These constants are associated with particular capabilities of a device context. They are used in the GetDeviceCaps function.

Constant	Meaning

AspectX	Relative pixel width.

AspectXY	Diagonal pixel length.

AspectY	Relative pixel height.

BitsPixel	Number of bits per pixel.

ClipCaps	Clipping capabilities. Returns a cp_ clipping capabilities constant.

ColorRes	Actual color resolution in bits per pixel.

CurveCaps	Curve capabilities. Returns a cc_ curve capabilities constant.

DriverVersion	Device driver version. For example, $100 is 1.0.

HorzRes	Horizontal width in pixels.

HorzSize	Horizontal size in millimeters.

LineCaps	Line capabilities. Returns a lc_ line capabilities constant.

LogPixelsX	Number of pixels per horizontal inch.

LogPixelsY	Number of pixels per vertical inch.

NumBrushes	Number of brushes the device has.

NumColors	Number of colors the device supports.

NumFonts	Number of fonts the device has.

NumMarkers	Number of markers the device has.

NumPens	Number of pens the device has.

NumReserved	Number of reserved entries in palette.

PDeviceSize	Size required for device descriptor.

Planes	Number of color planes.

PolygonalCaps	Polygonal capabilities. Returns a pc_ polygonal capabilities constant.

RasterCaps	Raster capabilities. Returns a rc_ raster capabilities constant.

SizePalette	Number of entries in physical palette.

Technology	Device classification. Returns a dt_ device technology constant.

TextCaps	Text capabilities. Returns a tc_ text capabilities constant.

VertRes	Vertical width in pixels.

VertSize	Vertical size in millimeters.


dib_ Color table identifiers

Description

These constants specify the how colors are accessed for use in device-independent bitmaps.

Constant	Meaning

dib_Pal_Colors	The color table is an array of 16-bit indexes into the currently realized logical palette.

dib_RGB_Colors	The color table holds RGB literal values.

These constants are used in the following functions:

CreateDIBitmap

CreateDIBPatternBrush

GetDIBits

SetDIBits

SetDIBitsToDevice

StretchDIBits


dlgc_ Dialog codes

Description

These codes specify types of dialog input the application, rather than Windows, will process. They are return values from the wm_GetDlgCode message.

Constant	Meaning

dlgc_DefPushButton	Default push button messages.

dlgc_HasSetSel	em_SetSel messages.

dlgc_RadioButton	Radio button messages.

dlgc_UndefPushButton	Push button messages.

dlgc_WantAllKeys	All keyboard input messages

dlgc_WantArrows	Arrow key messages.

dlgc_WantChars	wm_Char messages.

dlgc_WantMessage	All keyboard input messages. The messages will be passed to the control.

dlgc_WantTab	Tab key messages.


DlgWindowExtra Dialog class constant

Description

When defining a new class for a dialog from a resource, set the cbWndExtra field of the TWndClass record type to DlgWindowExtra.


dm_ TDevMode field selection constants

Description

These constants are used as field selection bits.

Each constant represents a specific bit in the dmFields field of a TDevMode record. If the specified bit is set, it indicates that the corresponding field in the record has been initialized.

Constant                   Field

dm_Color	dmColor

dm_Copies	dmCopies

dm_DefaultSource	dmDefaultSource

dm_Duplex	dmDuplex

dm_Orientation	dmOrientation

dm_PaperLength	dmPaperLength

dm_PaperSize	dmPaperSize

dm_PaperWidth	dmPaperWidth

dm_PrintQuality	dmPrintQuality

dm_Scale	dmScale


dm_ Device mode selections

Description

These constants are used in the Mode parameter of the ExtDeviceMode function to specify operations. Mode may be one or more of the following:

Constant                   Meaning

dm_Copy	Writes the printer driver's settings to the TDevMode record passed in DevModeOutput.

dm_Modify	Modifies the printer driver's settings to be what's found in the TDevMode record passed in DevModeInput.

dm_Prompt	Produces the printer driver's setup dialog box and sets the printer to the settings selected by the user.

dm_Update	Updates the printer environment and the WIN.INI file with the printer's current settings.


dmbin_ Device mode bin selection constants

Description

These constants are used in the dmDefaultSource field of a TDevMode record, indicating from which bin paper will feed by default.

Constant

dmbin_Auto

dmbin_Cassette

dmbin_Envelope

dmbin_EnvManual

dmbin_LargeCapacity

dmbin_LargeFmt

dmbin_Lower

dmbin_Manual

dmbin_Middle

dmbin_OnlyOne

dmbin_SmallFmt

dmbin_Tractor

dmbin_Upper


dmcolor_ Device mode color constants

Description

These constants are used in the dmColor field of a TDevMode record to indicate support for color printing.

Constant                        Meaning

dmcolor_Monochrome	Printer is black-and-white only

dmcolor_Color	Printer prints in color


dmdup_ Device mode duplex constants

Description

These constants are used in the dmDuplex field of a TDevMode record to indicate the use of duplex (double-sided) printing.

Constant                   Meaning

dmdup_Horizontal	Print horizontally

dmdup_Simplex	Print on only one side

dmdup_Vertical	Print vertically


dmorient_ Device mode orientation constants

Description

These constants are used in the dmOrientation field of a TDevMode record to indicate the desired printing orientation.

Constant                        Meaning

dmorient_Portrait	Use portrait orientation

dmorient_Landscape	Use landscape orientation


dmpaper_ Device mode paper type constants

Description

These constants are used in the dmPaperSize field of a TDevMode record indicating the size of the paper being printed on.

Constant	Meaning

dmpaper_10X14	10 x 14 inches

dmpaper_11X17	11 x 17 inches

dmpaper_A3	297 x 420 mm

dmpaper_A4	210 x 297 mm

dmpaper_A4Small	210 x 297 mm

dmpaper_A5	148 x 210 mm

dmpaper_B4	250 x 354 mm

dmpaper_B5	182 x 257 mm

dmpaper_CSheet	C size sheet

dmpaper_DSheet	D size sheet

dmpaper_Env_10	4 1/8 x 9 1/2 inches

dmpaper_Env_11	4 1/2 x 10 3/8 inches

dmpaper_Env_12	4 3/4 x 11 inches

dmpaper_Env_14	5 x 111/2 inches

dmpaper_Env_9	3 7/8 x 8 7/8 inches

dmpaper_ESheet	E size sheet

dmpaper_Executive	7 1/2 x 10 inches

dmpaper_Folio	8 1/2 x 13 inches

dmpaper_Ledger	17 x 11 inches

dmpaper_Legal	8 1/2 x 14 inches

dmpaper_Letter	8 1/2 x 11 inches

dmpaper_LetterSmall	8 1/2 x 11 inches

dmpaper_Note	8 1/2 x 11 inches

dmpaper_Quarto	215 x 275 mm

dmpaper_Statement	5 1/2 x 8 1/2 inches

dmpaper_Tabloid	11 x 17 inches


dmres_ Device mode resolution constants

Description

These constants are used in the dmPrintQuality field of a TDevMode record to indicate the resolution of the printer.

Constant            Meaning

dmres_Draft	Draft quality

dmres_Low	Low print quality

dmres_Medium	Medium print quality

dmres_High	High print quality


drive_ Drive types

Description

These constants specify the disk drive type and are returned from the GetDriveType function.

Constant	Meaning

drive_Fixed	The disk cannot be removed from the drive.

drive_Remote	The disk is at a remote (networked) location.

drive_Removeable	The disk can be removed from the drive.


ds_ Dialog styles

Description

These constants are used to specify dialog styles when creating dialog boxes with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

ds_AbsAlign	This style of dialog box is aligned relative to the upper-left corner of the screen instead of relative to the upper-left corner of the owner of the dialog box.

ds_LocalEdit	This style of dialog box uses memory in the application's data segment for data structures associated with controls which are children of the dialog box.

The default is to use global memory.

If the ds_LocalEdit style is not used,the em_GetHandle and em_SetHandle messages must not be used.

ds_ModalFrame	This style of dialog box has a modal dialog box frame.

The ws_ Window styles, ws_Caption and ws_SysMenu, may be used with the ds_ModalFrame style.

ds_NoIdleMsg	This style of dialog box excludes wm_EnterIdle messages that are normally sent to the owner of the dialog box.

ds_SetFont	A dialog with this style sets its own font for drawing its controls.

An extended form of the dialog template structure must be used to create the dialog.

It includes the basic dialog template structure header followed immediately by a font-information structure.

A dialog with the ds_SetFont style is sent a wm_SetFont message before the dialog's controls are created.

ds_SysModal	This style of dialog box suspends all Windows applications while it is displayed.


dt_ Device technologies

Description

These constants represent the type of device being used.

Constant	Meaning

dt_CharStream	Character stream

dt_DispFile	Display file

dt_MetaFile	Metafile

dt_Plotter	Vector plotter

dt_RasCamera	Raster camera

dt_RasDisplay	Raster display

dt_RasPrinter	Raster printer


dt_ Text drawing formatting flags

Description

These constants specify formatting options for the DrawText function.

Constant	Meaning

dt_Bottom	Bottom-justified.

dt_CalcRect	Recalculate the bounding rectangle to fit the text, but do not actually draw the text.

dt_Center	Centered horizontally.

dt_ExpandTabs	Expands tabs.

dt_ExternalLeading	Includes a font's external leading in text height.

dt_Internal	Includes a font's internal leading in text height.

dt_Left	Left-justified.

dt_NoClip	Draw without clipping.

dt_NoPrefix	Do not process prefix characters, such as '&'.

dt_Right	Right-justified.

dt_SingleLine	Single line only.

dt_TabStop	Sets tab stops.

dt_Top	Top-justified.

dt_VCenter	Centered vertically.

dt_WordBreak	Word wrap.


en_ Edit control notification codes

Description

These control notification codes are passed in wm_Command messages generated by edit controls. They indicate the action that has occurred.

Constant	Meaning

en_Change	This code notifies the owner of an edit control that the edit control's text has changed.

en_ErrSpace	This code notifies the owner of an edit control that the system has run out of memory.

en_HScroll	This code notifies the parent of an edit control that the edit control's horizontal scroll bar has been clicked.

The parent is notified before the screen is updated.

en_KillFocus	This code notifies the parent of an edit control that the edit control has lost the input focus.

en_MaxText	This code notifies the parent of an edit control that the maximum number of characters allowed in the edit control was exceeded by the last insertion.

en_SetFocus	This code notifies the parent of an edit control that the edit control has received the input focus.

en_Update	This code notifies the parent of an edit control that the edit control is about to redisplay its text because the text has been modified.

en_VScroll	This code notifies the parent of an edit control that the edit control's vertical scroll bar has been clicked.

The parent is notified before the screen is updated.


EnumFonts masks

Description

These masks, when combined with the FontType argument of the callback function of the EnumFonts function, reveal information about the particular font.

Constant                  Meaning

Raster_FontType	If the resulting combination is 1, the font is a raster font.

If it is 0, the font is a vector font.

Device_FontType	If the resulting combination is 1, the font is a device-based font.

If it is 0, the font is a GDI- based font.


es_ Edit control styles

Description

These constants are used to specify edit control styles when creating edit controls with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

es_AutoHScroll	This style of edit control automatically scrolls its text to the right by 10 characters when a character is typed at the end of the line.

The text is scrolled back to position 0 when Enter is pressed.

es_AutoVScroll	This style of edit control automatically scrolls its text up one page when Enter is pressed with the caret on the last line.

es_Center	This style of edit control centers its text. The es_Center style may be used only if the es_MultiLine style is used also.

es_Left	This style of edit control aligns its text flush-left.

The es_Left style may be used only if the es_MultiLine style is used also.

es_LowerCase	This style of edit control converts all characters to lowercase as they are typed.

es_MultiLine	This style of edit control is a multiple-line edit control. The es_AutoVScroll style may only be used with the es_MultiLine style.

If the es_AutoVScroll style is not used, a beep is sounded when Enter is pressed with the caret on the last line.

If the es_AutoHScroll style is not used, new words typed in are automatically wrapped to the next line when necessary.

The wordwrap positions will change when the window is re-sized.

A multiple-line edit control with scroll bars handles its own scroll bar messages, otherwise scrolling is done automatically as described above.

es_NoHideSel	This style of edit control does not hide its selection when the edit control loses the input focus.

The default behavior is to hide the selection when the edit control loses the focus.

es_OEMConvert	This style of edit control converts entered text from the ANSI character set to the OEM character set and then back to ANSI.

The AnsiToOem function will then behave correctly when it is applied to the edit control's text.

The es_OEMConvert style is useful for edit controls which contain file names.

es_Password	All characters typed into the edit control are displayed as an asterisk (*).

The em_SetPasswordChar message can be used to change the displayed character.

es_Right	This style of edit control aligns its text flush-right.

The es_Right style may be used only if the es_MultiLine style is used also.

es_UpperCase	This style of edit control converts all characters to uppercase as they are typed.


Escape comm constants

Description

These constants specify a function code to be carried out by a communication device. Use them in calls to the EscapeCommFunction function.

Constant	Meaning

ClrDTR	Clears the data-set-ready signal.

ClrRTS	Clears the request-to-send signal.

ResetDev	Resets the device if possible.

SetDTR	Clears the data-terminal-ready signal.

SetRTS	Clears the request-to-send signal.

SetXoff	Simulates receiving an XOFF character.

SetXon	Simulates receiving an XON character.


eto_ ExtTextOut options

Description

These options specify the background painting method used by the ExtTextOut function.

Constant	Meaning

eto_Clipped	The text is clipped to the bounding rectangle.

eto_Opaque	The background color fills the bounding rectangle.


ev_ Comm event constants

Description

These constants serve as pointers into a communication device event mask and are return values in the SetCommEventMask function.

These are the states under which the mask bits pointed to are set (equal to 1).

Constant	Meaning

ev_Break	Break received.

ev_CTS	Clear to send state changes.

ev_DSR	Data set ready state changes.

ev_Err	Line status error occurred.

ev_PErr	Printer error occurred.

ev_Ring	A ring indicator is detected.

ev_RLSD	Receive line signal detect state changes.

ev_RxChar	Any character is received.

ev_RxFlag	The event character specified in the device's control block is received.

ev_TxEmpty	The transmit queue is empty.


Flood fill style flags

Description

These flags specify the type of flood fill used in the ExtFloodFill function.

Constant	Meaning

FloodFillBorder	The area up to the specified color will be filled. This is the type of flood fill performed by the FloodFill function.

FloodFillSurface	The area containing the specified color will be filled. This type of flood fill is most appropriate for complex, multi-colored surfaces.


ff_ Font family flags

Description

These constants specify the desired character set for fonts produced with the CreateFont function.

Constant	Meaning

ff_Decorative	Novelty fonts, such as Old English.

ff_DontCare	Don't care or don't know.

ff_Modern	Constant stroke width, serifed or sans-serifed. For example Pica, Elite, and Courier.

ff_Roman	Variable stroke width, serifed. For example,Times Roman and Century Schoolbook.

ff_Script	Hand-written fonts, such as Script.

ff_Swiss	Variable stroke width, sans-serifed. For example, Helvetica and Swiss.


Font character set flags

Description

These constants specify the desired character set for fonts produced with the CreateFont function.

ANSI_CharSet

Symbol_CharSet

ShiftJIS_CharSet

OEM_CharSet


Font output quality flags

Description

These constants specify the desired output quality of fonts produced with the CreateFont function.

Constant	Meaning

Default_Quality	Appearance is not important.

Draft_Quality	Appearance is only moderately important.

Proof_Quality	Character quality is paramount. It is more important than matching the logical font attributes.


Font pitch flags

Description

These constants specify the desired pitch of fonts produced with the CreateFont function.

Default_Pitch

Fixed_Pitch

Variable_Pitch


fw_ Font weight flags

Description

These constants specify the desired font weight for fonts produced with the CreateFont function. The list is presented in order of lightest (fw_Thin) to heaviest (fw_Heavy).

fw_DontCare

fw_Thin

fw_ExtraLight, fw_UltraLight

fw_Light

fw_Normal, fw_Regular

fw_Medium

fw_SemiBold, fw_DemiBold

fw_Bold, fw_Black

fw_ExtraBold, fw_UltraBold

fw_Heavy


gcl_ Class field offsets
gcl_ Class field offsets (long)

Description

These constants specify the byte offset of the window class information to be retrieved or modified with the GetClassLong or SetClassLong functions.

Constant	Meaning

gcl_MenuName	The pointer to the menu name (SetClassLong only).

gcl_WndProc	The pointer to the window function.


gcw_ Class field offsets
gcw_ Class field offsets (word)

Description

These constants specify the byte offset of the window class information to be retrieved or modified with the GetClassWord or SetClassWord functions.

Constant	Meaning

gcw_CBClsExtra	Retrieves or sets to two the number of extra bytes of class information.

gcw_CBWndExtra	Retrieves or sets to two the number of extra bytes of window information.

gcw_HBrBackground	The handle to the background brush.

gcw_HCursor	The handle to the cursor.

gcw_HIcon	The handle to the icon.

gcw_HModule	The handle to the module. (GetClassWord only).

gcw_Style	The window class style bits.


gmem_ Global memory flags

Description

These flags specify characteristics of the global memory block created with the functions GlobalAlloc and GlobalReAlloc.

They are also used in the GlobalFlags and GetFreeSpace functions.

Constant	Meaning

gmem_DDEShare	The memory block can be shared by many applications using the dynamic data exchange (DDE) protocol. The block is discarded when the allocating application terminates.

gmem_Discardable	The memory block can be discarded. Must be used with gmem_Moveable.

gmem_Discarded	The memory block has been discarded. (GlobalFlags only.)

gmem_Fixed	The memory block is fixed in one memory location.

gmem_LockCount	When combined with the low-order byte of the return value from GlobalFlags, returns the memory block's reference count. (GlobalFlags only.)

gmem_Lower	Same as gmem_Not_Banked.

gmem_Modify	The global memory flags are to be changed when this flag is included (GlobalReAlloc only).

gmem_Moveable	The memory block is fixed in one memory location.

gmem_NoCompact	When allocating the memory block, no other memory blocks will be compacted or discarded.

gmem_NoDiscard	When allocating the memory block, no other memory blocks will be discarded.

gmem_Not_Banked	The memory block is allocated in non-banked memory.

gmem_Notify	The notification routine will be called if the memory is discarded.

gmem_Share	Same as gmem_DDEShare.

gmem_ZeroInit	Initializes the contents of the memory block to 0.


gw_ Get window constants

Description

These constants specify the relationship between the desired window and the window provided in calls to the GetNextWindow and GetWindow functions. GetNextWindow accepts only gw_HWndNext and gw_HWndPrev.

Constant	Meaning

gw_Child	The first child window.

gw_HWndFirst	For a child window, its first sibling window.

gw_HWndLast	For a child window, its last sibling window.

gw_HWndNext	The next window on the window manager's list.

gw_HWndPrev	The previous window on the window manager's list.

gw_Owner	The parent window.


gwl_ Window field offsets
gwl_ Window field offsets (long)

Description

These constants specify the byte offset of the window attribute to be retrieved or modified with the GetWindowLong or SetWindowLong functions.

Constant	Meaning

gwl_ExStyle	The extended window style.

gwl_Style	The window style.

gwl_WndProc	The pointer to the window function.


gww_ Window field offsets
gww_ Window field offsets (word)

Description

These constants specify the byte offset of the window information to be retrieved or modified with the GetWindowWord or SetWindowWord functions.

Constant	Meaning

gww_HInstance	The instance identifier of the module that owns the window.

gww_HWndParent	The parent window. (GetWindowWord only.)

gww_ID	The control ID of the child window.


help_ Help commands

Description

These constants indicate to the Windows help facility the type of help requested by the application. Use them in calls to the WinHelp function.

Constant	Meaning

help_Context	Help on a particular context specified in the Data parameter.

help_HelpOnHelp	Help on using the help facility.

help_Index	Display the help index.

help_Key	Help on a particular keyword specified in the Data parameter.

help_MultiKey	Help on a particular keyword in an alternate keyword table.

help_Quit	Terminate the help facility.

help_SetIndex	Display the help index specified in the Data parameter in the file specified in the HelpFile parameter.


hs_ Hatch styles

Description

The following constants specify hatch styles for brush tools. They are used in the CreateHatchBrush function.

Constant	Meaning

hs_BDiagonal	\\\\\

hs_Cross	+++++

hs_DiagCross	xxxxx

hs_FDiagonal	/////

hs_Horizontal	-----

hs_Vertical	|||||


ht Hit test codes

Description

These codes indicate the position of the cursor in relation to a window and are passed in many messages involving placement or movement of the cursor, including wm_MouseActivate, wm_SetCursor, and wm_NCHitTest.

Constant	Meaning

htBottom	The window's bottom border.

htBottomLeft	The window's bottom left corner.

htBottomRight	The window's bottom right corner.

htCaption	The caption area.

htClient	The client area.

htError	Same as htNowhere, plus produces a beep.

htGrowBox	The size box.

htHScroll	The horizontal scroll bar.

htLeft	The window's left border.

htMenu	The menu area.

htNowhere	The screen background or a dividing line between windows.

htReduce	The minimize box.

htRight	The window's right border.

htSize	The same as htGrowBox.

htSysMenu	The Control-menu box.

htTop	The window's top border.

htTopLeft	The window's top left border.

htTopRight	The window's top right border.

htTransparent	A window currently covered by another.

htVScroll	The vertical scroll bar.

htZoom	The maximize box.


id Dialog box command IDs

Description

The following constants are return values for the MessageBox function. They indicate the result of the message box.

Constant	Meaning

idAbort	Abort button was pressed.

idCancel	Cancel button was pressed.

idIgnore	Ignore button was pressed.

idNo	No button was pressed.

idOk	OK button was pressed.

idRetry	Retry button was pressed.

idYes	Yes button was pressed.


idc_ Standard cursor IDs

Description

These IDs identify one of the stock cursors Windows defines. Load them with the LoadCursor function.

Constant	Meaning

idc_Arrow	Arrow.

idc_Cross	Crosshair.

idc_IBeam	I-beam for text.

idc_Icon	Empty icon (concentric squares).

idc_Size	Four-pointed arrow (north, south, east and west).

idc_SizeNESW	Two-pointed arrow (northeast and southwest).

idc_SizeNS	Two-pointed arrow (north and south).

idc_SizeNWSE	Two-pointed arrow (northwest and southeast).

idc_SizeWE	Two-pointed arrow (west and east).

idc_UpArrow	Vertical arrow pointing up.

idc_Wait	Hourglass.


idi_ Standard icon IDs

Description

These IDs identify one of the stock icons Windows defines. Load them with the LoadIcon function.

Constant	Meaning

idi_Application	Default.

idi_Asterisk	'i' for information messages.

idi_Exclamation	'!' for warnings.

idi_Hand	Stop sign for serious warnings.

idi_Question	'?' for prompting messages.


ie_ Open comm error flags

Description

These flags are negative values that specify a communication device opening error when returned by the OpenComm function.

Constant	Meaning

ie_BadID	Invalid ID.

ie_BaudRate	Unsupported baud rate.

ie_ByteSize	Invalid byte size.

ie_Default	Error in default parameters.

ie_Hardware	Hardware is absent.

ie_Memory	Unable to allocate queues.

ie_NOpen	Device not open.

ie_Open	Device already open.


lb_ List box return values constants
lb_ List box return values

Description

These values are returned from Windows list box messages such as lb_AddString. A negative value indicates an error.

Constant            Meaning

lb_Err	An error has occurred; the action was not performed

lb_ErrSpace	Not enough space in the list box to perform the action

lb_Okay	No error


lbn_ List box notification codes

Description

These control notification codes are passed in wm_Command messages generated by list box controls. They indicate the action that has occurred.

Constant	Meaning

lbn_DblClk	This code notifies the parent of a list box that an entry has been double-clicked with the mouse.

lbn_ErrSpace	This code notifies the parent of a list box that the system has run out of memory.

lbn_KillFocus	This code notifies the parent of a list box that the list box has lost the input focus.

lbn_SelChange	This code notifies the parent of a list box that the selection in the list box has been changed.

lbn_SetFocus	This code notifies the parent of a list box that the list box has received the input focus.


lbs_ List box styles

Description

These constants are used to specify list box styles when creating list boxes with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

lbs_ExtendedSel	This style of list box allows multiple items to be selected using the Shift key and the mouse or some other special key combination.

lbs_HasStrings	This style may be used with the lbs_OwnerDrawFixed or lbs_OwnerDrawVariable style.

This style of list box uses strings as its entries. The strings are managed by the system and may be retrieved using the lb_GetText message.

lbs_MultiColumn	This style of list box has multiple columns which can be scrolled horizontally.

The column width can be set using the lb_SetColumnWidth message.

lbs_MultipleSel	This style of list allows multiple items to be selected using the mouse.

Each time an entry is clicked or double-clicked its selection state is toggled.

lbs_NoIntegralHeight	This style of list box is exactly the size given when the list box is created.

Normally, the size of the list box used to create a list box may be changed so that the list box does not display partial entries.

lbs_NoRedraw	This style of list box is not redrawn when changes are made.

The wm_SetRedraw message is used to set or reset this style dynamically.

lbs_Notify	This style of list box has an input message sent to its parent window whenever an entry is clicked or double-clicked.

lbs_OwnerDrawFixed	The owner of the list box is responsible for drawing its contents;the items in the list box are the same height.

lbs_OwnerDrawVariable	The owner of the list box is responsible for drawing its contents;the items in the list box are variable in height.

lbs_OwnerDrawFixed	This style of list box must be drawn by its owner. All entries are the same height.

lbs_OwnerDrawVariable	This style of list box must be drawn by its owner. Each entry may be a different height.

lbs_Sort	This style of list box sorts its entries alphabetically.

The sort order may be different for list boxes with the lbs_OwnerDrawFixed or lbs_OwnerDrawVariable style.

lbs_Standard	This style is the same as the lbs_Notify and lbs_Sort styles together. The list box contains borders on all sides.

lbs_UseTabStops	This style of list box allows use of expanded Tab characters in its entries.

By default, there are tab stops each 32 dialog units from the left edge of the entry.

A dialog unit is one-fourth of the dialog base width unit, which can be obtained by using the GetDialogBaseUnits function.

lbs_WantKeyboardInput	This style of list box has wm_VKeyToItem and wm_CharToItem messages sent to its owner when the list box has the input focus and a key is pressed.


lc_ Line capabilities

Description

These constants represent the line rendering capabilities of a device.

Constant	Meaning

lc_None	Lines not supported.

lc_Interiors	Can do interiors.

lc_Marker	Can do markers.

lc_PolyLine	Can do polylines.

lc_PolyMarker	Can do polymarkers.

lc_Styled	Can do styled lines.

lc_Wide	Can do wide lines.

lc_WideStyled	Can do wide styled lines.


lf_FaceSize Logical font size constant

Description

The lf_FaceSize constant indicates the number of bytes used to store the font face name in the lfFaceName field of a TLogFont record. It is currently set to 32.


lmem_ Local memory flags

Description

These flags specify characteristics of the local memory block created with the functions LocalAlloc and LocalReAlloc.

lmem_Discardable, lmem_Discarded, lmem_LockCount are used in the LocalFlags function.

Constant	Meaning

lmem_Discardable	The memory block can be discarded. Must be used with lmem_Moveable.

lmem_Discarded	The memory block has been discarded. (LocalFlags only.)

lmem_LockCount	When combined with the low-order byte of the return value from LocalFlags, returns the memory block's reference count. (LocalFlags only.)

lmem_Fixed	The memory block is fixed in one memory location.

lmem_Modify	Modifies the lmem_Discardable flag.

lmem_Moveable	The memory block can move locations in memory.

lmem_NoCompact	When allocating the memory block, no other memory blocks will be compacted or discarded.

lmem_NoDiscard	When allocating the memory block, no other memory blocks will be discarded.

lmem_ZeroInit	Initializes the contents of the memory block to 0.


LTPx constant
LPTx constant

LPTx is a bit mask for the TDCB ID field. If the bit mask is set, the device is an LPT (parallel port).


ma_ Mouse activation codes

Description

These codes, when returned from a wm_MouseActivate message, indicate whether the window should be activated and whether the mouse event should be discarded.

Constant                   Meaning

ma_Activate	Activate the window.

ma_ActivateAndEat	Activate the window; discard the mouse event.

ma_NoActivate	Do not activate the window.


mb_ Message box flags

Description

These flags specify characteristics of the message box created with the MessageBox function. They are combined to create the desired style.

Constant	Meaning

mb_AbortRetryIgnore	Include only Abort, Retry and Ignore buttons.

mb_ApplModal	Create a modal message box (the default).

mb_DefButton1	The default button is the first button (the default).

mb_DefButton2	The default button is the second button.

mb_DefButton3	The default button is the third button.

mb_IconAsterisk	Same as mb_IconInformation.

mb_IconExclamation	Include the '!' icon.

mb_IconHand	Same as mb_IconStop.

mb_IconInformation	Include the 'i' icon.

mb_IconQuestion	Include the '?' icon.

mb_IconStop	Include the stop sign icon.

mb_Ok	Include only an OK button.

mb_OkCancel	Include only OK and Cancel buttons.

mb_RetryCancel	Include only Retry and Cancel buttons.

mb_SystemModal	Create a modal message box that suspends Windows. Use this for potentially damaging situations.

mb_TaskModal	Use this flag if no parent window is available. Supply 0 for the parent parameter, and all top-level windows in the application will be suspended.

mb_YesNo	Include only Yes and No buttons.

mb_YesNoCancel	Include only Yes, No, and Cancel buttons.

Several bit masks are defined for groups of mb_ constants:

Constant	Constants Masked

mb_DefMask	mb_DefButton1, mb_DefButton2, mb_DefButton3

mb_IconMask	mb_IconAsterisk, mb_IconExclamation, mb_IconHand, mb_IconInformation, mb_IconQuestion, mb_IconStop

mb_ModeMask	mb_ApplModal, mb_SystemModal, mb_TaskModal

mb_TypeMask	mb_AbortRetryIgnore, mb_Ok, mb_OkCancel, mb_RetryCancel, mb_YesNo, mb_YesNoCancel


meta_ Metafile codes

Description

These constants correspond to particular GDI functions.

The index values of these functions (and corresponding constants) can be stored in a Windows metafile, which is a list of GDI commands that can be played by a program to produce graphic output.

These constants are useful when reading a metafile.

Constant

meta_AnimatePalette

meta_Arc

meta_BitBlt

meta_Chord

meta_CreateBitmap

meta_CreateBitmapIndirect

meta_CreateBrush

meta_CreateBrushIndirect

meta_CreateFontIndirect

meta_CreatePalette

meta_CreatePatternBrush

meta_CreatePenIndirect

meta_CreateRegion

meta_DeleteObject

meta_DIBBitBlt

meta_DIBCreatePatternBrush

meta_DIBStretchBlt

meta_DrawText

meta_Ellipse

meta_Escape

meta_ExcludeClipRect

meta_ExtTextOut

meta_FillRegion

meta_FloodFill

meta_FrameRegion

meta_IntersectClipRect

meta_InvertRegion

meta_LineTo

meta_MoveTo

meta_OffsetClipRgn

meta_OffsetViewportOrg

meta_OffsetWindowOrg

meta_PaintRegion

meta_PatBlt

meta_Pie

meta_Polygon

meta_PolyLine

meta_PolyPolygon

meta_RealizePalette

meta_Rectangle

meta_ResizePalette

meta_RestoreDC

meta_RoundRect

meta_SaveDC

meta_ScaleViewportExt

meta_ScaleWindowExt

meta_SelectClipRegion

meta_SelectObject

meta_SelectPalette

meta_SetBKColor

meta_SetBKMode

meta_SetDIBToDev

meta_SetMapMode

meta_SetMapperFlags

meta_SetPalEntries

meta_SetPixel

meta_SetPolyFillMode

meta_SetRelAbs

meta_SetROP2

meta_SetStretchBltMode

meta_SetTextAlign

meta_SetTextCharExtra

meta_SetTextColor

meta_SetTextJustification

meta_SetViewportExt

meta_SetViewportOrg

meta_SetWindowExt

meta_SetWindowOrg

meta_StretchBlt

meta_TextOut


mf_ Menu flags

The following constants are used as flags in many menu functions and in the wm_MenuSelect message.

Constant	Meaning

mf_Bitmap	The menu item is a bitmap rather than a string.

mf_ByCommand	Indicates that the menu item will be specified with the menu item ID.

mf_ByPosition	Indicates that the menu item will be specified by position, where the first item is at position 0.

mf_Checked	Display a checkmark next to the menu item.

mf_Disabled	Disables the menu item.

mf_Enabled	Enables the menu item.

mf_Grayed	Disables and grays the menu item.

mf_Help	Indicates that the item is the help menu item.

mf_Hilite	Highlight the menu item.

mf_MenuBarBreak	Puts the popup menu item in a new column,separated by a bar.

mf_MenuBreak	Puts the popup menu item in a new column or the menu bar item in a new line.

mf_MouseSelect	Indicates that the item was selected with the mouse.

mf_OwnerDraw	Indicates that the menu item is an owner draw-item.

mf_Popup	Indicates that the new menu item also has sub-items.

mf_Separator	Inserts a horizontal separator bar in the menu.

mf_String	Indicates that the new menu item is a string.

mf_SysMenu	Indicates that the item is in the Control menu.

mf_Unchecked	Removes a checkmark, if any.

mf_Unhilite	Removes highlighting from the menu item.


mk_ Key state masks

Description

These masks are combined and passed in mouse click messages to find out about the state of particular keys and mouse buttons.

Constant	Meaning

mk_Control	The Ctrl key is down.

mk_LButton	The left mouse button is down.

mk_MButton	The middle mouse button is down.

mk_RButton	The right mouse button is down.

mk_Shift	The Shift key is down.


mm_ Mapping modes

Description

These constants specify the device context's mapping mode, the method by which logical units are converted into device units as well as the orientation of the axes.

They are used in the GetMapMode and SetMapMode functions.

Constant	Meaning

mm_Anisotropic	The units and axes are determined arbitrarily.

mm_HiEnglish	One logical unit equals 0.001 inches. The positive x-axis is to the right and the positive y-axis is up.

mm_HiMetric	One logical unit equals 0.01 millimeters. The positive x-axis is to the right and the positive y-axis is up.

mm_Isotropic	One logical x-axis unit equals one logical y-axis unit.

mm_LoEnglish	One logical unit equals 0.01 inches. The positive x-axis is to the right and the positive y-axis is up.

mm_LoMetric	One logical unit equals 0.1 millimeters. The positive x-axis is to the right and the positive y-axis is up.

mm_Text	One logical unit equals one pixel. The positive x-axis is to the right and the positive y-axis is down.

mm_Twips	One logical unit equals 1/1440 of an inch. The positive x-axis is to the right and the positive y-axis is up.


msgf_ Enter idle constants

Description

These constants are passed in the wm_EnterIdle message to specify whether the message resulted from a dialog box or a menu.

Constant	Meaning

msgf_DialogBox	The system is idle because a dialog box is displayed.

msgf_Menu	The system is idle because a menu is displayed.


msgf_ Filter proc codes

Description

These codes are passed in the Code parameter of message filter functions; wh_MsgFilter and wh_SysMsgFilter. They specify the types of messages being processed.

Constant 	wh_MsgFilter	wh_SysMsgFilter

msgf_DialogBox	Message and dialog boxes	Dialog boxes only

msgf_Menu	Keyboard and mouse	Keyboard and mouse

msgf_MessageBox	Message boxes only


obj_ GDI object type constants

Description

These two constants specify the type of GDI object, (pen or brush) to be enumerated in a call to the function EnumObjects.

They should be passed in the ObjectType parameter to EnumObjects.

Constant   Meaning

obj_Pen	Enumerate pens

obj_Brush	Enumerate brushes


obm_ Predefined bitmaps

Description

These constants specify one of the many bitmaps Windows predefines for its own use. The programmer can use them with the LoadBitmap function.

Those constants that begin with obm_Old refer to bitmaps used by Windows versions previous to 3.0.

obm_BtnCorners

obm_BtSize

obm_Check

obm_CheckBoxes

obm_Close

obm_Combo

obm_DnArrow

obm_DnArrowD

obm_LfArrow

obm_LfArrowD

obm_MnArrow

obm_Old_Close

obm_Old_DnArrow

obm_Old_LfArrow

obm_Old_Reduce

obm_Old_Restore

obm_Old_RgArrow

obm_Old_UpArrow

obm_Old_Zoom

obm_Reduce

obm_Reduced

obm_Restore

obm_Restored

obm_RgArrow

obm_RgArrowD

obm_Size

obm_UpArrow

obm_UpArrowD

obm_Zoom

obm_ZoomD


oda_ Owner draw actions

Description

These constants define an action to take place for an owner-draw control when used in the itemAction field of the record TDrawItemStruct. This field can be a combination of these constants.

Constant             Meaning

oda_DrawEntire	The entire control must be drawn.

oda_Focus	The focus was lost or gained.

oda_Select	The selection state has changed.


ods_ Owner draw states

Description

These constants define the state of an owner-draw control after drawing when used in the itemState field of the record TDrawItemStruct. This field can be a combination of these constants.

Constant             Meaning

ods_Checked	Check the menu item.

ods_Disabled	Disable the item.

ods_Focus	Give the item the input focus.

ods_Grayed	Gray the menu item.

ods_Selected	Select the item.


odt_ Owner draw control types

Description

These constants specify a particular type of owner-draw controls. They are used in the CtlType field of the records TCompareItemStruct, TDrawItemStruct, and TMeasureItemStruct.

Constant             Meaning

odt_Menu	Owner-draw menu

odt_ListBox	Owner-draw list box

odt_ComboBox	Owner-draw combo box

odt_Button	Owner-draw button


of_ Open file constants

Description

These constants, when combined and passed in calls to the OpenFile or _lopen functions, specify a file opening action.

Constant	Meaning

of_Cancel	Add a Cancel button to the dialog box produced with the of_Prompt constant.

If Cancel is pressed, OpenFile returns a file-not-found error. (OpenFile only.)

of_Create	Open a new file or clear an existing one. (OpenFile only.)

of_Delete	Delete a file. (OpenFile only.)

of_Exist	Test a named file for existence. (OpenFile only.)

of_Parse	Only fill the OFStruct record passed in the ReOpenBuff parameter. (OpenFile only.)

of_Prompt	If the file cannot be found, display a file-not-found dialog box. (OpenFile only.)

of_Read	Open a read-only file.

of_ReadWrite	Open a read-and-write file.

of_ReOpen	Open a file using the OFStruct record passed in the ReOpenBuff parameter. (OpenFile only.)

of_Share_Compat	Open a file, but allow other processes to open the file many times.

of_Share_Deny_None	Open a file, but allow other processes to read from or write to the file.

of_Share_Deny_Read	Open a file, but prevent other processes from reading the file.

of_Share_Deny_Write	Open a file, but prevent other processes from writing to the file.

of_Share_Exclusive	Open a file, but prevent other processes from reading or writing to the file.

of_Verify	Verify that the time and date of a file is identical to when it was previously opened. (OpenFile only.)

of_Write	Open a write-only file.


out_ Font output precision flags

Description

These constants specify the output precision of fonts produced with the CreateFont function.

Out_Default_Precis

Out_String_Precis

Out_Character_Precis

Out_Stroke_Precis


pc_ Palette entry flags

Description

These flags specify information about a palette.

Constant	Meaning

pc_Explicit	The low-order word of the logical palette entry specifies a hardware palette index.

pc_NoCollapse	The color will not be matched to existing palette color but will be added as a new entry into the system palette.

pc_Reserved	The color will be used for palette animation and will change frequently.

These constants are used in the peFlags field of the TPaletteEntryrecord, and passed in calls to the following functions:

AnimatePalette

GetPaletteEntries

GetSystemPaletteEntries

SetPaletteEntries


pc_ Polygonal capabilities

Description

These constants represent the polygon rendering capabilities of a device.

Constant	Meaning

pc_Interiors	Can do interiors.

pc_None	Polygonals not supported.

pc_Polygon	Can do polygons.

pc_Rectangle	Can do rectangles.

pc_ScanLine	Can do scanlines.

pc_Styled	Can do styled borders.

pc_Trapezoid	Can do trapezoids.

pc_Wide	Can do wide borders.

pc_WideStyled	Can do wide styled borders.

pc_WindPolygon	Can do winding polygons.


pm_ Peek message options

Description

These options specify the handling of messages processed with the PeekMessage function.

Constant	Meaning

pm_NoRemove	After processing, messages are not removed from the queue.

pm_NoYield	Lets no other task interrupt the processing of the current task.

pm_Remove	After processing, messages are removed from the queue.


PolyFill modes

Description

These constants specify the method in which complex polygons with more than one bounded regions are filled.

Constant	Meaning

Alternate	Fills in alternating regions.

Winding	Fills in every region.

Use these constants in calls to the following functions:

CreatePolygonRgn

CreatePolyPolygonRgn

GetPolyFillMode

SetPolyFillMode


pr_JobStatus Spooler status code

pr_JobStatus is the value passed in wParam to the wm_SpoolerStatus message.


Printer escape codes

Description

These codes, passed in the Escape function, allow applications to directly access device-specific facilities not supported by GDI.

Constant                         Meaning

AbortDoc	Terminates current printing job.

BandInfo	Copies information about the device's banding capabilities to a record passed in the call to Escape.

Begin_Path	Opens a path made of a connected sequence of primitives.

Paths are used to simplify the instructions sent to PostScript printers.

Clip_To_Path	Defines a clipping region based on the currently open path.

DeviceData	Same as PassThrough.

DraftMode	Turns draft mode on or off.

DrawPatternRect	Draws a patterned, gray-scale or black rectangle on a PCL-compatible Hewlett-Packard printer.

EnableDuplex	Enables the printer to print on both sides of the paper.

EnablePairKerning	Enables or disables the printer's ability to kern character pairs.

EnableRelativeWidths	Enables or disables the relative character widths.

End_Path	Ends a path. See Begin_Path.

EndDoc	Ends a print job started by StartDoc.

EnumPaperBins	Retrieves information about the printer's paper bins.

This is provided only for backward compatiblity: Use GetSetPaperBins instead.

EnumPaperMetrics	Retrieves the number of supported paper types or size of the printable rectanges.

This is only provided for backward compatiblity: Use the ExtDeviceMode function instead.

EPSPrinting	Suppresses the PostScript header control section, disallowing any GDI calls.

Ext_Device_Caps	Retrieves information about device-specific printer capabilities beyond what can be learned from calling the function GetDeviceCaps.

FlushOutput	Clears the device's buffer.

GDIExtTextOut	Performs the same task as the function ExtTextOut.

GDIStretchBlt	Performs the same task as the function StretchBlt.

GetColorTable	Retrieves an RGB color table entry.

GetExtendedTextMetrics	Retrieves the extended text metrics for the selected font.

GetExtentTable	Retrieves the extent (width) of a range of characters in the selected font's character set.

GetPairKernTable	Retrieves the character-pair kerning table.

GetPhysPageSize	Retrieves the physical page size.

GetPrintingOffset	Retrieves the offset from the upper-left corner of the page where the printing or drawing begins.

GetScalingFactor	Retrieves the x- and y-axis scaling factor of the printer.

GetSetPaperBins	Retrieves the number of printer paper bins and sets the current bin.

GetSetPaperMetrics	Retrieves the printer's paper metrics information and sets it with new information.

This is only provided for backward compatiblity: Use the ExtDeviceMode function instead.

GetSetPrintOrient	Retrieves or sets the current paper orientation.

This is only provided for backward compatiblity: Use the ExtDeviceMode function instead.

GetTechnolgy	Retrieves a string identifying the printer's general technology, such as PostScript.

GetTrackKernTable	Retrieves the track-kerning table for the currently selected font.

GetVectorBrushSize	Retrieves the width in device units of the plotter's pen used to fill closed shapes.

GetVectorPenSize	Retrieves the width in device units of the plotter's pen used in hatched brush patterns.

MFComment	Adds a comment to a metafile.

NewFrame	Informs the printer to advance to a new page.

NextBand	Informs the device driver that output to a band is complete.

PassThrough	Allows the application to send data directly to the printer.

QueryEscSupport	Determines whether the device driver supports a particular escape.

Restore_CTM	Restores the previously saved current transformation matrix.

Save_Ctm	Saves the current transformation matrix.

SelectPaperSource	Superseded by GetSetPaperBins. Provided only for backward compatibility.

Set_Arc_Direction	Specifies the direction in which arcs are drawn using the Arc function.

Set_Background_Color	Sets and retrieves the device's background color.

Set_Bounds	Sets the bounding rectangle for the picture being produced.

Set_Clip_Box	Sets or restores the previous clipping rectangle.

Set_Poly_Mode	Sets the poly mode, which determines how to interpret calls to the Polygon and PolyLine functions.

Set_Screen_Angle	Sets the current screen angle to simulate the tilting of a phographic mask in producing a color separation.

Set_Spread	Sets the amount that nonwhite primitives are expanded to make up for imperfections in the reproduction process.

SetAbortProc	Sets the abort function for the currrent print job.

SetAllJustValues	Sets the justification values for text output.

SetColorTable	Sets an RGB color-table entry.

SetCopyCount	Specifies the number of copies of each page to print.

SetKernTrack	Specifies which kerning track to use.

SetLineJoin	Specifies how to join to intersecting lines with a rounded, square or mitered corner.

SetMiterLimit	Sets the miter limit, which is the angle at which a miter join is replaced with a bevel join.

StartDoc	Informs the device driver that a new job is starting.

Transform_CTM	Modifies the current transformation matrix.


proc_ constants

These constants are passed as the ProcName parameter of the GetProcAddress function when the module handle passed in the Module parameter is a device driver.

Constant

proc_ExtDeviceMode

proc_DeviceCapabilities

proc_OldDeviceMode


ps_ Pen styles

Description

The following constants specify styles for pen tools. They are used in the CreatePen function.

Constant	Meaning

ps_Solid	A solid line.

ps_Dash	-------

ps_Dot	.......

ps_DashDot	 _._._._

ps_DashDotDot	_.._.._

ps_Null	Invisible.

ps_InsideFrame	Used to draw the inside frame of polygons and polylines.


r2_ Binary raster operations

Description

These constants specify the drawing mode for combining the colors of the current pen with the existing colors.They are used as parameters in the GetROP2 and SetROP2 functions.

Constant	Meaning

r2_Black	The resulting color is always black.

r2_CopyPen	The resulting color is always the pen color.

r2_MaskNotPen	The resulting color is a combination of the colors common to the existing display and the inverse of the current pen.

r2_MaskPen	The resulting color is a combination of the colors common to both the existing display and the current pen.

r2_MaskPenNot	The resulting color is the inverse of the color resulting from r2_MaskPen.

r2_MergeNotPen	The resulting color is a combination of the inverse of the current pen color and the existing display color.

r2_MergePen	The resulting color is a combination of the current pen color and the existing display color.

r2_MergePenNot	The resulting color is a combination of the current pen color and the inverse of the existing display color.

r2_Nop	The existing display does not change.

r2_Not	The resulting color is the inverse of the existing display color.

r2_NotCopyPen	The resulting color is the inverse of the current pen color.

r2_NotMaskPen	The resulting color is the inverse of the color resulting from the r2_MaskPen mode.

r2_NotMergePen	The resulting color is the inverse of the color resulting from the r2_MergePen mode.

r2_NotXorPen	The resulting color is the inverse of the color resulting from the r2_XorPen mode.

r2_White	The resulting color is white.

r2_XorPen	The resulting color is the combination of the colors in the existing display and the current pen, but not in both.


rc_ Raster capabilities

Description

These constants represent the raster capabilities of a device.

Constant	Meaning

rc_Banding	Device requires banding support.

rc_BigFont	Supports larger than 64K fonts.

rc_BitBlt	Can transfer bitmaps.

rc_Bitmap64	Device can support larger than 64K bitmaps.

rc_DI_Bitmap	Supports DIB to memory.

rc_DIBToDev	Supports SetDIBitsToDevice function.

rc_FloodFill	Supports the FloodFill function.

rc_GDI20_Output	Device supports Windows 2.0 capabilities.

rc_Palette	Supports a palette.

rc_Scaling	Device requires scaling support.

rc_StretchBlt	Supports the StretchBlt function.

rc_StretchDIB	Supports the StretchDIBits function.


Region flags

Description

These flags specify a type of graphic region.

Constant	Meaning

ComplexRegion	The region has overlapping borders.

Error	No new region was created.

NullRegion	The region is empty.

SimpleRegion	The region has no overlapping borders.

These constants are used as return values from the following functions:

CombineRgn

ExcludeClipRect

ExcludeUpdateRgn

GetClipBox

GetRgnBox

GetUpdateRgn

OffsetClipRgn

OffsetRgn

SelectClipRgn


Resource type constant

Description

This value is the number of defined resource types minus 1. If you add a new type, you must increment Difference, initially defined as -11.


rgn_ Combine region flags

Description

These flags specify the combination method used by the CombineRgn function to combine two regions.

Constant	Meaning

rgn_And	The resulting region is the intersection of the two provided regions.

rgn_Copy	The resulting region is a copy of the first provided region.

rgn_Diff	The resulting region includes the parts of the first region that are not also in the second region.

rgn_Or	The resulting region is the union of the two provided regions.

rgn_Xor	The resulting region includes the parts of the each region that are not in both regions.


rt_ Resource types

Description

These constants represent the available types of Windows resources. They are used as parameters in the FindResource function.

Constant	Meaning

rt_Accelerator	Accelerator table.

rt_Bitmap	Bitmap resource.

rt_Cursor	Cursor resource.

rt_Dialog	Dialog box template.

rt_Font	Font resource.

rt_FontDir	Font directory resource.

rt_Icon	Icon resource.

rt_Menu	Menu resource.

rt_RcData	User-defined resource (raw data).

rt_String	String resource.


s_ Sound constants

Description

These constants are used in a variety of sound functions, and are categorized by the function in which they are used.

Error values

These negative error values are returned from the sound functions.

Constant	Meaning

s_SerBDNT	Invalid note.

s_SerDCC	Invalid note count.

s_SerDDR	Invalid duration.

s_SerDFQ	Invalid frequency.

s_SerDLN	Invalid note length.

s_SerDMD	Invalid mode.

s_SerDPT	Invalid pitch.

s_SerDSH	Invalid shape.

s_SerDSR	Invalid source.

s_SerDST	Invalid state.

s_SerDTP	Invalid tempo.

s_SerDVL	Invalid volume

s_SerDVNA	Device not available.

s_SerMACT	Music active.

s_SerOFM	Out of memory.

s_SerQFUL	Queue full.

SetSoundNoise function constants

These constants specify the noise source, where N is a value used to derive a target frequency.

Constant	Meaning

s_Period512	High pitch, N/512. Hiss is less coarse.

s_Period1024	Medium pitch, N/1024.

s_Period2048	Low pitch, N/2048. Hiss is more coarse.

s_PeriodVoice	From voice channel 3.

s_White512	High pitch, N/512. Hiss is less coarse.

s_White1024	Medium pitch, N/1024.

s_White2048	Low pitch, N/2048. Hiss is more coarse.

s_WhiteVoice	From voice channel 3.

SetVoiceAccent function constants

These constants specify the accent of the notes to be played.

Constant	Meaning

s_Legato	Hold the note for the full duration, blending it with the start of the next note.

s_Normal	Hold the note for the full duration, coming to a stop before the start of the next note.

s_Staccato	Hold the note for shorter than the full duration, with a noticeable pause before the next note.

WaitSoundState function constants

These constants specify the state of the voice queues.

Constant	Meaning

s_AllThreshold	All voice queues have reached threshold.

s_QueueEmpty	All voice queues are empty and sound drivers are off.

s_Threshold	One voice queue has reached threshold and returns voice.


sb_ Scroll bar commands

Description

These constants specify scroll bar events.

Constant	Meaning

sb_Bottom	A scroll bar has been scrolled down or to the right.

sb_EndScroll	A scroll bar has been scrolled to the end.

sb_LineDown	A scroll bar has been scrolled one line down.

sb_LineUp	A scroll bar has been scrolled one line up.

sb_PageDown	A scroll bar has been scrolled one page down.

sb_PageUp	A scroll bar has been scrolled one page up.

sb_ThumbPosition	The thumb has been dragged to an absolute position.

sb_ThumbTrack	The thumb has been dragged to a specified position.

sb_Top	A scroll bar has been scrolled up or to the left.

These constants are passed as parameters in the following messages:

wm_HScroll

wm_HScrollClipboard

wm_VScroll

wm_VScrollClipboard


sb_ Scroll bar constants

Description

Constant	Meaning

sb_Both	Specifies the window's horizontal and vertical scroll bars. sb_Both is used only in the ShowScrollBar function.

sb_Ctl	Specifies a standalone scroll bar control.

sb_Horz	Specifies the window's horizontal scroll bar.

sb_Vert	Specifies the window's vertical scroll bar.

These constants identify the particular scroll bar specified in the following functions:

GetScrollPos

GetScrollRange

SetScrollPos

SetScrollRange

ShowScrollBar


sbs_ Scroll bar styles

Description

These constants are used to specify scroll bar styles when creating scroll bars with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

sbs_BottomAlign	This style of scroll bar is of default height and has its bottom edge aligned to the bottom edge of the rectangle used to create it.

The sbs_BottomAlign style may only be used if the sbs_Horz style is used also.

sbs_Horz	This style of scroll bar is horizontal.

If neither the sbs_BottomAlign nor the sbs_TopAlign style is used, the scroll bar will be the exact size requested when it is created.

sbs_LeftAlign	This style of scroll bar is of default width and has its left edge aligned to the left edge of the rectangle used to create it.

The sbs_LeftAlign style may only be used if the sbs_Vert style is used also.

sbs_RightAlign	This style of scroll bar is of default width and has its right edge aligned to the right edge of the rectangle used to create it.

The sbs_RightAlign style may only be used if the sbs_Vert style is used also.

sbs_SizeBox	This style of scroll bar is a size box.

If neither the sbs_SizeBoxBottomRightAlign nor the sbs_SizeBoxTopLeftAlign style is used, the scroll bar will be the exact size requested when it is created.

sbs_SizeBoxBottomRightAlign	This style of scroll bar is of default size for system size boxes and has its lower-right corner aligned to the lower-right corner of the rectangle used to create it.

The sbs_SizeBoxBottomRightAlign style may only be used if the sbs_SizeBox style is used also.

sbs_SizeBoxTopLeftAlign	This style of scroll bar is of default size for system size boxes and has its upper-left corner aligned to the upper-left corner of the rectangle used to create it.

The sbs_SizeBoxTopLeftAlign style may only be used if the sbs_SizeBox style is used also.

sbs_TopAlign	This style of scroll bar is of default height and has its top edge aligned to the top edge of the rectangle used to create it.

The sbs_TopAlign style may only be used if the sbs_Horz style is used also.

sbs_Vert	This style of scroll bar is vertical.

If neither the sbs_RightAlign nor the sbs_LeftAlign style is used, the scroll bar will be the exact size requested when it is created.


sc_ System command values

Description

The following commands are passed in the wm_SysCommand message in response to a selection in the Control menu or a click in the minimize or maximize box. They indicate the action requested.

Constant	Meaning

sc_Close	Close the window.

sc_HScroll	Horizontally scroll.

sc_KeyMenu	Get the menu through a key stroke.

sc_Maximize	Maximize the window.

sc_Minimize	Minimize the window.

sc_MouseMenu	Get the menu through a mouse click.

sc_Move	Move the window.

sc_NextWindow	Move to the next window.

sc_PrevWindow	Move to the previous window.

sc_Restore	Restore the window from a maximized or minimized state.

sc_Size	Size the window.

sc_TaskList	Bring up a task list.

sc_VScroll	Vertically scroll.


show_ Old Show Window constants

Description

These are old constants, included only for backwards compatibility with previous versions of Windows. Use the sw_ Show window constants instead.

Constant	Value	Meaning

hide_Window	0	Hide window

show_OpenWindow	1	Restore window from icon

show_IconWindow	2	Shrink window to icon

show_FullScreen	3	Zoom window to fill screen

show_OpenNoActivate	4	Restore window, but don't make it active


size Size constants

Description

These constants indicate the type of window sizing occurred. They are passed in wm_Size messages.

Constant	Meaning

SizeFullScreen	The window was maximized.

SizeIconic	The window was minimized.

SizeNormal	The window was resized, but not maximized or minimized.

SizeZoomHide	Some other window was maximized.

SizeZoomShow	Some other window was restored from a maximized state.


sm_ System metrics codes

Description

These codes specify aspects of the Windows user interface about which the programmer can obtain dimensions with the GetSystemMetrics function.

Constant	Meaning

sm_CXBorder	Non-sizable window frame width.

sm_CXCursor	Cursor width.

sm_CXDlgFrame	ws_DlgFrame style window frame width.

sm_CXFrame	Sizable window frame width.

sm_CXFullScreen	Maximized window's client area width.

sm_CXHScroll	Horizontal scroll bar arrow width.

sm_CXHThumb	Horizontal scroll bar thumb width.

sm_CXIcon	Icon width.

sm_CXMin	Window's minimum width.

sm_CXMinTrack	Window's minimum tracking width.

sm_CXScreen	Screen width.

sm_CXSize	Title bar bitmap width.

sm_CXVScroll	Vertical scroll bar arrow width.

sm_CYBorder	Non-sizable window frame height.

sm_CYCaption	Caption height.

sm_CYCursor	Cursor height.

sm_CYDlgFrame	ws_DlgFrame style window frame height.

sm_CYFrame	Sizable window frame height.

sm_CYFullScreen	Maximized window's client area height.

sm_CYHScroll	Horizontal scroll bar arrow height.

sm_CYIcon	Icon height.

sm_CYKanjiWindow	Kanji window height.

sm_CYMenu	Single-line menu height.

sm_CYMin	Window's minimum height.

sm_CYMinTrack	Window's minimum tracking height.

sm_CYScreen	Screen height.

sm_CYSize	Title bar bitmap height.

sm_CYVScroll	Vertical scroll bar arrow height.

sm_CYVThumb	Vertical scroll bar thumb width.

sm_Debug	Return 0 if the version of Windows running is not the debugging version.

sm_MousePresent	Return 0 if mouse is absent.

sm_SwapButton	Return 0 if mouse buttons are not swapped.


sp_ Spooler error codes

Description

These constants are returned as error codes from the Escape function.

Constant	Meaning

sp_AppAbort	The application terminated the job.

sp_Error	General error.

sp_OutOfDisk	Not enough disk space for spooling.

sp_OutOfMemory	Not enough memory for spooling.

sp_UserAbort	User terminated the job from the spooler.


ss_ Static control styles

Description

These constants are used to specify static control styles when creating static controls with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

ss_BlackFrame	This style of static control has a frame with the same color as window frames.

ss_BlackRect	This style of static control is filled with the same color used to draw window frames.

ss_Center	This style of static control displays its text centered in its rectangle.

If the text is longer than will fit in the width of the control, the line is wrapped to the next line. Lines are broken at word boundaries and each line is centered.

ss_GrayFrame	This style of static control has a frame with the same color as the screen background.

ss_GrayRect	This style of static control is filled with the color used to fill the screen background.

ss_Icon	This style of static control is an icon. The text of the control is the name of the icon as found in the resource file. Icons automatically size themselves.

ss_Left	This style of static control displays its text flush-left in its rectangle.

If the text is longer than will fit in the width of the control, the line is wrapped to the next line. Lines are broken at word boundaries and each line is left aligned.

ss_LeftNoWordWrap	This style of static control displays its text flush-left in its rectangle.

If the text is longer than will fit in the width of the control, the extra text is clipped.

ss_NoPrefix	This style of static control ignores '&'characters in its text.

Normally the '&'character is used as an accelerator prefix character that is removed and the next character in the string is underlined.

ss_Right	This style of static control displays its text flush-right in its rectangle.

If the text is longer than will fit in the width of the control, the line is wrapped to the next line. Lines are broken at word boundaries and each line is right aligned.

ss_Simple	This style of static control displays one line of text flush-left. The text cannot be altered.

The control's parent must not process the wm_CtlColor message.

ss_UserItem	This style of static control is a user defined static control.

ss_WhiteFrame	This style of static control has a frame with the same color as window backgrounds.

ss_WhiteRect	This style of static control is filled with the color used to fill window backgrounds.


Stock Logical Objects

Description

These constants represent predefined (stock) drawing tools. They are used in the GetStockObject function.

Constant	Meaning

Black_Brush	Black brush.

DkGray_Brush	Dark gray brush.

Gray_Brush	Gray brush.

Hollow_Brush	Hollow brush.

LtGray_Brush	Light gray brush.

Null_Brush	Null brush.

White_Brush	White brush.

Black_Pen	Black pen.

Null_Pen	Null pen.

White_Pen	White pen.

ANSI_Fixed_Font	ANSI fixed-pitch system font.

ANSI_Var_Font	ANSI variable-pitch system font.

Device_Default_Font	Device-dependent font.

OEM_Fixed_Font	OEM-dependent fixed font.

System_Fixed_Font	Fixed-pitch font from previous versions of Windows.

System_Font	The Windows system font (variable-pitch).

Default_Palette	The default color palette.


StretchBlt modes

Description

These constants are bitmap stretching modes used in GetStretchBltMode and SetStretchBltMode functions.

Constant	Meaning

BlackOnWhite	Use the AND operator to eliminate the bitmap's lines, preserving the bitmap's black sections.

ColorOnColor	Eliminate lines regardless of their content, losing information in the process.

WhiteOnBlack	Use the OR operator to eliminate the bitmap's lines, preserving the bitmap's white sections.


sw_ Show window constants

Description

These constants indicate the state in which the ShowWindow function displays a window.

Constant	Meaning

sw_Hide	Hidden.

sw_Maximize	Same as sw_ShowMaximized.

sw_Minimize	Minimized and inactive.

sw_Normal	Same as sw_ShowNormal.

sw_OtherZoom	Another window is being maximized. (Included for Windows 2.0 compatibility.)

sw_OtherUnzoom	Another window is being minimized. (Included for Windows 2.0 compatibility.)

sw_Restore	Same as sw_ShowNormal.

sw_Show	In the window's current size and position.

sw_ShowMaximized	Maximized and active.

sw_ShowMinimized	Minimized and active.

sw_ShowMinNoActive	Minimized. Does not affect window activation.

sw_ShowNA	In the window's current state. Does not affect window activation.

sw_ShowNoActivate	In the window's current size and position. Does not affect window activation.

sw_ShowNormal	Restored and active.


sw_ Show window message constants

Description

These identifiers indicate the status of the window being shown and are passed in the wm_ShowWindow message.

Constant	Meaning

sw_ParentClosing	Either the window's parent is being minimized or a popup window is being hidden.

sw_ParentOpening	Either the window's parent window is being displayed or a popup window is being shown.


swp_ Set window position flags

Description

These flags are passed in the SetWindowPos and DeferWindowPos functions to signify one or many actions relating to the specified window.

Constant	Meaning

swp_DrawFrame	Draws a window frame defined by the window class.

swp_HideWindow	Hides the window.

swp_NoActivate	Does not affect the active window.

swp_NoMove	Does not reposition the window according to the supplied coordinates.

swp_NoRedraw	Does not redisplay the window to reflect the requested changes.

swp_NoSize	Does not resize the window according to the supplied width and height.

swp_NoZOrder	Does not affect the ordering of the windows.

swp_ShowWindow	Displays the window.


syspal_ System palette flags

Description

These constants specify the new use of the system palette. They are used in the GetSystemPaletteUse and SetSystemPaletteUse functions.

Constant	Meaning

syspal_NoStatic	The system palette contains no static color besides black and white.

syspal_Static	The system palette contains static colors that will not change when an application realize its logical palette.


ta_ Text alignment options

Description

These alignment options govern the alignment of text drawn with the TextOut and ExtTextOut functions. They are specified or returned in the GetTextAlign and SetTextAlign functions.

Constant	Meaning

ta_BaseLine	By the baseline of the current font.

ta_Bottom	By the bottom of the bounding rectangle.

ta_Center	By the horizontal center of the bounding rectangle.

ta_Left	By the left side of the bounding rectangle. This is a default.

ta_NoUpdateCP	The current position is not updated after each call to TextOut or ExtTextOut. This is a default.

ta_Right	By the right side of the bounding rectangle.

ta_Top	By the top of the bounding rectangle. This is a default.

ta_UpdateCP	The current position is updated after each call to TextOut or ExtTextOut.


tc_ Text rendering capabilities

Description

These constants represent the text rendering capabilities of a device.

Constant	Meaning

tc_cp_Stroke	Can do stroke clip precision.

tc_cr_90	Can do 90-degree character rotation.

tc_cr_Any	Can do any character rotation.

tc_ea_Double	Can do double-weight characters.

tc_ia_Able	Can do italic characters.

tc_op_Character	Can do character output precision.

tc_op_Stroke	Can do stroke output precision.

tc_ra_Able	Can do raster fonts.

tc_sa_Contin	Can do any multiples for scaling.

tc_sa_Double	Can do doubled character for scaling.

tc_sa_Integer	Can do integer multiples for scaling.

tc_sf_X_YIndep	Can do scaling independent of X and Y.

tc_so_Able	Can do striked-out characters.

tc_ua_Able	Can do underlined characters.

tc_va_Able	Can do vector fonts.


tf_ForceDrive GetTempFileName flag

Description

When combined with the DriveLetter argument in a call to the GetTempFileName function, tf_ForceDrive ensures that the temporary file will be created on the specified drive.

Otherwise, it will be created on the first hard disk or in the directory specified in the TEMP environment variable.


Ternary raster operations

Description

These constants are used as raster operation codes.

Constant	Meaning

Blackness	Produces completely black output.

DSTInvert	Produces an inverted bitmap.

MergeCopy	Combines the pattern and the source bitmap using the logical AND operation.

MergePaint	Combines the destination and the inverted source bitmaps using the logical OR operation.

NotSrcCopy	Inverts the source bitmap and copies it to the destination bitmap.

NotSrcErase	Inverts the result of MergePaint.

PatCopy	Copies the specified pattern to the bitmap.

PatInvert	Combines the destination bitmap and pattern using the logical XOR operation.

PatPaint	Combines the source bitmap and pattern using OR, and then with the destination bitmap using OR.

SrcAnd	Combines the source and destination bitmap using the AND operation.

SrcCopy	Copies the source bitmap to the destination.

SrcErase	Combines the source and the inverted destination using AND.

SrcInvert	Combines the source and destination bitmap using XOR.

SrcPaint	Combines the source and destination bitmap using OR.

Whiteness	Produces completely white output.

These constants are used in the following functions:

BitBlt

PatBlt

StretchBlt

StretchDIBits


vk_ Virtual key codes

Description

Virtual key codes are constants used to represent a computer's standard keys. Use these codes when processing keyboard input, since different brands of computers might have a different set of keys. This enables one application to run on many different computers.

These codes are used when defining accelerators or when processing the keyboard messages wm_KeyDown, wm_KeyUp, wm_SysKeyDown, and wm_SysKeyUp.

Virtual Key Code	Corresponding Key or Button

vk_A to vk_Z 	'A' to 'Z'

vk_0 to vk_9	'0' to '9'

vk_NumPad0 to vk_NumPad9	'0' to '9' (numeric key pad)

vk_LButton	Left mouse button

vk_RButton	Right mouse button

vk_Cancel	Used for control-break processing

vk_MButton	Middle mouse button

vk_Back	Backspace

vk_Tab	Tab

vk_Clear	Clear

vk_Return	Return

vk_Shift	Shift

vk_Control	Ctrl

vk_Menu	Menu key

vk_Pause	Pause

vk_Capital	Caps Lock

vk_Escape	Esc

vk_Space	Spacebar

vk_Prior	Page Up

vk_Next	Page Down

vk_End	End

vk_Home	Home

vk_Left	Left arrow

vk_Up	Up arrow

vk_Right	Right arrow

vk_Down	Down arrow

vk_Select	Select

vk_Print	OEM specific

vk_Execute	Execute

vk_SnapShot	Printscreen

vk_Insert	Insert

vk_Delete	Delete

vk_Help	Help

vk_Multiply	Multiply (gray '*')

vk_Add	Add (gray '+')

vk_Separator	Separator

vk_Subtract	Subtract (gray '-')

vk_Decimal	Decimal (numeric key pad '.')

vk_Divide	Divide (gray '/')

vk_F1 to vk_F16	F1 to F16 function keys

vk_NumLock	Num Lock


wep_ DLL exit codes

Description

These codes are used in the ExitCode variable accessible from a dynamic-link library.

Code                         Meaning

wep_Free_DLL	Indicates that only the DLL is terminating and will be removed from memory.

wep_System_Exit	Indicates that Windows itself is terminating.


wf_ Windows memory configuration flags

Description

These constants specify the current Windows memory configuration. They are used as return values from the GetWinFlags function.

Constant	Meaning

wf_80x87	The computer has an Intel math co-processor.

wf_CPU086	The computer's CPU is an 8086.

wf_CPU186	The computer's CPU is an 80186.

wf_CPU286	The computer's CPU is an 80286.

wf_CPU386	The computer's CPU is an 80386.

wf_CPU486	The computer's CPU is an 80486.

wf_Enhanced	Windows is running in 386-Enhanced (protected) mode.

wf_LargeFrame	The system is configured as large frame.

wf_PMode	Windows is running under protected (386-Enhanced or Standard) mode.

wf_SmallFrame	The system is configured as small frame.

wf_Standard	Windows is running in Standard (protected) mode.

wf_Win286	Same as wf_Standard, or Standard mode.

wf_Win386	Same as wf_Enhanced, or 386 Enhanced mode.


wh_ Windows hook codes

Description

These codes specify a particular type of filter function to be installed (SetWindowsHook function) or removed (UnhookWindowsHook function) from a chain of filter functions.

Constant	Meaning

wh_CallWndProc	Window function filter.

wh_GetMessage	Message filter.

wh_JournalPlayback	Journaling playback filter.

wh_JournalRecord	Journaling record filter.

wh_Keyboard	Keyboard filter.

wh_MsgFilter	Message filter (SetWindowsHook only.)

wh_SysMsgFilter	System-wide message filter (SetWindowsHook only.)


ws_ Window styles

Description

These constants are used in combination to specify window styles when creating windows, dialogs and controls with the CreateWindow and CreateWindowEx functions.

Constant	Meaning

ws_Border	This style of window has a border. The ws_Border style cannot be used with the ws_DlgFrame style.

ws_Caption	This style of window has a title bar and a border. The ws_Caption and ws_DlgFrame style cannot be used together.

The ws_Border style is implied when the ws_Caption style is used.

ws_Child	This style of window is a child window. The ws_Child and ws_Popup styles cannot be used together.

ws_ChildWindow	Same as ws_Child.

ws_ClipChildren	This style of window does not include the area covered by its child windows when drawing.

ws_ClipSiblings	This style of window clips all sibling windows when drawing. This means that drawable regions in each client region of child windows of the same parent will not overlap.

If the ws_ClipSiblings style is used, the ws_Child style must be used also.

ws_Disabled	This style of window is initially disabled.

ws_DlgFrame	This style of window has a double border and no title. The ws_DlgFrame style cannot be used with the ws_Border style.

ws_Group	This style of window is a control which is the first of a group of controls which can be accessed using the arrow keys.

Each control defined without the ws_Group style belong to the group started by the last control with the ws_Group style.

ws_HScroll	This style of window has a horizontal scroll bar.

ws_Iconic	Same as ws_Minimize.

ws_Maximize	This style of window appears full screen (maximized).

ws_MaximizeBox	This style of window has a maximize box.

ws_Minimize	This style may only be used with the ws_Overlapped style. This style of window is initially minimized (iconic).

ws_MinimizeBox	This style of window has a minimize box.

ws_Overlapped	This style of window is an overlapped window. An overlapped window has a caption and a border.

ws_OverlappedWindow	This is the same as the following styles combined:

ws_Overlapped       ws_Caption

ws_SysMenu           ws_ThickFrame

ws_MinimizeBox     ws_MaximizeBox

ws_Popup	This style of window is a pop-up window. The ws_Child and ws_Popup styles may not be used together.

ws_PopupWindow	This style is the same as the ws_Border, ws_Popup, and ws_SysMenu styles combined. The Control-menu box will be visible only if the ws_Caption style is used also.

ws_SizeBox	Same as ws_ThickFrame.

ws_SysMenu	This style of window has a Control-menu box in its title bar. It applies only to windows with title bars.

ws_TabStop	This style of window is a control which is in a list of controls which can be cycled through using the Tab key. The control must be the child of a dialog box.

ws_ThickFrame	This style of window has a thick frame that can be used to size the window.

ws_Tiled	Same as ws_Overlapped.

ws_TiledWindow	Same as ws_OverlappedWindow.

ws_Visible	This style of window is initially invisible.

ws_VScroll	This style of window has a vertical scroll bar.

Styles that can't be used together

ws_Border	&	ws_DlgFrame

ws_caption	&	ws_DlgFrame

ws_Child	&	ws_PopUp

Styles that are the same

ws_Child	&	ws_ChildWindow

ws_Iconic	&	ws_Minimize

ws_SizeBox	&	ws_ThickFrame

ws_Tiled	&	ws_Overlapped

ws_TiledWindow	&	ws_OverlappedWindow


ws_ex_ Extended window styles

Description

These constants are used in combination to specify window styles when creating windows, dialogs, and controls with the  CreateWindow and CreateWindowEx functions.

Constant	Meaning

ws_ex_DlgModalFrame	This style of window has a double border. The ws_Caption style may be used with the ws_ex_DlgModalFrame style.

ws_ex_NoParentNotify	Specifies that a child window created with this style will not send the wm_ParentNotify message to its parent window when the child window is created or destroyed.


bm_GetCheck message

Description

Determines whether a radio button or check box is checked.

Parameters

wParam	Not used

lParam	Not used

Return Value

Non-zero if the radio button or check box is checked;

0 for a push button;

0 otherwise.


bm_GetState message

Description

Determines the state of a button control when a mouse button or spacebar is pressed.

Parameters

wParam	Not used

lParam	Not used

Return Value

Non-zero if any of  the following:

-	The button is a highlighted push button.

-	The button has the input focus and a mouse button or the spacebar is pressed.

-	The mouse button is pressed when the cursor is over the button.

0 otherwise.


bm_SetCheck message

Description

Checks or removes a checkmark from a radio button or check box.

Parameters

wParam	For two-state buttons and check boxes:

0	The checkmark (if any) is removed; otherwise, a checkmark is added.

For three-state buttons:

0	The checkmark and graying (if any) are removed.

1	A checkmark is added.

2	The button is grayed.

lParam	Not used

Return Value

Not used


bm_SetState message
bm_SetState

Description

Changes the state of a button or check box.

Parameters

wParam	Non-zero if the button is highlighted;

0 if the button or check box is drawn normally.

lParam	Not used

Return Value

Not used


bm_SetStyle message

Description

Changes the style of a button.

Parameters

wParam	The new button style (see bs_ ButtonStyles)

lParam	Non-zero	The button will be redrawn if the new button style is different than the current button style.

0	The button will not be immediately redrawn.

Return Value

Not used


cb_AddString message

Description

Adds a string to a combo box's list box.

Parameters

wParam	Not used

lParam	A pointer to a null-terminated string to be added

Comments

If the combo box's list box is not sorted, the string is put at the end of the list.

If the combo box has one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable and does not have the style cbs_HasStrings:

-	lParam is a 32-bit value which is stored instead of a string, and

-	each entry added is compared to other entries one or more times via a wm_CompareItem message sent to the owner of the combo box.

Return Value

The index at which the string was added if successful;

cb_Err if there was an error;

cb_ErrSpace if there wasn't enough memory available to store the string.


cb_DeleteString message

Description

Deletes a string from a combo box's list box.

Parameters

wParam	The index of the list box entry to be deleted

lParam	Not used

Comments

If the combo box has one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable and does not have the style cbs_HasStrings:

-	the associated 32-bit value is deleted, and

-	wm_DeleteItem message is sent to the owner of the combo box.

Return Value

The number of entries remaining in the list if wParam is a valid index;

cb_Err otherwise.


cb_Dir message

Description

Adds to a combo box's list box each file name in the current directory that matches a file specification and DOS file attribute.

Parameters

wParam	The DOS file attribute

lParam	A pointer to a null-terminated file specification string

Return Value

The index of the last entry in the resulting list if successful;

cb_Err if there was an error;

cb_ErrSpace if there wasn't enough memory available to store the entries.


cb_FindString message

Description

Finds the first entry of a combo box's list box that matches a prefix string.

Parameters

wParam	The index at which to start the search; the first entry looked at is the one after wParam:

-	If the end of the list is reached, the search will continue with entry 0 until the search index reaches wParam.

-	If -1, the entire list is searched starting at entry 0.

lParam	A pointer to a null-terminated prefix string

Comments

If the combo box has one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable and does not have the style cbs_HasStrings, lParam is a 32-bit value which is compared to each associated 32-bit value in the list.

Return Value

The index of the first matching entry if successful;

cb_Err otherwise.


cb_GetCount message

Description

Returns the number of entries in a combo box's list box.

Parameters

wParam	Not used

lParam	Not used

Return Value

The count of the list box entries


cb_GetCurSel message

Description

Returns the index of the currently selected entry in a combo box's list box.

Parameters

wParam	Not used

lParam	Not used

Return Value

The index of the currently selected entry if an entry is selected;

cb_Err if no entry is selected.


cb_GetEditSel message

Description

Returns the start and end indexes of the selected text in a combo box's edit control.

Parameters

wParam	Not used

lParam	Not used

Return Value

Starting index in the low-order word;

Ending index in the high-order word;

cb_Err if the combo box has no edit control.


cb_GetItemData message

Description

Returns the 32-bit value associated with an entry in a combo box's list box.

Parameters

wParam	The entry index

lParam	Not used

Return Value

The 32-bit value associated with the entry if successful;

cb_Err otherwise.


cb_GetLBText message

Description

Copies an entry from a combo box's list box into a supplied buffer.

Parameters

wParam	The entry index

lParam	A pointer to a buffer; the buffer must have enough space to contain the entry and a terminating null character.

Comments

If the combo box has one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable and does not have the style cbs_HasStrings the 32-bit value associated with the list entry is copied into the buffer.

Return Value

Not used


cb_GetLBTextLen message

Description

Returns the length in bytes of an entry in a combo box's list box.

Parameters

wParam	The entry index

lParam	Not used

Return Value

The length of the entry at that index if wParam is a valid index;

cb_Err otherwise.


cb_InsertString message

Description

Inserts a string into a combo box's list box without sorting.

Parameters

wParam	If -1, the string is added to the end of the list;

otherwise, wParam is used as the index at which to insert the string.

lParam	Points to a null-terminated string to be inserted.

Return Value

The index at which the string was inserted if successful;

cb_Err if there was an error;

cb_ErrSpace if there wasn't enough memory available to store the string.


cb_LimitText message

Description

Sets a limit to the number of characters which may be typed into a combo box's edit control.

Parameters

wParam	The new maximum number of characters to be allowed; 0 is no limit.

lParam	Not used

Return Value

scb_Err if the combo box has no edit control;

Non-zero if successful;

0 otherwise.


cb_ResetContent message

Description

Removes all entries from a combo box's list box.

Parameters

wParam	Not used

lParam	Not used

Comments

If the combo box has one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable and does not have the style cbs_HasStrings, a wm_DeleteItem message is sent to the owner of the combo box for each entry.

Return Value

Not used


cb_SelectString message

Description

Selects the first entry of a combo box's list box that matches a prefix string and updates the combo box's edit control or static-text control to reflect the selection.

Parameters

wParam	The index at which to start the search; the first entry looked at is the one after wParam.

 0	If the end of the list is reached, the search will continue with entry 0 until the search index reaches wParam.

-1	The entire list is searched starting at entry 0.

lParam	A null-terminated prefix string

Comments

If the combo box has one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable and does not have the style cbs_HasStrings, lParam is a 32-bit value which is compared to each associated 32-bit value in the list.

Return Value

The index of the first matching entry if successful;

cb_Err if the current selection remains unchanged.


cb_SetCurSel message

Description

Selects an entry of a combo box's list box and updates the combo box's edit control or static-text control to reflect the selection.

Parameters

wParam	The entry index; if -1, no selection

lParam	Not used

Return Value

The index of the selected entry if wParam is a valid index;

cb_Err if wParam is -1 or not a valid index.


cb_SetEditSel message

Description

Sets the selected text in a combo box's edit control.

Parameters

wParam	Not used

lParamLo	The starting character index

lParamHi	The ending character index

Return Value

cb_Err if the combo box has no edit control;

Non-zero if successful;

0 if not successful;


cb_SetItemData message

Description

Sets the 32-bit value associated with an entry in a combo box's list box.

Parameters

wParam	The entry index

lParam	The new 32-bit value to be associated with the entry

Return Value

cb_Err if there is an error.


cb_ShowDropDown message

Description

Shows or hides a combo box's drop-down list box.

Parameters

wParam	If 0, the drop-down list box is hidden;otherwise, it is shown.

lParam	Not used

Comments

This message only applies to combo boxes created with one of the cbs_ Combo box styles cbs_DropDown or cbs_DropDownList.

Return Value

Not used


dm_GetDefID message

Description

Returns a dialog's default push-button control ID.

Parameters

wParam	Not used

lParam	Not used

Return Value

dc_HasDefID in the high-order word;

ID (the default push button ID) in the low-order word;

0 in the high-order word if there is no default push-button ID for the dialog.


dm_SetDefID message

Description

Sets a dialog's default push-button control ID.

Parameters

wParam	The new default push-button ID

lParam	Not used

Return Value

Not used


em_CanUndo message

Description

Determines whether an edit control can respond to an em_Undo message.

Parameters

wParam	Not used

lParam	Not used

Return Value

Non-zero if the edit control can respond to an em_Undo message;

0 otherwise.


em_EmptyUndoBuffer message

Description

Empties an edit control's undo buffer, which disables its ability to undo the last edit.

Parameters

wParam	Not used

lParam	Not used

Comments

A wm_SetText or em_SetHandle message sent to an edit control causes the edit control's undo buffer to be emptied automatically.

Return Value

Not used


em_FmtLines message

Description

Tells an edit control whether or not to add a special end-of-line character sequence to word wrapped text lines.

Parameters

wParam	If non-zero, word wrapped lines are terminated with a CR, CR, LF character sequence;

otherwise, any CR, CR, LF character sequence is removed from the text.

lParam 	Not used

Comments

Normal end-of-line character sequences (a single CR followed by a LF) are not affected by this message. The size of the text is changed when a non-zero value is returned. This message only applies to multiline edit controls.

Return Value

Non-zero if the text was altered;

0 if the text was not altered.


em_GetHandle message

Description

Returns an edit control's buffer's handle. The buffer contains the edit control text.

Parameters

wParam	Not used

lParam	Not used

Comments

This message may only be sent to an edit control that which was created with the ds_LocalEdit style.

Return Value

The edit control's buffer's handle.


em_GetLine message

Description

Returns one line from an edit control.

Parameters

wParam	The line number; lines start at 0 in an edit control.

lParam	Points to a buffer that which is to contain the line; the first word of the buffer is the number of bytes to be transferred to the buffer.

Comments

This message only applies to multiline edit controls.

Return Value

The actual number of bytes transferred. No terminating null character is added to the end of the buffer.


em_GetLineCount message

Description

Returns the number of text lines in the edit control.

Parameters

wParam	Not used

lParam	Not used

Comments

This message only applies to multiline edit controls.

Return Value

The number of text lines


em_GetModify message

Description

Returns an edit control's modify flag. The modify flag is set when:

-	The edit control's text is modified by entering new text.

-	Existing text is modified.

-	An em_SetModify message is sent to the edit control.

Parameters

wParam	Not used

lParam	Not used

Return Value

The edit control's modify flag;

Non-zero if text was modified;

0 if text was not modified.


em_GetRect message

Description

Retrieves the formatting rectangle of an edit control.

Parameters

wParam	Not used

lParam	Points to a Rect data structure that which is filled in by this message.

Return Value

Not used


em_GetSel message

Description

Returns the start and end indexes of the selected text in an edit control.

Parameters

wParam	Not used

lParam	Not used

Return Value

Starting index in the low-order word;

Ending index in the high-order word.


em_LimitText message

Description

Sets a limit to the number of characters that can be typed in to an edit control.

Parameters

wParam	The new maximum number of characters to be allowed; if 0, no limit

lParam	Not used

Return Value

Non-zero if successful;

0 otherwise.


em_LineFromChar message

Description

Returns the number of the line in an edit control that which contains the specified character index.

Parameters

wParam	The index of the character in the edit control or -1

lParam	Not used

Return Value

If wParam is -1, the number of the line that contains the first character in the selected text;

If wParam is other than -1, the number of the line which contains the wParam character index.


em_LineIndex message

Description

Returns the character index of the start of a line in an edit control.

Parameters

wParam	The line number; if -1, the line the caret currently is on is used

lParam	Not used

Comments

This message only applies to multiline edit controls.

Return Value

The character index of the start of the line


em_LineLength message

Description

Returns the byte length of a line in an edit control that contains a specified character index.

Parameters

wParam	The index of a character in the edit control or -1

lParam	Not used

Comments

Any selected text, even over multiple lines, is ignored for the purposes of this message and is not included in the line length.

Return Value

If wParam is -1, the length of the line the caret is on;

If wParam is other than -1,the length of the line that contains the wParam character index.


em_LineScroll message

Description

Scrolls an edit control.

Parameters

wParam	Not used

lParamLo	The number of lines to scroll vertically

lParamHi	The number of character positions to scroll horizontally

Comments

This message only applies to multiline edit controls.

Return Value

Not used


em_ReplaceSel message

Description

Replaces an edit control's selected text.

Parameters

wParam	Not used

lParam	Points to null-terminated text to be substituted for the current selected text

Return Value

Not used


em_SetHandle message

Description

Sets an edit control's text buffer.

Parameters

wParam	A local handle to a text buffer for the edit control

lParam	Not used

Comments

The previous text buffer must be retrieved using the em_GetHandle message and then destroyed using the LocalFree function before a new text buffer is installed using this message.

This message only applies to multiline edit controls.

Return Value

Not used


em_SetModify message

Description

Sets an edit control's modify flag.

Parameters

wParam	The new modify flag value

lParam	Not used

Return Value

Not used


em_SetPasswordChar message

Description

Sets the character displayed instead of typed characters typed in an edit control created with the es_Password style.

Parameters

wParam	The new character to display.

0, in which case the actual characters typed are shown.

lParam	Not used

Return Value

Not used


em_SetRect message

Description

Sets the formatting rectangle for an edit control and re-displays the text accordingly.

Parameters

wParam	Not used

lParam	Points to a Rect structure that specifies the new formatting rectangle

Comments

This message only applies to multiline edit controls.

Return Value

Not used


em_SetRectNP message

Description

Sets the formatting rectangle for an edit control without re-displaying the text.

Parameters

wParam	Not used

lParam	Points to a Rect structure that specifies the new formatting rectangle

Comments

Use this message instead of em_SetRect when the text will be repainted later anyway. This message only applies to multiline edit controls.

Return Value

Not used


em_SetSel message

Description

Sets the selected text in an edit control.

Parameters

wParam	Not used

lParamLo	The starting character index

lParamHi	The ending character index

Return Value

Not used


em_SetTabStops message

Description

Sets an edit control's tab stops.

Parameters

wParam	1, the number of tab stops, or 0.

lParam	-	If both wParam and lParamare 0, a tab stop is placed every 32 dialog units.

-	If wParam is 1, a tab stop is placed at each multiple of lParam in dialog units.

-	If wParam is neither 0 nor 1, lParam points at an INT array with at least wParam elements, each of which is greater than the one before and is the dialog unit location for that tab stop.

Comments

The current dialog unit is one-fourth of the current dialog base width unit, which can be obtained by using the GetDialogBaseUnits function. This message only applies to multiline edit controls.

Return Value

Non-zero if all tab stops were set;

0 otherwise.


em_SetWordBreak message

Description

Changes an edit control's word-break function.

Parameters

wParam	Not used

lParam	A procedure instance address of a word-break function; this is created by using the MakeProcInstance function.

The word-break function would be declared like this:

function WordBreakFunction(EditText: PChar; CurrentWord, EditTextCount: Integer): PChar;

WordBreakFunction	Not literal; the function can have a different name and must return a pointer to the character at the start of the next word in the text.

EditText 	Points to the text of an edit control.

CurrentWord	The index of the start of the current word in the text.

If the current word is the last one, it should return a pointer to the character just after the last character in the text.

EditTextCount	The total number of bytes in the text.

Comments

The default Windows edit control word-break function defines the start of the next word to be the first non-blank character after the next series of space characters. This message only applies to multiline edit controls.

Return Value

Not used


em_Undo message

Description

Undoes the last modification of an edit control's text.

Parameters

wParam	Not used

lParam	Not used

Comments

Each change to an edit control's text is stored in an undo buffer. One condition under which this message can fail is when there is not enough memory to create an undo buffer for the undo operation itself.

Return Value

Non-zero if successful;

0 if edit control's text is unchanged;

0 otherwise.


lb_AddString message

Description

Adds a string to a list box.

Parameters

wParam	Not used

lParam	A pointer to a null-terminated string to be added

Comments

If the list box is not sorted, the string is put at the end of the list.

If the list box has one of the lbs_ List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable and does not have the style lbs_HasStrings:

-	lParam is a 32-bit value is stored instead of a string, and

-	each entry added is compared to other entries one or more times via a wm_CompareItem message.

Return Value

The index at which the string was added if successful;

lb_Err if there was an error;

lb_ErrSpace if there wasn't enough memory available to store the string.


lb_DeleteString message

Description

Deletes a string from a list box.

Parameters

wParam	The index of the entry to be deleted

lParam	Not used

Comments

If the list box has one of the lbs_ List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable and does not have the style lbs_HasStrings:

-	the associated 32-bit value is deleted, and

-	a wm_DeleteItem message is sent to the owner of the list box.

Return Value

The number of entries remaining in the list if successful;

lb_Err otherwise.


lb_Dir message

Description

Adds to a list box each file name in the current directory that matches a file specification and DOS file attribute.

Parameters

wParam	The DOS file attribute

lParam	Pointer to a null-terminated file specification string

Return Value

The index of the last entry in the resulting list if successful;

lb_Err if there was an error;

lb_ErrSpace if there wasn't enough memory available to store the entries.


lb_FindString message

Description

Finds the first entry of a list box that matches a prefix string.

Parameters

wParam	The index at which to start the search; the first entry looked at is the one after wParam:

-	If the end of the list is reached, the search will continue with entry 0 until the search index reaches wParam.

-	If  -1, the entire list is searched starting at entry 0.

lParam	A null-terminated prefix string

Comments

If the list box has one of the lbs_ List box styles, lbs_OwnerDrawFixed or lbs_OwnerDrawVariable and does not have the style lbs_HasStrings, lParam is a 32-bit value that is compared to each associated 32-bit value in the list.

Return Value

The index of the first matching entry if successful;

lb_Err otherwise.


lb_GetCount message

Description

Returns the number of entries in a list box.

Parameters

wParam	Not used

lParam	Not used

Return Value

The count of the list box entries.


lb_GetCurSel message

Description

Returns the index of the currently selected entry in a list box.

Parameters

wParam	Not used

lParam	Not used

Return Value

The index of the currently selected entry;

lb_Err if no entry is selected.


lb_GetHorizontalExtent message

Description

Returns the width (in pixels) that a list box can be scrolled horizontally.

Parameters

wParam	Not used

lParam	Not used

Comments

This message only applies to list boxes created with the ws_HScroll style.

Return Value

The number of pixels the list box can be scrolled horizontally.


lb_GetItemData message

Description

Returns the 32-bit value associated with a list box entry.

Parameters

wParam	The entry index

lParam	Not used

Return Value

The 32-bit associated value if successful;

lb_Err otherwise.


lb_GetItemRect message

Description

Retrieves the bounding rectangle of a list box entry as it is displayed.

Parameters

wParam	The entry index

lParam	Points at a Rect structure that is to be filled in with the bounding rectangle values

Return Value

lb_Err if there is an error.


lb_GetSel message

Description

Returns information about whether a list box entry is selected or not.

Parameters

wParam	The entry index

lParam	Not used

Return Value

lb_Err if there is an error;

A positive number if the item is selected;

0 otherwise;


lb_GetSelCount message

Description

Returns the number of entries currently selected in a list box.

Parameters

wParam	Not used

lParam	Not used

Return Value

The number of selected entries if the list box is a Multi-selection list box;

lb_Err otherwise.


lb_GetSelItems message

Description

Retrieves the indexes of entries currently selected in a list box.

Parameters

wParam	The maximum number of entry indexes to retrieve

lParam	Points at an INT array large enough to hold wParam entry indexes

Return Value

The total number of selected entries placed into the lParam array from the indexes of up to wParam selected entries, if the list box is a multi-selection list box;

lb_Err otherwise.


lb_GetText message

Description

Copies a list box entry into a supplied buffer.

Parameters

wParam	The entry index

lParam	A pointer to a buffer; the buffer must have enough space to contain the entry and a terminating null character.

Comments

If the list box has one of the lbs_ List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable and does not have the style lbs_HasStrings, the 32-bit value associated with the list entry is copied into the buffer.

Return Value

Not used


lb_GetTextLen message

Description

Returns the length in bytes of a list box entry.

Parameters

wParam	The entry index

lParam	Not used

Return Value

The length of the entry at that index if wParam is a valid index;

lb_Err otherwise.


lb_GetTopIndex message

Description

Returns the index of the first visible entry in a list box.

Parameters

wParam	Not used

lParam	Not used

Comments

Initially, the first visible entry in a list box is entry 0. If the list box is scrolled, some other entry may be at the top.

Return Value

The index of the first visible entry


lb_InsertString message

Description

Inserts a string into a list box without sorting.

Parameters

wParam	If -1, the string is added to the end of the list;

otherwise wParam is used as the index at which to insert the string.

lParam	Points to a null-terminated string to be inserted

Return Value

The index at which the string was inserted if successful;

lb_Err if there was an error;

lb_ErrSpace if there wasn't enough memory available to store the string.


lb_ResetContent message

Description

Removes all entries from a list box.

Parameters

wParam	Not used

lParam	Not used

Comments

If the combo box has one of the lbs_ List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable and does not have the style lbs_HasStrings, a wm_DeleteItem message is sent to the owner of the list box for each entry.

Return Value

Not used


lb_SelectString message

Description

Selects the first entry of a list box that matches a prefix string.

Parameters

wParam	The index at which to start the search; the first entry looked at is the one after wParam

-	If the end of the list is reached, the search will continue with entry 0 until the search index reaches wParam.

-	If wParam is -1, the entire list is searched starting at entry 0.

lParam	A null-terminated prefix string

Comments

If the list box has one of the lbs_ List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable and does not have the style lbs_HasStrings, lParam is a 32-bit value which is compared to each associated 32-bit value in the list.

Return Value

The index of the first matching entry if successful;

otherwise, lb_Err is returned and the current selection remains unchanged.


lb_SelItemRange message

Description

Selects or deselects consecutive items in a list box.

Parameters

wParam	If 0, the entries are to be deselected;

oherwise, the entries are to be selected

lParamLo	The starting entry index

lParamHi	The ending entry index

Comments

This message only applies to multiple-selection list boxes.

Return Value

lb_Err if there is an error.


lb_SetColumnWidth message

Description

Sets the column width of a list box.

Parameters

wParam	The width in pixels of each column

lParam	Not used

Comments

This message only applies to list boxes with the lbs_MultiColumn style.

Return Value

Not used


lb_SetCurSel message

Description

Selects a list box entry.

Parameters

wParam	The entry index; if -1, there is to be no selection

lParam	Not used

Return Value

The index of the selected entry;

lb_Err if wParam is -1 or not a valid index.


lb_SetHorizontalExtent message

Description

Sets the width in pixels that a list box can be scrolled horizontally.

Parameters

wParam	The number of pixels the list box can be scrolled horizontally

lParam	Not used

Comments

This message only applies to list boxes created with the ws_HScroll style.

The horizontal scroll bar will be enabled or disabled depending on whether the resulting extent is smaller than the width of the list box or not.

Return Value

Not used


lb_SetItemData message

Description

Sets the 32-bit value associated with a list box entry.

Parameters

wParam	The entry index

lParam	The new 32-bit value to be associated with the entry

Return Value

lb_Err if there is an error


lb_SetSel message

Description

Selects or deselects a list box entry.

Parameters

wParam	If 0, the entry is deselected;

oherwise the entry is selected.

lParam	If -1, this message applies to all entries in the list box;

oherwise, lParamLo is used to determine which entry to use.

lParamLo	If lParam is not -1, lParamLo is the entry index.

Comments

This message only applies to multiple-selection list boxes.

Return Value

lb_Err if there is an error.


lb_SetTabStops message

Description

Sets a list box's tab stops.

Parameters

wParam	1, the number of tab stops, or 0

lParam	-	If both wParam and lParam are 0, a tab stop is placed every 2 dialog units.

-	If wParam is 1, a tab stop is placed at each multiple of lParam in dialog units.

-	If wParam is neither 0 nor 1, lParam points at an INT array with at least wParam elements, each of which is greater than the one before and is the dialog unit location for that tab stop.

Comments

The current dialog unit is one-fourth of the current dialog base width unit, which can be obtained by using the GetDialogBaseUnits function.

This message only applies to multiple-selection list boxes.

Return Value

Non-zero if all tab stops were set;

0 otherwise.


lb_SetTopIndex message

Description

Sets the index of the first visible entry in a list box.

Parameters

wParam	The entry index

lParam	Not used

Return Value

lb_Err if there is an error.


wm_Activate message

Description

Notifies a window that it is becoming active or inactive.

Parameters

wParam	If 0, the window is now inactive;

i 1, the window is being activated by something other than a mouse click;

i 2, the window is being activated by a mouse click.

lParamHi	If non-zero, the window is minimized;

therwise, it is 0.

lParamLo	If wParam is 0, the handle to the window being activated;

otherwise, lParamLo is a handle to the window being deactivated.

Comments

If a window is not minimized and is activated, the default action taken in DefWindowProc is to give the window the input focus.

Return Value

Not used


wm_ActivateApp message

Description

Notifies an application that a window in the application is being activated and the previously active window was another application or that a window is being deactivated and the window becoming active is in another application.

Parameters

wParam	If 0, a window in the other application is being activated;

otherwise, a window in the application is being activated.

lParam	The task handle of the other application

Return Value

Not used


wm_AskCBFormatName message

Description

Asks the clipboard owner for the clipboard data format name.

Parameters

wParam	The maximum length of name that can be copied into the lParam buffer

lParam	Points to a buffer into which the format name is to be copied

Comments

These are the messages that will be sent to the clipboard owner when the clipboard format is cf_OwnerDisplay:

wm_AskCBFormatName

wm_HScrollClipboard

wm_PaintClipboard

wm_SizeClipboard

wm_VScrollClipboard

The clipboard data and format are set by using the SetClipboardData function.

Return Value

Not used


wm_CancelMode message

Description

Notifies an application that a message box will be displayed, which cancels any mode the system is in.

Parameters

wParam	Not used

lParam	Not used

Comments

This message warns the application that mouse and keyboard input will be directed toward the message box.

Any processing keeping track of keyboard or mouse button states and/or mouse position may be invalidated when the message box is removed.

Return Value

Not used


wm_ChangeCBChain message

Description

Notifies the first window on the clipboard chain that a window is being removed from the clipboard chain.

Parameters

wParam	A handle to a window that is being removed from the clipboard chain

lParamLo	A handle to the window after the window which is being removed

lParamHi	Not used

Comments

This message must be sent to the next window in the clipboard chain by using the SendMessage function.

The handle of the next window in the clipboard chain is initially the value returned when a window is added to the chain using the SetClipboardViewer function.

Whenever wParam is the same as this saved handle of the next window, the new handle of the next window is lParamLo.

A window must remove itself from the clipboard chain when it receives a wm_Destroy message.

Return Value

Not used

See Also

wm_DrawClipboard


wm_Char, wm_DeadChar, wm_KeyDown, and wm_KeyUp messages# wm_Dea
wm_Char, wm_DeadChar, wm_KeyDown, and wm_KeyUp messages

Description

wm_Char notifies the window with the focus that a non-system key was pressed.

wm_DeadChar notifies a window of a dead character.

wm_KeyDown notifies the window with the focus that a non-system key was pressed.

wm_KeyUp notifies the window with the focus that a non-system key was released.

Parameters

wParam	The key value

lParamLo	The number of times this key-press was repeated because the key was held down

lParamHi	Bits 0-7 are the key's scan code, which is OEM-dependent.

Bit 8 is 1 if the key is an extended key

Bit 13 is 1 if the Alt key was down while the key was pressed

Bit 14 is 1 if the key was down before this message was sent

Bit 15 is 1 if the key is being released, 0 if it is being pressed

Comments

A non-system key is any key pressed while the Alt key is not pressed.

Dead keys include the umlaut character and accents. wm_DeadChar can be used to give feedback for keys pressed that do not necessarily result in a character by themselves.

Due to auto-repeat, more than one wm_KeyDown message may be sent before a wm_KeyUp message is sent.

For wm_KeyDown,	lParamHi bit 13 = 0

lParamHi bit 15 = 0

For wm_KeyUp,	lParamHi bit 13 = 0

lParamHi bit 15 = 1

lParamLo and bits 0-7 of lParamHi are generally all that an application needs.

If no window has the focus, wm_SysKeyDown, wm_SysChar, and wm_SysKeyUp messages are sent instead of wm_KeyDown, wm_Char, and wm_KeyUp messages.

Return Value

Not used

See Also

wm_SysDeadChar


wm_CharToItem message

Description

Asks the owner of a list box what the list box should do in response to a wm_Char message.

Parameters

wParam	The key pressed

lParamLo	A handle to the list box

lParamHi	The current caret position

Comments

This message only applies to list boxes with the lbs_WantKeyboardInput style.

Return Value

-2 if the application handled everything;

-1 if the list box is to perform the default action for that key;

>=0 if the list box is to perform the default action for that key, but on the item specified by the return value.

See Also

wm_VKeyToItem


wm_ChildActivate message

Description

Notifies a parent window that one of its child windows was moved using the SetWindowPos function.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_Clear message

Description

Deletes the current selection in a window.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_Close message

Description

Notifies a window that it is about to be closed

Parameters

wParam	Not used

lParam	Not used

Comments

The default action taken in the DefWindowProc function is to call the DestroyWindow function to destroy the window.

Return Value

Not used


wm_Command message

Description

Notifies a window that a menu item has been selected, an accelerator key has been translated, or a message has been passed to it from a child control.

Parameters

wParam	The menu item, accelerator ID, or control ID

lParamLo	If 0, the message is from a menu and lParamHi is not used;

otherwise, the value of lParamLo depends on lParamHi.

lParamHi	If 1, lParamLo is an accelerator ID;

otherwise, lParamLo is a handle to a child control and lParamHi is a notification code for a message sent to this window by the child control.

Comments

Accelerator keys that map to System menu items translate into wm_SysCommand messages instead of wm_Command messages.

wm_Command is sent for accelerators only if the window is not minimized, or  if the window is minimized and the accelerator does not match any menu items on the window's menu or the System menu.

Return Value

Not used

See Also

bn_ Button Notification Codes

cbn_ Combo box notification codes

en_ Edit Control notification codes

lbn_ List box notification codes


wm_Compacting message

Description

Notifies a top-level window that more than 12.5 percent of system time is being spent compacting memory.

Parameters

wParam	65535 times the percentage of CPU time spent compacting memory (for instance, if wParam is equal to 32768, 50% of CPU time is being spent compacting memory)

lParam	Not used

Comments

When an application receives this message, it should free as much memory as possible. The current use of resources and the total number of running applications should be taken into account.

The GetNumTasks function will return the number applications.

Return Value

Not used


wm_CompareItem message

Description

Asks the owner of an owner-draw combo box or list box to compare two entries and return a value indicating their sort order.

Parameters

wParam	Not used

lParam	Points to a TCompareItemStruct structure; the structure contains the identifier and data for both items

Comments

This message only applies to the following styles:

the cbs_ Combo box styles cbs_Sort,cbs_OwnerDrawFixed, and cbs_OwnerDrawVariable

the lbs_ List box styles lbs_Sort, lbs_OwnerDrawFixed, and lbs_OwnerDrawVariable

Return Value

-1 if entry 1 sorts before entry 2;

0 if entry 1 sorts the same as entry 2;

1 if entry 1 sorts after entry 2.


wm_Copy message

Description

Copies the current selection to the clipboard in cf_Text format.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_Create message

Description

Notifies a window that it has been created and initialization should now be done.

Parameters

wParam	Not used

lParam	Points to a TCreateStruct structure that contains the information passed to the CreateWindow function

Comments

This message is sent to a window during the CreateWindow function call, before the window is opened.

Return Value

Not used


wm_CtlColor message

Description

Gives the parent window of a child control or message box an opportunity to change the text and background colors with which the child will be drawn.

Parameters

wParam	A handle to a display context for the child window

lParamLo	A handle to the child window

lParamHi	Any of the ctlcolor_ constants; it specifies the type of the child window.

Comments

The default action taken in the DefWindowProc function is to use the default system colors.

Return Value

Not used


wm_Cut message

Description

Copies the current selection to the clipboard in cf_Text format and then deletes the current selection.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_dde_Ack message

Description

Notifies the application that it received another DDE message.

Parameters

wParam	The handle of the window that sent the message.

lParamLo	If message is wm_dde_Initiate, holds atom with replying application;

if message is wm_dde_Execute, holds record with status of response;

for all other messages, holds a status record.

lParamHi	If message is wm_dde_Initiate, holds atom containing topic with which replying server window is associated;

if message is wm_dde_Execute, holds handle to the data item containing the command string;

for all other messages, holds an atom specifying the data item for which the response is sent.

Comments

This message must be sent with the SendMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Advise message

Description

Sent by a client application requesting that the receiving application supply an update whenever the data item changes.

Parameters

wParam	The handle of the sending window.

lParamLo	A TDDEAdvise record indicating how to send the data.

lParamHi	An atom specifying the data item requested.

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Data message

Description

Sent by a server application to transmit a data item value or to notify the client that the item is available.

Parameters

wParam	The handle of the sending window.

lParamLo	A handle to the global memory block containing the data,stored in a TDDEData record;

0 if the message is a notification of change.

lParamHi	An atom specifying what data item was sent.

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Execute message

Description

Sent by a client application to transmit a series of commands to be processed by the server application.

Parameters

wParam	The handle of the sending window

lParamLo	Reserved

lParamHi	A handle to a global memory object containing the commands

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Initiate message

Description

Sent by either the client or server to initiate a conversation. Responding applications are expected to send a wm_dde_Ack message.

Parameters

wParam	The handle of the sending window

lParamLo	An atom specifying the name of the application with which a conversation is requested

0 for a conversation with any application

lParamHi	An atom specifying the topic about which the conversation is requested

0 for a conversation about any topic

Comments

This message must be sent with the SendMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Poke message
wm_dde_Poke

Description

Sent by the client application to ask the server application to receive unsolicited data. The server responds with a wm_dde_Ack message.

Parameters

wParam	The handle of the sending window

lParamLo	A handle to a TDDEPoke record

lParamHi	An atom identifying the data item

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Request message

Description

Sent by the client application to request the value of a particular data item.

Parameters

wParam	The handle of the sending window

lParamLo	A clipboard format number

lParamHi	An atom identifying the requested data item

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Terminate message
wm_dde_Terminate

Description

Sent by any application to terminate a conversation.

Parameters

wParam	The handle of the sending window

lParam	Reserved

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_dde_Unadvise message
wm_dde_Unadvise

Description

Sent by a client application to a server application to inform the server that it no longer needs to update a particular item or clipboard format for the item.

Parameters

wParam	The handle of the sending window

lParamLo	A clipboard format number

lParamHi	An atom identifying the data item

Comments

This message must be sent with the PostMessage function.

The first parameter should be the handle of the window to receive the message.

Return Value

Not used


wm_DeleteItem message

Description

Notifies the owner of a list box or combo box that a list box entry has been deleted.

Parameters

wParam	Not used

lParam	Not used

Comments

This message only applies to:

-	Combo boxes with one of the cbs_ Combo box styles cbs_OwnerDrawFixed or cbs_OwnerDrawVariable, and

-	List boxes with one of the lbs_ List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable.

This message is sent when the combo box or list box is destroyed or the entry is deleted by one of the following messages:

lb_DeleteString

lb_ResetContent

cb_DeleteString

cb_ResetContent

Return Value

Not used


wm_Destroy message

Description

Notifies a window that it is going to be destroyed.

Parameters

wParam	Not used

lParam	Not used

Comments

Any window that is on the clipboard chain must remove itself from the clipboard chain by using the ChangeClipboardChain function before it returns from the wm_Destroy message.

This message is sent from the DestroyWindow function after the window is removed from the screen. A window receives this message before any of its child windows are destroyed.

Return Value

Not used


wm_DestroyClipboard message

Description

Notifies a clipboard owner that the clipboard has been emptied by an EmptyClipboard function call.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_DevModeChange message

Description

Notifies each top-level window that the device-mode settings have changed.

Parameters

wParam	Not used

lParam	Points to the device name

Comments

The device name is the string found in the Windows initialization file, WIN.INI.

Return Value

Not used


wm_DrawClipboard message

Description

Notifies the first window on the clipboard chain that the clipboard contents have changed.

Parameters

wParam	Not used

lParam	Not used

Comments

This message must be sent to the next window in the clipboard chain by using the SendMessage function.

The handle of the next window in the clipboard chain is initially the value returned when a window is added to the chain by the SetClipboardViewer function. New values for this handle are sent via wm_ChangeCBChain messages.

A window must remove itself from the clipboard chain when it receives a wm_Destroy message.

Return Value

Not used


wm_DrawItem message

Description

Informs an owner-draw button, combo box, list box, or menu that it must be redrawn.

Parameters

wParam	Not used

lParam	Points to a TDrawItemStruct structure that contains information on the item and the drawing operation to be done

Comments

All objects selected for the display context found in the TDrawItemStruct structure must be restored before returning from this message.

Return Value

Not used


wm_Enable message

Description

Notifies a window when it is enabled or disabled.

Parameters

wParam	If 0, the window has been disabled;

Otherwise, it has been enabled

lParam	Not used

Return Value

Not used


wm_EndSession message

Description

Tells an application that has responded non-zero to a wm_QueryEndSession message if the session is being ended or not.

Parameters

wParam	If 0, the session is not being ended;

otherwise, the session is being ended

lParam	Not used

Comments

If wParam is not 0, an application should perform all tasks required for termination before returning from this message, since Windows might terminate any time after all applications have returned from handling this message.

The application does not need to call the either the DestroyWindow or PostQuitMessage function as when handling a wm_Destroy message.

Return Value

Not used


wm_EnterIdle message

Description

Notifies a main window that the system is idle due to displaying a modal dialog or a menu.

Parameters

wParam	If the system is idle because a dialog box is being displayed, wParam will be msgf_DialogBox;

if the system is idle because a menu is being displayed, wParam will be msgf_Menu.

lParamLo	A handle to the dialog box or menu when wParam is msgf_DialogBox or msgf_Menu respectively.

lParamHi	Not used

Comments

The system becomes idle when a modal dialog box or displayed menu has no messages queued after processing at least one previous message. The default value returned by DefWindowProc is 0.

Return Value

Not used

See Also

msgf_ Enter idle constants


wm_EraseBkgnd message

Description

Notifies a window that its background must be erased to prepare for painting an invalidated region.

Parameters

wParam	A handle to the device-context

lParam	Not used

Comments

The default action taken in the DefWindowProc function is to erase the background using the class background brush from the class structure.

If the class background brush is 0, the application should

-	align the origin of the brush to be used with the window by calling the UnrealizeObject function for the brush.

-	select the brush.

-	erase the background using the brush.

Windows assumes the mm_Text mapping mode. If the device context uses a different mapping mode, the area erased might extend outside the visible portion of the client area.

Return Value

Non-zero if an application handles this message and erases the window background;

0 otherwise


wm_FontChange message

Description

Notifies a top-level window that the pool of font resources has changed.

Parameters

wParam	Not used

lParam	Not used

Comments

Any application that adds or removes fonts from the system should send this message to every top-level window by using the SendMessage function.

The AddFontResource function is used to add fonts to the system.

The RemoveFontResource function is used to remove them.

Return Value

Not used


wm_GetDlgCode message

Description

Allows an application to override the handling of direction keys and the Tab key in a control.

Parameters

wParam	Not used

lParam	Not used

Comments

The default value returned by DefWindowProc is 0.

The window functions for the predefined control classes may return a code which is not 0.

This message and non-default return values from it are useful only with user-defined dialog controls or subclassed standard controls.

Return Value

dlgc_ constants bit-or'ed together, depending on which inputs the application wants to process


wm_GetFont message

Description

Returns a dialog box's current font.

Parameters

wParam	Not used

lParam	Not used

Return Value

0 if the dialog box is using the system font;

otherise, a handle to the font being used.

See Also

wm_SetFont


wm_GetMinMaxInfo message

Description

Allows a window to change its default maximized size, its default maximized position, or its default minimum and maximum tracking sizes.

Parameters

wParam	Not used

lParam	lParam points at an array of 5 POINT structures

lParam[0] is used internally by Windows.

lParam[1] is the maximized size.

lParam[2] is the position of the upper-left corner of the window when it is maximized.

lParam[3] is the minimum tracking size of the window.

lParam[4] is the maximum tracking size of the window.

Comments

The tracking sizes are the minimum and maximum sizes allowed when resizing the window.

This message gives the application an opportunity to change the default sizes before Windows uses them.

Return Value

Elements 1 to 4 of the lParam array may be modified as desired.


wm_GetText message

Description

Copies a window's associated text into a supplied buffer.

Parameters

wParam	The maximum number of bytes that may be copied into the lParam buffer

lParam	A pointer to a buffer; the buffer must be at least wParam bytes long

Comments

Edit controls	The text is the contents of the edit control.

Button controls	The text is the button name.

List boxes	The text is the currently selected item, if any.

Combo boxes	The text is the contents of the combo box's edit control.

All other windows	The text is the window caption.

Return Value

cb_Err if the window is a combo box that has no edit control;

lb_Err if the window is a list box and no item is selected;

The number of bytes copied including a null terminating character.

See Also

wm_GetTextLength

wm_SetText


wm_GetTextLength message

Description

Returns the length, in bytes, of a window's associated text.

Parameters

wParam	Not used

lParam	Not used

Comments

Edit controls	The text is the contents of the edit control.

Button controls	The text is the button name.

List boxes	The text is the currently selected item, if any.

Combo boxes	The text is the contents of the combo box's edit control.

All other windows	The text is the window caption.

Return Value

The length of the associated text, not including a 0 terminating character

See Also

wm_GetText


wm_HScroll message

Description

Notifies a window that a horizontal scroll bar has been clicked.

Parameters

wParam	A scroll-bar code which describes the effect of the scroll-bar click; it may be any of the sb_ constants that apply to horizontal scroll-bar controls.

lParamLo	Not used

lParamHi	The handle of the scroll-bar control; lParamHi will be 0 if the scroll-bar control is a control created with the window by using the ws_HScroll style.

Comments

If an application scrolls the text in a window, it must also use the SetScrollPos function to reset the scroll-bar's thumb position.

Return Value

Not used

See Also

sb_ Scroll bar commands


wm_HScrollClipboard message

Description

Notifies the owner of a clipboard with the cf_OwnerDisplay format that the horizontal scroll-bar in the clipboard application has been clicked.

Parameters

Param	A handle to the clipboard application window

lParamLo	A scroll-bar code which describes the effect of the scroll-bar click; it may be any of the sb_ constants that apply to horizontal scroll-bar controls.

lParamHi	Not used

Comments

The clipboard owner must repaint the clipboard application window or use the InvalidateRect function.

The clipboard application window scroll-bar position must be reset using the SetScrollPos function.

These messages will be sent to the clipboard owner when the clipboard format is cf_OwnerDisplay:

wm_AskCBFormatName

wm_HScrollClipboard

wm_PaintClipboard

wm_SizeClipboard

wm_VScrollClipboard

The clipboard data and format are set by using the SetClipboardData function.

Return Value

Not used

See Also

sb_ Scroll bar commands


wm_IconEraseBkgnd message

Description

Notifies a minimized window that its background must be filled to prepare for painting the icon.

Parameters

wParam	The device-context of the icon

lParam	Not used

Comments

This message only applies to minimized (iconic) windows that have a class icon defined for them. Other windows receive the wm_EraseBkgnd message instead.

The default action taken in the DefWindowProc function is to fill the icon background using the background brush of the parent window.

Return Value

Not used


wm_InitDialog message

Description

Notifies an application that a dialog box is about to be displayed and should be initialized.

Parameters

wParam	The ID of the first control in the dialog box that can have the input focus

lParam	The InitParam value passed to the function that created the dialog. These are the functions that have this parameter:

CreateDialogIndirectParam	CreateDialogParam

DialogBoxIndirectParam	DialogBoxParam

lParam is 0 if the dialog was created using one of these functions:

CreateDialog	CreateDialogIndirect

DialogBox	DialogBoxIndirect

Comments

This message allows an application to initialize a dialog and set the input focus to any control in the dialog just before the dialog is displayed.

If the return value is 0, Windows will set the input focus to the control identified by wParam. wParam will usually be the ID of the first item in the dialog box with the ws_TabStop style.

An example of other initialization best done at this time is to set the dialog control's font using the wm_SetFont message.

Return Value

Non-zero if the application does not set the input focus to one of the dialog's controls;

0 if the application sets the input focus to one of the dialog's controls.


wm_InitMenu message

Description

Notifies an application that a menu is about to be displayed.

Parameters

wParam	A handle to the menu

lParam	Not used

Comments

This message is sent when the mouse is clicked on the menu bar or a menu key is pressed. It gives the application the opportunity to change the state of any menu items before the menu is displayed.

Return Value

Not used


wm_InitMenuPopup message

Description

Notifies an application that a pop-up menu is about to be displayed.

wParam	A handle to the pop-up menu

Parameters

lParamLo	The index of the pop-up menu in the main menu

lParamHi	Non-zero if the pop-up menu is the system menu;

otherwise, it is 0.

Comments

This message gives the application the opportunity to change the state of any menu items before the pop-up menu is displayed.

Return Value

Not used


wm_KillFocus message

Description

Notifies a window that it is about to lose the focus.

Parameters

wParam	The handle of the window that will be receiving the focus

lParam	Not used

Comments

Any displayed caret should be destroyed at this time. wParam may be 0.

Return Value

Not used


wm_LButtonDblClk, wm_MButtonDblClk, and wm_RButtonDblClk messag
wm_LButtonDblClk, wm_MButtonDblClk, and wm_RButtonDblClk messages

Description

wm_ LButtonDblClk notifies a window that the left mouse button was double-clicked.

wm_ MButtonDblClk notifies a window that the middle mouse button was double-clicked.

wm_ RButtonDblClk notifies a window that the right mouse button was double-clicked.

Parameters

wParam	A value that indicates which virtual keys are down; it is a combination of the mk_ constants

lParamLo	The x-coordinate of the mouse cursor

lParamHi	The y-coordinate of the mouse cursor

Comments

This message only applies to windows created with the cs_DblClks style.

The mouse coordinates are relative to the upper left corner of the window.

A double-click is actually two single-clicks within the system's double-click time limit.

A double click results in:

a down-click message,

an up-click message,

a double-click message, and

a second up-click message.

Return Value

Not used

See Also

wm_ messages


wm_LButtonDown message
wm_LButtonDown, wm_LButtonUp,  wm_MButtonDown, wm_MButtonUp,  wm_RButtonDown, wm_RButtonUp, and wm_MouseMove messages

Description

wm_LButtonDown notifies a window that the left mouse button was clicked.

wm_LButtonUp notifies a window that the left mouse button was released.

wm_MButtonDown notifies a window that the middle mouse button was clicked.

wm_MButtonUp notifies a window that the middle mouse button was released.

wm_RButtonDown notifies a window that the right mouse button was clicked.

wm_RButtonUp notifies a window that the right mouse button was released.

wm_MouseMove notifies a window that the mouse has moved while over the window's client area.

Parameters

wParam	A value that indicates which virtual keys are down; it is a combination of the mk_ constants

lParamLo	The x-coordinate of the mouse cursor

lParamHi	The y-coordinate of the mouse cursor

Comments

The mouse coordinates are relative to the upper left corner of the window.

Return Value

Not used

See Also

wm_ messages


wm_MDIActivate message

Description

Tells an multiple document interface (MDI) client window to activate a different MDI child window.

This message is then passed to the MDI child windows being deactivated and activated.

Parameters

wParam	The MDI client window does not use wParam.

For an MDI child window, if wParam is 0, the window is being deactivated;

Otherwise, the window is being activated

lParamLo	A handle to the MDI child window to be activated

lParamHi	A handle to the MDI child window to be deactivated

Comments

When an MDI client window receives this message, it must send a wm_MDIActivate message with the appropriate wParam parameter to both the MDI child window being deactivated and the MDI child window being activated.

When an MDI frame window becomes active, the MDI child window that last received a wm_MDIActivate message with a non-zero wParam receives a wm_NCActivate message but does not receive another wm_MDIActivate message.

If the MDI child window being deactivated is maximized, it will be restored and the MDI child window being activated will be maximized.

Return Value

Not used


wm_MDICascade and wm_MDITile messages

Description

wm_MDICascade arranges a multiple document interface (MDI) client window's MDI child windows in a cascade format.

wm_MDITile arranges a multiple document interface (MDI) client window's MDI child windows in a tiled format.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_MDICreate message

Description

Creates a multiple document interface (MDI) child window for an MDI client window.

Parameters

wParam	Not used

lParam	Points at a TMDICreateStruct structure

Comments

An MDI child window will be created with the following styles, along with any additional styles found in the lParam TMDICreateStruct structure:

ws_Child	ws_ClipSiblings

ws_ClipChildren	ws_SysMenu

ws_Caption	ws_ThickFrame

ws_MinimizeBox	ws_MaximizeBox

The title of the MDI child window is added to the window menu of the MDI frame window. All child windows of the client window should be created using this message.

When an MDI child window is created, the wm_Create message is sent to it. This wm_Create message has an lParam parameter pointing at a TCreateStruct structure.

This TCreateStruct, in turn, has a field that points at the TMDICreateStruct structure sent to the wm_MDICreate message that created the MDI child window.

This message is not re-entrant; for instance, a wm_MDICreate message should not be sent while an MDI child window is handling its wm_Create message.

Return Value

The ID of the new MDI child window in the low-order word;

0 in the high-order word.

See Also

ws_Window Styles


wm_MDIDestroy message

Description

Asks a multiple document interface (MDI) client window to close an MDI child window.

Parameters

wParam	A handle to the MDI child window

lParam	Not used

Comments

The title of the MDI child window is removed from the frame window and the MDI child window is deactivated.

All MDI child windows should be closed with this message.

Return Value

Not used


wm_MDIGetActive message

Description

Returns the active multiple document interface (MDI) child window and information about whether or not it is maximized.

Parameters

wParam	Not used

lParam	Not used

Return Value

The handle to the active MDI child window in the low-order word;

1 if the maximized MDI child window is the high-order word;

0 otherwise.


wm_MDIIconArrange message

Description

Arranges a multiple document interface (MDI) client window's minimized MDI child windows.

Parameters

wParam	Not used

lParam	Not used

Comments

MDI child windows that are not in iconic form are not affected.

Return Value

Not used


wm_MDIMaximize message

Description

Asks a multiple document interface (MDI) client window to maximize an MDI child window.

Parameters

wParam	The MDI child window ID

lParam	Not used

Comments

When an MDI child window is maximized,

-	the child window's client fills the MDI client window's client area,

-	the maximized MDI child window's system menu is placed in the MDI frame window's menu bar, and

-	the MDI child window's title is added to the MDI frame window's title.

Return Value

Not used


wm_MDINext message

Description

Activates the next multiple document interface (MDI) child window.

Parameters

wParam	Not used

lParam	Not used

Comments

The next MDI child window is the one immediately behind the currently active MDI child window.

The currently active MDI child window is placed behind all other MDI child windows.

Return Value

Not used


wm_MDIRestore message

Description

Restores a maximized or minimized multiple document interface (MDI) child window.

Parameters

wParam	The MDI child window's ID

lParam	Not used

Return Value

Not used


wm_MDISetMenu message

Description

Replaces the menu and/or the Window pop-up menu of a multiple document interface (MDI) frame window.

Parameters

wParam	Not used

lParamLo	A handle to a new MDI frame window menu, or 0

lParamHi	A handle to a new Window pop-up menu, or 0

Comments

If either lParamLo or lParamHi are 0, the corresponding menu is not changed.

An application must use the DrawMenuBar function to update the menu bar after sending this message.

MDI child-window menu items from the old Window pop-up menu are removed and placed in the new Window pop-up menu.

The System menu and restore controls for a maximized MDI child window are removed from the old MDI frame window menu and added to the new MDI frame window menu.

Return Value

The handle of the old MDI frame window menu.


wm_MeasureItem message

Description

Asks the owner of an owner-draw button, combo box, list box, or menu for that control's dimensions.

Parameters

wParam	Not used

lParam	Points to a TMeasureItemStruct structure

Comments

This message only applies to owner-draw menu items and the following:

-	Buttons with the bs_OwnerDraw style

-	Combo boxes with one of the cbs_ Combo Box Styles, cbs_OwnerDrawFixed or cbs_OwnerDrawVariable

-	List boxes with one of the lbs_List box styles lbs_OwnerDrawFixed or lbs_OwnerDrawVariable

This message is sent to a control's owner when the control is created.

The TMeasureItemStruct structure pointed to by lParam must be filled in with the correct values for the control.

For list boxes with the lbs_OwnerDrawVariable style and combo boxes with the cbs_OwnerDrawVariable style, this message is sent once for each item; otherwise, this message is sent once for each control or menu item.

If a dialog owns a combo box with the cbs_OwnerDrawFixed style or a list box with the lbs_OwnerDrawFixed style, it will receive the wm_MeasureItem message before the wm_InitDialog message.

Return Value

Not used


wm_MenuChar message

Description

Notifies the owner of the current menu that an undefined menu mnemonic character has been pressed.

Parameters

wParam	The ASCII value of the character

lParamLo	mf_Popup if menu is a popup menu; mf_SysMenu if it is a system menu

lParamHi	A handle to the current menu

Comments

Application that use accelerators to select bitmaps placed in a menu should handle this message.

Return Value

If the high-order word is 0, Windows will discard the character and send a beep to the speaker.

If the high-order word is 1, Windows will close the current menu.

If the high-order word is 2, Windows will select the menu item that is in the low-order word.


wm_MenuSelect message

Description

Notifies the owner of a menu that a menu item has been selected.

Parameters

wParam	The menu item ID or the handle of a pop-up menu

lParamLo	If either -1 or a combination of the following mf_Menu flags:

mf_Bitmap	mf_Checked

mf_Disabled	mf_Grayed

mf_MouseSelect	mf_OwnerDraw

mf_Popup	mf_SysMenu

lParamHi	If the menu is the system menu or lParam is -1 and lParamHi is 0;

otherwise, lParamHi is a handle to the menu.

Comments

If lParamLo is -1 and lParamHi is 0, the menu has been closed because the mouse was clicked outside the menu or the Esc key was pressed.

Return Value

Not used


wm_MouseActivate message

Description

Notifies an inactive window that the mouse was clicked over it.

Parameters

wParam	A handle to the topmost parent of the window

lParamLo	One of the ht constants; these are the same values returned by the wm_NCHitTest message.

lParamHi	The mouse message number

Comments

No other return values are legal.

Each window may pass this message to DefWindowProc, which passes it to the window's parent window.

If the return value is non-zero at any point, this process stops and the window is not activated.

Return Value

ma_Activate if the first window that received this message will be activated;

ma_NoActivate if the first window that received this message will not be activated;

ma_ActivateAndEat if the first window that received this message will be activated and the mouse event will be discarded.

See Also

ma_ Mouse activation codes


wm_Move message

Description

Notifies a window that it has been moved.

Parameters

wParam	Not used

lParamLo	The new x-coordinate of the upper-left corner of the window's client area

lParamHi	The new y-coordinate of the upper-left corner of the window's client area

Comments

For pop-up and overlapped windows, the new coordinates are screen relative.

For child windows, the new coordinates are relative to the parent window's client area.

Return Value

Not used


wm_NCActivate message

Description

Notifies a window that its caption bar or icon needs to change to show an active or inactive state.

Parameters

wParam	If 0, the window is being inactivated;

otherwise, it is being activated

lParam	Not used

Comments

The default action taken in DefWindowProc is to draw a gray caption for an inactive window or a black caption for an active window.

At this point, no distinction is made between active and inactive icons.

Return Value

Not used


wm_NCCalcSize message

Description

Asks a window for the size of the windows client area.

Parameters

wParam	Not used

lParam	Points to a Rect structure that contains the screen coordinates of the window

Comments

The area specified in lParam includes the client area, borders, caption, and scroll bars.

The default action taken in DefWindowProc is to calculate the size of the client area. The calculation takes any borders, caption, and scroll bars into account.

The resulting size of the client area is placed in the lParam Rect structure.

Return Value

Not used


wm_NCCreate message

Description

Notifies an application that a window is just beginning to be created.

Parameters

wParam	A handle to the window being created

lParam	Points at the window's TCreateStruct structure

Comments

If this message returns 0, the CreateWindow function (or other function used to create a window) will also return 0.

The default action taken by DefWindowProc is to initialize the window's scroll bars, set the window text, and allocate memory for internal data structures.

Return Value

Non-zero if the window is successfully created;

0 if the window is not successfully created.


wm_NCDestroy message

Description

Notifies a window that its non-client area is being destroyed.

Parameters

wParam	Not used

lParam	Not used

Comments

This message is sent by the DestroyWindow function after it sends the wm_Destroy message.

The default action taken by DefWindowProc is to free any memory associated with the window.

Return Value

Not used


wm_NCHitTest message

Description

Notifies the window receiving the mouse input that the mouse has moved.

Parameters

wParam	Not used

lParamLo	The x-coordinate of the mouse cursor

lParamHi	The y-coordinate of the mouse cursor

Comments

The mouse coordinates are relative to the upper left corner of the screen.

Normally, the window that contains the mouse cursor receives all mouse input, but this can be overridden by using the GetCapture function.

Return Value

ht constants if this message is passed to DefWindowProc

See Also

wm_ messages


wm_NCLButtonDblClk, wm_NCMButtonDblClk, and wm_NCRButtonDblClk
wm_NCLButtonDblClk, wm_NCMButtonDblClk, and wm_NCRButtonDblClk messages

Description

wm_NCLButtonDblClk notifies a window that the left mouse button was double-clicked in a non-client area.

wm_NCLButtonDblClk notifies a window that the middle mouse button was double-clicked in a non-client area.

wm_NCLButtonDblClk notifies a window that the right mouse button was double-clicked in a non-client area.

Parameters

wParam	One of the ht constants; these are the same values returned by the wm_NCHitTest message

lParamLo	The x-coordinate of the mouse cursor

lParamHi	The y-coordinate of the mouse cursor

Comments

The mouse coordinates are relative to the upper left corner of the screen. A double-click is actually two single-clicks within the system's double-click time limit.

 A double click results in:

a down-click message,

an up-click message,

a double-click message, and

a second up-click message.

The default action taken by DefWindowProc includes sending appropriate wm_SysCommand messages depending on the non-client area involved.

Return Value

Not used

See Also

wm_ messages


wm_NCLButton messages
wm_NCLButtonDown, wm_NCLButtonUp, wm_NCMButtonDown, wm_NCMButtonUp, wm_NCRButtonDown, wm_NCLButtonUp, and wm_NCMouseMove messages

Description

wm_NCLButtonDown notifies a window that the left mouse button was clicked in a non-client area.

wm_NCLButtonUp notifies a window that the left mouse button was released in a non-client area.

wm_NCMButtonDown notifies a window that the middle mouse button was clicked in a non-client area.

wm_NCMButtonUp notifies a window that the middle mouse button was released in a non-client area.

wm_NCRButtonDown notifies a window that the right mouse button was clicked in a non-client area.

wm_NCRButtonUp notifies a window that the right mouse button was released in a non-client area.

wm_NCLMouseMove notifies a window that the mouse has moved in a non-client area.

Parameters

wParam	One of the ht constants; these are the same values returned by the wm_NCHitTest message

lParamLo	The x-coordinate of the mouse cursor

lParamHi	The y-coordinate of the mouse cursor

Comments

The mouse coordinates are relative to the upper left corner of the screen. The default action taken by DefWindowProc includes sending appropriate wm_SysCommand messages depending on the non-client area involved.

Return Value

Not used

See Also

wm_ messages


wm_NCPaint message

Description

Notifies a window that its frame needs to be painted.

Parameters

wParam	Not used

lParam	Not used

Comments

An application can respond to this message by painting its own custom window frame or passing it to DefWindowProc, which paints a standard window frame.

The clipping region for a custom frame will always be rectangular even if the frame is not.

Return Value

Not used


wm_NextDlgCtl message

Description

Changes a dialog box's control focus.

Parameters

wParam	If non-zero, wParam is a handle to the control that is to receive the control focus;

if 0, the next control with tab-stop style receives the focus;

if lParam is non-zero the previous control with tab-stop style receives the focus.

lParam	If 0, wParam determines which direction to look for the next control with tab-stop style;

otherwise, wParam is a handle to the control which is to receive the control focus.

Comments

Unlike the SetFocus function, this message alters the border around the default control.

The PostMessage function should be used to send this message instead of the SendMessage function, unless your application does not concurrently handle any other messages that set the control focus.

Return Value

Not used


wm_Paint message

Description

Notifies a window that it needs to repaint all or part of its client area.

Parameters

wParam	Not used

lParam	Not used

Comments

This message is sent when the UpdateWindow function is called or when the DispatchMessage function encounters a wm_Paint message.

Return Value

Not used

See Also

BeginPaint

EndPaint


wm_PaintClipboard message

Description

Asks the clipboard owner to display all or part of the clipboard contents.

Parameters

wParam	A handle to the clipboard application window

lParamLo	A handle to memory containing a TPaintStruct structure that defines the part of the clipboard application window's client are to be painted

lParamHi	Not used

Comments

The handle to the TPaintStruct data must be locked using the GlobalLock function before using it and unlocked using the GlobalUnlock function before returning from this message or yielding control.

The drawing dimensions found in the TPaintStruct should be compared to the dimensions received in the last wm_SizeClipboard message.

These messages will be sent to the clipboard owner when the clipboard format is cf_OwnerDisplay:

wm_AskCBFormatName

wm_HScrollClipboard

wm_PaintClipboard

wm_SizeClipboard

wm_VScrollClipboard

The clipboard data and format are set by using the SetClipboardData function.

Return Value

Not used


wm_PaintIcon message

Description

Tells a minimized window that has a class icon that it must paint its icon.

Parameters

wParam	Not used

lParam	Not used

Comments

The wm_Paint message is sent instead if there is no class icon defined for the window.

The default action taken by DefWindowProc is to paint the window's icon with the class icon.

Return Value

Not used


wm_PaletteChanged message

Description

Notifies all windows that the system palette has changed.

Parameters

wParam	The handle of the window that changed the system palette

lParam	Not used

Comments

This message is sent when the window with input focus realizes its logical palette and changes the system palette.

Windows other than the one with its handle in wParam may realize their palettes and update their client areas in response to this message.

Return Value

Not used


wm_ParentNotify message

Description

Notifies all ancestor windows of a child window when that child window is created, destroyed, or clicked over with the mouse.

Parameters

wParam	Depending on the reason this message was sent,wParam is one of the following:

wm_Create

wm_Destroy

wm_LButtonDown

wm_MButtonDown

wm_RButtonDown

lParamLo	If wParam is wm_Create or wm_Destroy, lParamLo is the handle to the child window;

otherwise, lParamLo is the x-coordinate of the mouse cursor.

lParamHi	If wParam is wm_Create or wm_Destroy, lParamHi is the ID of the child window;

otherwise, lParamHi is the y-coordinate of the mouse cursor.

Comments

This message is sent just before the CreateWindow or CreateWindowEx function that creates the child window returns and before any action is taken to destroy the child window.

This message is sent to all ancestor windows of the child window.

This message is not sent if the child window is created with the ws_ex_NoParentNotify extended window style.

Child windows in a dialog box have the ws_ex_NoParentNotify extended window style, unless the child window is created using the CreateWindowEx function with the appropriate parameters.

Return Value

Not used


wm_Paste message

Description

Copies the contents of the clipboard into a window at the current cursor position.

Parameters

wParam	Not used

lParam	Not used

Comments

If the contents of the clipboard are not in cf_Text format, no action is taken.

Return Value

Not used


wm_QueryDragIcon message

Description

Asks a minimized window that has no icon defined for its class whether it should use the default icon cursor to drag the icon or substitute a different one.

Parameters

wParam	Not used

lParam	Not used

Comments

If a cursor handle is returned, it must be a monochrome cursor compatible with the display driver's resolution.

The LoadCursor function may be used to load a cursor from the executable resources.

Return Value

0 if Windows will use the default icon cursor;

the cursor handle if the low-order word if Windows does not use the default icon cursor.


wm_QueryEndSession message

Description

Asks each application wether or not the session should end.

Parameters

wParam	Not used

lParam	Not used

Comments

This message is sent to each application until all have returned non-zero values or one returns 0.

If one application returns 0,

-	the session will not be ended, and

-	all applications that have already been sent this message and returned a non-zero value are sent a wm_EndSession message with wParam equal to 0.

The default action taken by DefWindowProc is to return a non-zero value.

Return Value

Non-zero if the application can shut down;

0 otherwise.


wm_QueryNewPalette message

Description

Asks a window whether or not it will realize its logical palette when it receives the input focus.

Parameters

wParam	Not used

lParam	Not used

Return Value

Non-zero if the window realizes its logical palette when it receives the input focus;

0 otherwise.


wm_QueryOpen message

Description

Asks an application whether it can be opened from an icon into a window.

Parameters

wParam	Not used

lParam	Not used

Comments

The default action taken in DefWindowProc is to return a non-zero value.

Return Value

Non-zero if the application will be opened;

0 if the application will not be opened.


wm_Quit message

Description

Tells an application to terminate execution.

Parameters

wParam	The exit code passed to Windows in the PostQuitMessage function call

lParam	Not used

Comments

After this message is sent, calls to the GetMessage function will return 0.

The exit code in wParam must be saved and used as the exit code for the program.

Return Value

Not used


wm_RenderAllFormats message

Description

Asks the clipboard owner to render the clipboard data in all formats it knows.

Parameters

wParam	Not used

lParam	Not used

Comments

This message is sent to the application of the clipboard owner when the application is to be destroyed.

Each format should be formatted and the handle to the formatted data should be sent to the clipboard using the SetClipboardData function.

Return Value

Not used

See Also

wm_RenderFormat


wm_RenderFormat message

Description

Asks the clipboard owner to send a handle to data in the requested format to the clipboard.

Parameters

wParam	The requested data format for the SetClipboardData function

lParam	Not used

Comments

The data should be formatted as requested.

The handle to the formatted data must be sent to the clipboard using the SetClipboardData function.

Return Value

Not used

See Also

wm_RenderAllFormats


wm_SetCursor message

Description

Notifies a parent window that the cursor has moved.

Parameters

wParam	A handle to the window that contains the cursor

lParamLo	One of the ht constants; these are the same values returned by the wm_NCHitTest message.

lParamHi	The mouse message number

Comments

The default action taken by DefWindowProc is to set the cursor to an arrow when in a non-client area or to the registered-class cursor when in the client area.

This message allows a parent window to alter the cursor depending on which child window or area of the client area the cursor is over. This message is not sent if mouse input is captured using the SetCapture function.

The message must be passed on to DefWindowProc with the original or altered parameters. If DefWindowProc is given this message and lParamLo is htError and lParamHi is a mouse button-down message number, the MessageBeep function is called.

lParamHi is 0 when the window enters menu mode.

Return Value

0 if the DefWindowProc continues with its default action;

no further action otherwise.


wm_SetFocus message

Description

Notifies a window that it has received the input focus.

Parameters

wParam	A handle to the window that just lost the input focus

lParam	Not used

Comments

Appropriate caret functions for displaying a caret should be called at this time, if a caret is to be shown.

Return Value

Not used


wm_SetFont message

Description

Sets the font used by a dialog box, or notifies a dialog box that its controls are about to be created and fonts may be selected for them.

Parameters

wParam	A handle to the font to use;

0 if the control is to use the system font.

lParam	If 0, the control will not be redrawn;

otherwise, the control will be redrawn.

Comments

A font must be deleted using the DeleteObject function when the font is no longer needed (for instance, after the dialog box is destroyed).

The size of the dialog box should be changed before the font is changed.

This message is sent to dialog boxes with the ds_SetFont style before the dialog box's controls are created.

Another good time to send this message is when the wm_InitDialog message is received.

Return Value

Not used


wm_SetRedraw message

Description

Sets or clears a window's redraw flag.

Parameters

wParam	The new redraw flag; if 0, redrawing is disabled; otherwise, redrawing is enabled

lParam	Not used

Return Value

Not used


wm_SetText message

Description

Sets a window's associated text.

Parameters

wParam	Not used

lParam	A pointer to a null-terminated string that is to be the associated text

Comments

Edit controls	The text is the contents of the edit control.

Button controls	The text is the button name.

List boxes	The text is the currently selected item, if any.

Combo boxes	The text is the contents of the combo box's edit control.

All other windows	The text is the window caption.

The current selection in a combo box is not changed by this message, only the contents of the combo box's edit control.

cb_SelectString should be used to select an entry in the combo box's list box which matches the text in the combo box's edit control.

Return Value

cb_Err	If the window is a combo box which has no edit control

cb_ErrSpace	If there is not enough space available to set the associated text for combo boxes

lb_Err	If the window is a list box and no item is selected

lb_ErrSpace	If there is not enough space available to set the associated text for list boxes

See Also

wm_GetText


wm_ShowWindow message

Description

Notifies a window that it is about to be shown or hidden.

Parameters

wParam	If 0, the window is being hidden;

otherwise, the window is being shown.

lParam	If this message is sent because of a ShowWindow function call, lParam is 0;

if the window's parent is closing or a pop-up window is being hidden, lParam is sw_ParentClosing.

if the window's parent is opening or a pop-up window is being shown, lParam is sw_ParentOpening.

Comments

A window is hidden or shown when the ShowWindow function is called, when an overlapped window is maximized or restored, or when an overlapped or pop-up window is closed or opened.

All pop-up windows associated with an overlapped window are hidden when the overlapped window is closed.

The default action taken by DefWindowProc is to show or hide the window as specified.

Return Value

Not used

See Also

sw_Show Window Message Constants


wm_Size message

Description

Notifies a window that its size has changed.

Parameters

wParam	One of the Size constants

lParamLo	The new width of the client area of the window

lParamHi	The new height of the client area of the window

Comments

If the SetScrollPos or MoveWindow function is used when handling this message, the Redraw parameter (for SetScrollPos) or the Repaint parameter (for MoveWindow) should be non-zero so the window will be repainted.

Return Value

Not used


wm_SizeClipboard message

Description

Notifies the clipboard owner that the clipboard application window has changed size.

Parameters

wParam	A handle to the clipboard application window

lParamLo	A Rect structure specifying the area of the clipboard application window to paint

lParamHi	Not used

Comments

If wParam is 0 [the Rect is (0,0,0,0)], the clipboard application is about to be destroyed or minimized and the clipboard owner may free any display resources.

The TPaintStruct structure used to paint the clipboard application window must be locked in place using the GlobalLock function and unlocked using the GlobalUnlock function before returning from this message.

The Rect in lParamLo should be copied for use by the next wm_PaintClipboard message.

These messages will be sent to the clipboard owner when the clipboard format is cf_OwnerDisplay:

wm_AskCBFormatName

wm_HScrollClipboard

wm_PaintClipboard

wm_SizeClipboard

wm_VScrollClipboard

The format of the clipboard is set when the clipboard data is set via the SetClipboardData function.

Return Value

Not used


wm_SpoolerStatus message

Description

Notifies an application that a job has been added to or removed from the Print Manager queue.

Parameters

wParam	Sets sp_JobStatus

lParamLo	The number of jobs currently in the Print Manager queue

lParamHi	Not used

Comments

This message is informational only. It is sent by the Print Manager application.

Return Value

Not used


wm_SysChar, wm_SysDeadChar, wm_KeyDown, and wm_KeyUp messages
wm_SysChar, wm_SysDeadChar, wm_SysKeyDown, and wm_SysKeyUp messages

Description

wm_SysChar notifies the window with the focus that a system key was pressed, or notifies the active window that a key was pressed when no window has the input focus.

wm_SysDeadChar notifies a window of a dead system character.

wm_SysKeyDown notifies the window with the focus that a system key was pressed when no window has the input focus.

wm_SysKeyUp notifies the window with the focus that a system key was released, or notifies the active window that a key was released when no window has the focus.

Parameters

wParam	The key value

lParamLo	The number of times this key-press was repeated because the key is being held down

lParamHi	Bits 0-7 of lParamHi is the key's scan code, which is OEM-dependent

Bit 8 is 1 if the key is an extended key

Bit 13 is 1 if the Alt key was down while the key was pressed

Bit 14 is 1 if the key was down before this message was sent

Bit 15 is 1 if the key is being released, 0 if it is being pressed

(wm_SysDeadChar only: lParamHi contains the number of times this keypress has been repeated because the key is being held down.)

Comments

For wm_SysChar, wm_SysKeyDown, and wm_SysKeyUp, bit 13 of lParam will be

1 if a system key was pressed, or 0 if no window has the input focus.

For wm_SysChar and wm_SysKeyDown, lParamHi bit 15 will be 0.

For wm_SysKeyUp, lParamHi bit 15 will be 1.

If bit 13 of lParam is 0, this message may be passed to the TranslateAccelerator function so that accelerators can be used in the active window even if it does not have the input focus.

If no window has the focus, wm_SysKeyDown, wm_SysChar, and wm_SysKeyUp messages are sent instead of wm_KeyDown, wm_Char, and wm_KeyUp messages.

Dead keys include the umlaut character and accents.

A dead system key is a dead key in combination with the Alt key.

wn_SysDeadChar can be used to give feedback for keys pressed that do not necessarily relult in a character by themselves.

Due to auto-repeat, more than one wm_SysKeyDown message may be sent before a wm_SysKeyUp message is sent.

Return Value

Not used

See Also

wm_DeadChar


wm_SysColorChange message

Description

Notifies a top-level window that the system color settings have changed.

Parameters

wParam	Not used

lParam	Not used

Comments

A wm_Paint message is sent to any window affected by a system color change.

Applications should delete any brushes that use existing system colors and recreate them using the new system colors.

Return Value

Not used


wm_SysCommand message

Description

Notifies a window that a System menu item, the minimize box, or the maximize box has been selected.

Parameters

wParam	The system command request; it can be any of the sc_ constants

The bottom 4 bits of wParam are used internally by Windows; they should be set to 0 before wParam is used

lParamLo	The x-coordinate of the mouse, or 0 if the mouse was not used

lParamHi	The y-coordinate of the mouse, or 0 if the mouse was not used

Comments

Accelerator keys that map to System-menu items translate into wm_SysCommand message instead of wm_Command messages.

wm_Command is sent for accelerators only if

1.	the window is not minimized, or

2.	the window is minimized and the accelerator does not match any menu items on the window's menu or the System-menu.

System-menu items may be modified using the following functions:

GetSystemMenu

AppendMenu

InsertMenu

ModifyMenu

An application must handle all modified System-menu entry selections.

All messages an application does not handle must be passed to DefWindowProc.

wm_SysCommand messages can be sent to DefWindowProc any time an application needs to carry out a System-menu command.

Return Value

Not used


wm_TimeChange message

Description

Notifies a top-level window that the system time has been changed.

Parameters

wParam	Not used

lParam	Not used

Comments

After an application makes changes to the system time, it must send this message to all top-level windows by using the SendMessage function.

Return Value

Not used


wm_Timer message

Description

Notifies an application that a timer's time limit is elapsed.

Parameters

wParam	The timer ID

lParam	Used only when the timer function passed to the SetTimer function when the timer was created was not 0.

The message is not put in the message queue, but passed directly to the timer function.

Return Value

Not used


wm_Undo message

Description

Undoes the last operation on an edit control.

Parameters

wParam	Not used

lParam	Not used

Return Value

Not used


wm_VKeyToItem message

Description

Asks the owner of a list box what the list box should do in response to a wm_KeyDown message.

Parameters

wParam	The key pressed

lParamLo	A handle to the list box

lParamHi	The current caret position

Comments

This message only applies to list boxes with the lbs_WantKeyboardInput style.

Return Value

-2 if the application handled everything

-1 if the list box is to perform the default action for that key

>=0 if the list box is to perform the default action for that key, but on the item specified by the return value

See Also

wm_CharToItem


wm_VScroll message

Description

Notifies a window that a vertical scroll bar has been clicked.

Parameters

wParam	A scroll-bar code which describes the effect of the scroll-bar click; it may be any of the sb_ constants that apply to vertical scroll-bar controls

lParamLo	Not used

lParamHi	The handle of the scroll-bar control; lParamHi will be 0 if the scroll-bar control is a control created with the window by using the ws_VScroll style

Comments

If an application scrolls the text in a window, it must also use the SetScrollPos function to reset the scroll-bar's thumb position.

Return Value

Not used

See Also

sb_ Scroll bar commands


wm_VScrollClipboard message

Description

Notifies the owner of a clipboard with the cf_OwnerDisplay format that the vertical scroll-bar in the clipboard application has been clicked.

Parameters

wParam	A handle to the clipboard application window

lParamLo	A scroll-bar code which describes the effect of the scroll-bar click; it may be any of the sb_ constants that apply to vertical scroll-bar controls

lParamHi	Not used

Comments

The clipboard owner must repaint the clipboard application window or use the InvalidateRect function.

The clipboard application window scroll-bar position must be reset using the SetScrollPos function.

These messages will be sent to the clipboard owner when the clipboard format is cf_OwnerDisplay:

wm_AskCBFormatName

wm_HScrollClipboard

wm_PaintClipboard

wm_SizeClipboard

wm_VScrollClipboard

The clipboard data and format are set by using the SetClipboardData function.

Return Value

Not used

See Also

sb_ Scroll bar commands


wm_wininichange message

Description

Notifies a top-level window that the Windows initialization file, WIN.INI, has changed.

Parameters

wParam	Not used

lParam	Points to a section name string

Comments

Any time an application changes the Windows initialization file it should send this message to all top-level windows using the SendMessage function. lParam must not be nil.

Return Value

Not used


System Unit

The System unit (SYSTEM.TPU) is the Turbo Pascal run-time library.

It implements low-level, run-time support routines for all built-in features, such as file I/O, string-handling, floating point, and dynamic memory allocation.

All units and programs automatically use the System unit, so you never need to refer to it in a uses clause.

Procedures and Functions

Variables and Typed Constants


Index of System Procedures and Functions

This index is an alphabetical listing of all the procedures and functions in the System unit (SYSTEM.TPU).

You can also look up these procedures and functions in a categorical index, where they are listed by categories of what they do.

Abs	Func	Returns the absolute value of the argument.

Addr	Func	Returns the address of a specified object.

Append	Proc	Opens an existing file for appending.

ArcTan	Func	Returns the arctangent of the argument.

Assign	Proc	Assigns the name of an external file to a file variable.

BlockRead	Proc	Reads one or more records into a variable.

BlockWrite	Proc	Writes one or more records from a variable.

Chr	Func	Returns a character with a specified ordinal number.

Close	Proc	Closes an open file.

Concat	Func	Concatenates a sequence of strings.

Copy	Func	Returns a substring of a string.

Cos	Func	Returns the cosine of the argument (x is an angle, in radians).

CSeg	Func	Returns the current value of the CS register.

Dec	Proc	Closes an open file.

Delete	Proc	Deletes a substring from a string.

Dispose	Proc	Disposes a dynamic variable.

DSeg	Func	Returns the current value of the DS register.

Eof	Func	Returns the end-of-file status.

Eoln	Func	Returns the end-of-line status of a text file.

Erase	Proc	Erases an external file.

Exit	Proc	Exits immediately from the current block.

Exp	Func	Returns the exponential of the argument.

FilePos	Func	Returns the current file position of a file.

FileSize	Func	Returns the current size of a file.

FillChar	Proc	Fills a specified number (count) of contiguous bytes with a specified value (can be type Byte or Char).

Flush	Proc	Flushes the buffer of a text file open for output.

Frac	Func	Returns the fractional part of the argument.

FreeMem	Proc	Disposes a dynamic variable of a given size.

GetDir	Proc	Returns the current directory of specified drive.

GetMem	Proc	Creates a dynamic variableof the specified size and puts the address of the block in a pointer variable.

Halt	Proc	Stops program execution and returns to the operating system.

Hi	Func	Returns the high-order byte of the argument.

Inc	Proc	Increments a variable.

Insert	Proc	Inserts a substring into a string.

Int	Func	Returns the Integer part of the argument.

IOResult	Func	Returns the status of the last I/O operation performed.

Length	Func	Returns the dynamic length of a string.

Ln	Func	Returns the natural logarithm of the argument.

Lo	Func	Returns the low-order Byte of the argument.

MaxAvail	Func	Returns the size of the largest contiguous free block in the heap.

MemAvail	Func	Returns the amount of all free memory in the heap.

MkDir	Proc	Creates a subdirectory.

Move	Proc	Copies bytes from source to dest.

New	Proc	Creates a new dynamic variable and sets a pointer variable to point to it.

Odd	Func	Tests if the argument is an odd number.

Ofs	Func	Tests if the argument is an odd number.

Ord	Func	Returns the ordinal number of an ordinal-type value.

ParamCount	Func	Returns the number of parameters passed to the program on the command line.

ParamStr	Func	Returns a specified command-line parameter.

Pi	Func	Returns the value of Pi.

Pos	Func	Searches for a substring in a string.

Pred	Func	Returns the predecessor of the argument.

Ptr	Func	Converts a segment base and an offset address to a pointer-type value.

Random	Func	Returns a random number.

Randomize	Proc	Initializes the built-in random number generator with a random value (obtained from the system clock).

Read	Proc	For typed files, reads a file component into a variable. For text files, reads one or more values into one or more variables

Readln	Proc	Executes the Read procedure, then skips to the next line of the file.

Rename	Proc	Renames an external file.

Rename	Proc	Renames an external file.

Reset	Proc	Opens an existing file.

Rewrite	Proc	Creates and opens a new file.

Round	Func	Rounds a real-type value to an Integer-type value.

RunError	Proc	Stops program execution.

ScrollTo	Proc	Scrolls the CRT window to show virtual screen location

Seek	Proc	Moves the current position of a file to a specified component.

SeekEof	Func	Returns the end-of-file status of a file.

SeekEoln	Func	Returns the end-of-line status of a file.

Seg	Func	Returns the segment of a specified object.

SetTextBuf	Proc	Assigns an I/O buffer to a text file.

Sin	Func	Returns the sine of the argument.

SizeOf	Func	Returns the number of bytes occupied by the argument.

SPtr	Func	Retruns the current value of the SP register.

Sqr	Func	Returns the square of the argument.

Sqrt	Func	Returns the square root of the argument.

SSeg	Func	Returns the current value of the SS register.

Str	Proc	Converts a numeric value to a string.

Succ	Func	Returns the successor of the argument.

Swap	Func	Swaps the high- and low-order bytes of the argument.

Trunc	Func	Truncates a real-type value to an Integer-type value.

Truncate	Proc	Truncates the file at the current file position.

UpCase	Func	Converts a character to uppercase.

Val	Proc	Converts a string value to its numeric representation.

Write	Proc	For typed files, writes a variable into a file component. For text files, writes one or more values to the file

Writeln	Proc	Executes the Write procedure, then outputs an end-of-line marker to the file.


Index of System Procedures and Functions (categorical)

Arithmetic functions

Abs (function)

ArcTan (function)

Cos (function)

Exp (function)

Frac (function)

Int (function)

Ln (function)

Pi (function)

Sin (function)

Sqr (function)

Sqrt (function)

Dynamic allocation procedures and functions

Dispose (procedure)

FreeMem (procedure)

GetMem (procedure)

New (procedure)

MaxAvail (function)

MemAvail (function)

Flow-control procedures

Exit (procedure)

Halt (procedure)

RunError (procedure)

I/O procedures and functions

Assign (procedure)

ChDir (procedure)

Close (procedure)

Eof (function)

Erase (procedure)

FilePos (function)

FileSize (function)

GetDir (procedure)

IOResult (function)

MkDir (procedure)

Rename (procedure)

Reset (procedure)

Rewrite (procedure)

RmDir (procedure)

Seek (procedure)

Truncate (procedure)

Miscellaneous procedures and functions

FillChar (procedure)

Hi (function)

Lo (function)

Move (procedure)

ParamCount (function)

ParamStr (function)

Random (function)

Randomize (procedure)

SizeOf (function)

Swap (function)

UpCase (function)

Ordinal procedures and functions

Dec (procedure)

Inc (procedure)

Odd (function)

Pred (function)

Succ (function)

Pointer and address functions

Addr (function)

CSeg (function)

DSeg (function)

Ofs (function)

Ptr (function)

Seg (function)

SPtr (function)

SSeg (function)

String procedures and functions

Concat (function)

Copy (function)

Delete (procedure)

Insert (procedure)

Length (function)

Pos (function)

Str (procedure)

Val (procedure)

Text-file procedures and functions

Append (procedure)

Eoln (function)

Flush (procedure)

Read (procedure)

Readln (procedure)

SeekEof (function)

SeekEoln (function)

SetTextBuf (procedure)

Write (procedure)

Writeln (procedure)

Transfer functions

Chr (function)

Ord (function)

Round (function)

Trunc (function)

Untyped-file procedures

BlockRead (procedure)

BlockWrite (procedure)


System Unit Variables and Typed Constants

Variables (uninitialized)

Variable	Type	Description

Input	Text      	Input standard file

Output	Text      	Output standard file

Constants (initialized variables)

Initial

Variable	Type	Value	Description

CmdLine	PChar	    nil	Command line pointer

CmdShow	Integer	       0	CmdShow parameter for CreateWindow

ErrorAddr	Pointer	    nil	Run-time error address

ExitCode	Integer	       0	Exit code

ExitProc	Pointer	    nil	Exit procedure

FileMode	Byte	       2	File open mode

HeapBlock	Word	8192	Heap block size

HeapError	Word	    nil	Heap error function

HeapLimit	Word	1024	Heap small block limit

HeapList	Word	       0	Heap segment list

HInstance	Word	       0	Handle of this instance

HPrevInst	Word	       0	Handle of previous instance

InOutRes	Integer	       0	I/O result buffer

PrefixSeg	Word	       0	Program segment prefix (PSP)

RandSeed	LongInt	       0	Random seed


Input and Output (variables)
Input and Output (variables)     (System unit)

Input and Output are the standard I/O files required by every Pascal implementation.


CmdLine (variable)
CmdLine (variable)     (System unit)

In a program, CmdLine contains a pointer to a null-terminated string that contains the command-line arguments specified when the application was started.

In a library, CmdLine is undefined.


CmdShow (variable)
CmdShow (variable)     (System unit)

In a program, CmdShow contains the parameter value that Windows expects to be passed to ShowWindow when the application creates its main window.

In a library, CmdShow is always 0.


ErrorAddr, ExitCode, and ExitProc (variables)
ErrorAddr, ExitCode, and ExitProc (variables)     (System unit)

ExitProc, ExitCode, and ErrorAddr variables are used to implement exit procedures.

The ExitProc pointer variable allows you to install an exit procedure.The exit procedure always gets called as a part of a program's termination.

An exit procedure takes no parameters and must be compiled with a far procedure directive to force it to use the far call model.

When implemented properly, an exit procedure actually becomes part of a chain of exit procedures.The procedures on the exit chain get executed in reverse order of installation.

To keep the exit chain intact, you must save the current contents of ExitProc before changing it to the address of your own exit procedure.

The first statement in your exit procedure must reinstall the saved value of ExitProc.

An exit procedure may learn the cause of termination by examining the ExitCode integer variable and the ErrorAddr pointer variable.

 -	In case of normal termination, ExitCode is 0 and ErrorAddr is nil.

 -	In case of termination through a call to Halt, ExitCode contains the value passed to Halt and ErrorAddr is nil.

 -	In case of termination due to a run-time error, ExitCode contains the error code and ErrorAddr contains the address of the statement in error.

The last exit procedure (the one installed by the run-time library) closes the Input and Output files. If ErrorAddr is not nil, it outputs a run-time error message.

Once the run-time library has called all exit procedures, it returns to Windows, passing as a return code the value stored in ExitCode.


FileMode (variable)
FileMode (variable)     (System unit)

The FileMode variable determines the access code to pass to DOS when typed and untyped files (not text files) are opened using the Reset procedure.

The default FileMode is 2. Assigning another value to FileMode causes all subsequent Resets to use that mode.

The range of valid FileMode values depends on the version of DOS in use. For all versions, these modes are defined:

0	Read only

1	Write only

2	Read/Write

DOS version 3.x and higher defines additional modes, which are primarily concerned with file-sharing on networks.

(For more details,see your DOS programmer's reference manual.)


HeapBlock, HeapError, HeapLimit, and HeapList (variables)
HeapBlock, HeapError, HeapLimit, and HeapList (variables)     (System unit)

The heap manager uses HeapList, HeapLimit, HeapBlock, and HeapError to implement Turbo Pascal's dynamic memory allocation routines.

The HeapLimit variable defines the threshold between "small" and "large" heap blocks. The HeapBlock variable defines the size the heap manager uses when allocation blocks to the assigned to the sub-allocator.

You should have no reason to change the values of HeapLimit and HeapBlock, but should you decide to do so, make sure that HeapBlock is at least 4 times the size of HeapLimit.

You use the HeapError variables to install a heap error function,which gets called whenever the heap manager cannot complete an allocation request.

HeapError is a pointer that points to a function with this header:

   function HeapFunc (Size: Word): Integer; far;

The heap error function is installed by assigning its address to the HeapError variable:

   HeapError := @@HeapFunc;

The heap error function gets called whenever a call to New or GetMem cannot complete the request.

The Size parameter contains the size of the block that could not be allocated, and the heap error function should attempt to free a block of a least that size.

Before calling the heap error function, the heap manager attempts to allocate the block within its sub-allocation free space as well as through a direct call to the Windows GlobalAlloc function.

The HeapError function returns:

0	to indicate failure and causes a run-time error to occur immediately.

1	to indicate failure and causes New or GetMem to return a nil pointer.

2	to indicate success and causes a retry (which could also cause another call to the heap error function).


HInstance and HPrevInst (variables)
HInstance and HPrevInst (variables)     (System unit)

HInstance contains the instance handle of the application or library as provided by the Windows environment.

In a program, HPrevInst contains the handle of the previous instance of the application, or 0 if there are no previous instances.

In a library, HPrevInst is always 0.


InOutRes(variable)
InOutRes (variable)     (System unit)

The built-in I/O routines use InOutRes to store the value that the next call to the IOResult standard function will return.


PrefixSeg (variable)
PrefixSeg (variable)     (System unit)

In a program, the PrefixSeg variable contains the selector (segment address) of the Program Segment Prefix (PSP) created by DOS and Windows when the application was executed.

In a library, PrefixSeg is always 0.

For a complete description of the PSP, refer to your DOS and Windows manuals.


RandSeed(variable)
RandSeed (variable)     (System unit)

RandSeed stores the built-in random number generator's seed.

By assigning a specific value to RandSeed, the Random function can be made to generate a specific sequence of random numbers over and over.

This is useful for applications that deal with data encryption, statistics, and simulations.


Strings Unit

The Strings Unit provides support for a new class of character strings called null-terminated strings.

With Turbo Pascal's extended syntax and the Strings unit, your programs can use null-terminated strings, the format required by the Windows Application Programming Interface (API).

Strings Unit Functions

StrCat	Func	Appends a copy of one string to the end of another and returns the concatenated string.

StrComp	Func	Compares two strings.

StrCopy	Func	Copies one string to another.

StrDispose	Func	Disposes of a previously allocated string.

StrECopy	Func	Copies one string to another and returns a pointer to the end of the resulting string.

StrEnd	Func	Returns a pointer to the end of a string.

StrIComp	Func	Compares two strings without case sensitivity.

StrLCat	Func	Appends characters from a string to the end of another and returns the concatenated string.

StrLComp	Func	Copies characters from one string to another.

StrLCopy	Func	Compares two strings, up to a maximum length.

StrLen	Func	Returns the number of characters in Str.

StrLIComp	Func	Compares two strings, up to a maximum length, without case sensitivity.

StrLower	Func	Converts a string to lower case.

StrMove	Func	Copies characters from one string to another.

StrNew	Func	Allocates a string on the heap.

StrPas	Func	Converts a null-terminated string to a Pascal-style string.

StrPCopy	Func	Copies a Pascal-style string to a null-terminated string.

StrPos	Func	Returns a pointer to the first occurrence of a string in another string.

StrRScan	Func	Returns a pointer to the first occurrence of a string in another string.

StrScan	Func	Returns a pointer to the first occurrence of a character in a string.

StrUpper	Func	Converts a string to upper case.


Null-terminated Strings

What is a null-terminated string?

A null-terminated string consists of:

-	a sequence of non-null characters followed by a NULL (#0) character.

-	an upper limit 65535 characters.

Using null-terminated strings

Null-terminated strings are stored as arrays of characters with a zero-based integer index type; like:

array[0..X] of Char

where X   =	a positive non-zero integer.

This is called a zero-based character array.

The Extended Syntax compiler directive ($X ) must be enabled when you use the Strings unit in your program.


WinCrt Unit

The WinCrt unit implements a terminal-like text screen in a window. You don't need to write "Windows-specific" code if your program uses WinCrt.

To use the WinCrt unit, simply include it in your program's uses clause, just as you would any other unit.

Procedures and functions

Variables


WinCrt Variables

The WinCrt unit declares several typed constants (which have initial values) and one variable.

WindowOrg 	(TPoint)

WindowSize 	(TPoint)

ScreenSize 	(TPoint)

Cursor 	(TPoint)

Origin 	(TPoint)

InactiveTitle 	(PChar)

AutoTracking 	(Boolean)

CheckEOF 	(Boolean)

CheckBreak 	(Boolean)

WindowTitle 	(array [0..79] of Char)

You can regard the typed constants as variables, because you can change the initial values of most of them to suit your needs.


WinCrt Procedures and Functions

AssignCrt	Proc	Associates a text file with the CRT window.

ClrEol	Proc	Clears all the characters from the cursor position to the end of the line.

ClrScr	Proc	Clears the screen and returns cursor to upper left-hand corner.

CursorTo	Proc	Moves the cursor to the given coordinates within the virtual screen.

DoneWinCrt	Proc	Destroys the CRT window.

GotoXY	Proc	Moves the cursor to the given coordinates within the virtual screen.

InitWinCrt	Proc	Creates the CRT window.

KeyPressed	Func	Returns True if a key has been pressed on the keyboard.

ReadBuf	Func	Inputs a line from the CRT window.

ReadKey	Func	Reads a character from the keyboard.

ScrollTo	Proc	Scrolls the CRT window to show a screen location.

TrackCursor	Proc	Scrolls the CRT window to keep cursor visible.

WhereX	Func	Returns the X coordinate of the current cursor location.

WhereY	Func	Returns the Y coordinate of the current cursor location.

WriteBuf	Proc	Writes a block of characters to the CRT window.

WriteChar	Proc	Writes a single character to the CRT window.


WindowOrg (variable)
WindowOrg (variable)     (WinCrt unit)

Determines the initial location of the CRT window.

const WindowOrg: TPoint = (X: cw_UseDefault; Y: cw_UseDefault);

The default location allows Windows to select a suitable location for the CRT window.

You can change the initial location by assigning new values to the X and Y coordinates before the CRT window is created.


WindowSize (variable)
WindowSize (variable)     (WinCrt unit)

Determines the initial size of the CRT window.

const WindowSize: TPoint = (X: cw_UseDefault; Y: cw_UseDefault);

The default size allows Windows to select a suitable size for the CRT window.

You can change the initial size by assigning new values to the X and Y coordinates before the CRT window is created.


ScreenSize (variable)
ScreenSize (variable)     (WinCrt unit)

Determines the width and height in characters of the virtual screen within the CRT window.

const ScreenSize: TPoint = (X: 80; Y: 25);

The default screen size is 80 columns by 25 lines.

You can change the size of the virtual screen by assigning other values to the X and Y coordinates of ScreenSize before the CRT window is created.

The value given by ScreenSize.X multiplied by ScreenSize.Y must not exceed 65,520.


Cursor (variable)
Cursor (variable)     (WinCrt unit)

Contains the current position of the cursor within the virtual screen.

const Cursor: TPoint = (X: 0; Y: 0);

The upper left corner corresponds to (0, 0). Cursor is a read-only variable; do not assign values to it.


Origin (variable)
Origin (variable)     (WinCrt unit)

Contains the virtual screen coordinates of the character cell displayed in the upper-left corner of the CRT window.

const Origin: TPoint = (X: 0; Y: 0);

Origin is a read-only variable; do not assign values to it.


InactiveTitle (variable)
InactiveTitle (variable)     (WinCrt unit)

Points to a null-terminated string to use when constructing the title of an inactive CRT window.

const InactiveTitle: PChar = '(Inactive %s)';

The string is used as the format-control parameter of a call to the Windows WVSPrintF function. The %s specifier, if present, indicates where to insert the existing window title.


AutoTracking (variable)
AutoTracking (variable)     (WinCrt unit)

Enables and disables the automatic scrolling of the window to keep the cursor visible.

const AutoTracking: Boolean = True;

When AutoTracking is True, the CRT window automatically scrolls to ensure that the cursor is visible after each Write and Writeln.

If AutoTracking is False, the CRT window will not scroll automatically and text written to the window may not be visible to the user.


CheckEOF (variable)
CheckEOF (variable)     (WinCrt unit)

Enables and disables the end-of-file character.

const CheckEOF: Boolean = False;

When CheckEOF is True, an end-of-file marker is generated when the user presses Ctrl+Z while reading from a file assigned to the CRT window.

When CheckEOF is False, pressing Ctrl+Z has no effect.


CheckBreak (variable)
CheckBreak (variable)     (WinCrt unit)

Enables and disables user termination of an application.

const CheckBreak: Boolean = True;

When CheckBreak is True, the user can terminate the application at any time by:

-	choosing the Close command on the CRT window's Control menu, or

-	double-clicking the window's Control-menu box, or

-	pressing Alt+F4

The user can also press Ctrl+C or Ctrl+Break at any time to halt the application and force the CRT window into its inactive state.

All of these features are disabled when CheckBreak is False.


WindowTitle (variable)
WindowTitle (variable)     (WinCrt unit)

Determines the title of the CRT window.

var WindowTitle: array[0..79] of Char;

The default value is the full path of the program's .EXE file.

You can change the title by storing a new string in WindowTitle before the CRT window is created.

Here is an example:

StrCopy(WindowTitle, 'Hello World');


WinDos Unit

The WinDos unit implements operating system and file-handling routines.

None of the routines in the WinDos unit are defined by standard Pascal.

Constants

Procedures and functions

Types

Variables


Index of WinDos Procedures and Functions (alphabetical)

This index is an alphabetical listing of the procedures and functions in the WinDos unit.

To look up WinDos routines by functional category, see the categorical index of WinDos procedures and functions.

CreateDir	Proc	Creates a new subdirectory.

DiskFree	Func	Returns the number of free bytes of the specified disk drive

DiskSize	Func	Returns the total size, in bytes, of specified disk drive

DosVersion	Func	Returns the DOS version number

FileExpand	Func	Expands a file name into a fully qualified file name

FindFirst	Proc	Searches the specified directory for the matching file

FindNext	Proc	Searches for another FindFirst file

FileSearch	Func	Searches for a file

FileSplit	Func	Splits a file name into its three components

GetArgCount	Func	Returns the number of parameters passed to the program on the command line

GetArgStr	Func	Returns the command-line parameter specified by Index

GetCBreak	Proc	Returns the state of Ctrl-Break checking in DOS

GetCurDir	Func	Returns the current directory of a specified drive

GetDate	Proc	Returns the current date set in the operating system

GetEnvVar	Func	Returns a pointer to the value of a specified environment variable

GetFAttr	Proc	Returns the attributes of a file

GetFTime	Proc	Returns the date and time a file was last written

GetIntVec	Proc	Returns the address stored in a specified interrupt vector

GetTime	Proc	Returns the current time set in the operating system

GetVerify	Proc	Returns the state of the verify flag in DOS

Intr	Proc	Executes a specified software interrupt

MsDos	Proc	Executes a DOS function call

PackTime	Proc	Converts a TDateTime record

RemoveDir	Proc	Removes an empty subdirectory

SetCBreak	Proc	Sets the state of Ctrl-Break checking in DOS

SetCurDir	Proc	Changes the current directory to the specified path

SetDate	Proc	Sets the current date in the operating system

SetFAttr	Proc	Sets the attributes of a file

SetFTime	Proc	Sets the date and time a file was last written

SetIntVec	Proc	Sets a specified interrupt vector to a specified address

SetTime	Proc	Sets the current time in the operating system

SetVerify	Proc	Sets the state of the verify flag in DOS

UnpackTime	Proc	Converts a Longint to a record


WinDos Constants

Flag constants

File-mode constants

File-attribute constants

File-name component string lengths

FileSplit return flags


WinDos Types

File record types

TRegisters

TDateTime

TSearchRec


WinDos Variable
WinDos Variables

DosError


Index of WinDos Procedures and Functions (categorical)

This index is a functional (categorical) listing of the procedures and functions in the WinDos unit.

To look up an individual WinDos routine by name rather than by category, see the alphabetical index of WinDos procedures and functions.

Date and Time procedures

GetDate (procedure)

GetFTime (procedure)

GetTime (procedure)

PackTime (procedure)

SetDate (procedure)

SetFTime (procedure)

SetTime (procedure)

UnpackTime (procedure)

Directory handling procedures and functions

CreateDir (procedure)

GetCurDir (function)

RemoveDir (procedure)

SetCurDir (procedure)

Disk status functions

DiskFree (function)

DiskSize (function)

Environment handling functions

GetArgCount (function)

GetArgStr (function)

GetEnvVar (function)

File-handling procedures and functions

FileExpand (function)

FileSearch (function)

FileSplit (function)

FindFirst (procedure)

FindNext (procedure)

GetFAttr (procedure)

SetFAttr (procedure)

Interrupt support procedures

GetIntVec (procedure)

Intr (procedure)

MsDos (procedure)

SetIntVec (procedure)

Miscellaneous procedures and functions

DosVersion (function)

GetCBreak (procedure)

GetVerify (procedure)

SetCBreak (procedure)

SetVerify (procedure)


Flag constants
Flag constants     (WinDos unit)

The Flag constants test individual flag bits in the Flags register after a call to Intr or MsDos.

Constant	Value

fCarry	$0001

fParity	$0004

fAuxiliary	$0010

fZero	$0040

fSign	$0080

fOverflow	$0800


File-mode constants
File-mode constants     (WinDos unit)

File-handling procedures use fmXXXX constants when opening and closing disk files.

The mode fields of Turbo Pascal's variables will contain one of these values:

Constant	Value

fmClosed	$D7B0

fmInput	$D7B1

fmOutput	$D7B2

fmInOut	$D7B3


File-attribute constants
File-attribute constants     (WinDos unit)

The faXXXX constants test, set, and clear file-attribute bits in connection with the GetFAttr, SetFAttr, FindFirst, and FindNext procedures.

The faXXXX constants are additive. The faAnyFile constant is the sum of all attributes.

Constant	Value

faReadOnly	$01

faHidden	$02

faSysFile	$04

faVolumeID	$08

faDirectory	$10

faArchive	$20

faAnyFile	$3F


File-name component string lengths constants
File-name component string length constants     (WinDos unit)

The fsXXXX constants are the maximum file-name component string lengths used by the FileSearch and FileExpand functions.

Constant	Value

fsPathName	79

fsDirectory	67

fsFileName	8

fsExtension	4


Return flags for FileSplit
FileSplit return flag constants     (WinDos unit)

The fcXXXX constants are used by the FileSplit function.

The returned value is a combination of the fcDirectory, fcFileName, and the fcExtension bit masks. The value indicates which components were present in the path.

If the name or extension contains any wildcard characters (* or ?), the fcWildcards flag is set.

Constant	Value

fcExtension	$0001

fcFileName	$0002

fcDirectory	$0004

fcWildcards	$0008


File record types
File record (type)     (WinDos unit)

The record definitions used internally by Turbo Pascal are also declared in the WinDos unit.

TFileRec is used for both typed and untyped files.

TTextRec is the internal format of a variable of type text.

type

{ Typed and untyped files }

  TFileRec = record

    Handle: Word;

    Mode: Word;

    RecSize: Word;

    Private: array[1..26] of Byte;

    UserData: array[1..16] of Byte;

    Name: array[0..79] of Char;

  end;

{ Textfile record }

  PTextBuf = ^TTextBuf;

  TTextBuf = array[0..127] of Char;

  TTextRec = record

    Handle: Word;

    Mode: Word;

    BufSize: Word;

    Private: Word;

    BufPos: Word;

    BufEnd: Word;

    BufPtr: ^TTextBuf;

    OpenFunc: Pointer;

    InOutFunc: Pointer;

    FlushFunc: Pointer;

    CloseFunc: Pointer;

    UserData: array[1..16] of Byte;

    Name: array[0..79] of Char;

    Buffer: TTextBuf;

  end;


TRegisters type
TRegisters (type)     (WinDos unit)

The Intr and MsDos procedures use variables of type TRegisters to specify the input register contents and examine the output register contents of a software interrupt.

type

  TRegisters = record

    case Integer of

    0: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Word);

    1: (AL,AH,BL,BH,CL,CH,DL,DH: Byte);

  end;

Notice the use of a variant record to map the 8-bit registers on top of their 16-bit equivalents.


TDateTime type
TDateTime (type)     (WinDos unit)

Variables of TDateTime type are used in connection with the UnpackTime and PackTime procedures to examine and construct 4-byte, packed date-and-time values for the GetFTime, SetFTime, FindFirst, and FindNext procedures.

type

  TDateTime = record

    Year,Month,Day,Hour,Min,Sec: Word;

  end;

Valid ranges are:

Year 	1980..2099

Month 	1..12

Day 	1..31

Hour 	0..23

Min 	0..59

Sec 	0..59


TSearchRec type
TSearchRec (type)     (WinDos unit)

The FindFirst and FindNext procedures use variables of type TSearchRec to scan directories.

type

  TSearchRec = record

    Fill: array[1..21] of Byte;

    Attr: Byte;

    Time: Longint;

    Size: Longint;

    Name: array[0..12] of Char;

  end;

The information for each file found by one of these procedures is reported back in a TSearchRec.

-	Attr contains the file's attributes (constructed from file attribute constants)

-	Time contains its packed date and time (use UnpackTime to unpack)

-	Size contains its size in bytes

-	Name contains its name

-	Fill is reserved by DOS and should never be modified


DosError variable
DosError (variable)     (WinDos unit)

DosError is used by many of the routines in the WinDos unit to report errors.

var DosError: Integer;

The values stored in DosError are DOS error codes.

A value of 0 indicates no error; other possible error codes are as follows:

Code	Meaning

    2	File not found

    3	Path not found

    5	Access denied

    6	Invalid handle

    8	Not enough memory

  10	Invalid environment

  11	Invalid format

  18	No more files


WObjects unit

All the elements of ObjectWindows are declared in the WObjects unit:

The WObjects unit is required in every ObjectWindows application.

Constants

Objects

Procedures and functions

Records

Types

Variables

To find out about a particular object's fields and methods, go to the Help screen for that object.

See Also

WinTypes unit

WinProcs unit


ObjectWindows Constants

bf_XXXX constants

cm_XXXX constants

coXXXX constants

em_XXXX constants

id_XXXX constants

nf_XXXX constants

stXXXX constants

tf_XXXX constants

wb_XXXX constants

wm_XXXX constants


ObjectWindows Procedures and Functions

Abstract (procedure)

AllocMultiSel (function)

FreeMultiSel (procedure)

LongDiv (function)

LongMul (function)

LowMemory (function)

MemAlloc (function)

RegisterType (procedure)


ObjectWindows Records

LongRec

PtrRec

TDialogAttr

TMessage

TMultiSelRec

TStreamRec

TWindowAttr

WordRec


ObjectWindows Types

PString

TByteArray

TItemList

TWordArray


ObjectWindows Variables
Variables

Application

EmsCurHandle

EmsCurPage

MaxCollectionSize

SafetyPoolSize

StreamError


Application (variable)
Application (variable)     (WObjects unit)

Declaration

Application: PApplication = nil;

Remarks

The Application variable is set to @Self at the beginning of TApplication.Init and cleared to nil by TApplication.Done.

Thus, throughout the execution of an ObjectWindows program, Application points to the application object.


bf_XXXX constants
bf_XXXX constants     (WObjects unit)

Button, check box, and radio button objects use bf_ constants to define their three possible states.

Values

The following button flag constants are defined:

Constant	Value	Meaning

bf_Unchecked	0	Item is unchecked

bf_Checked	1	Item is checked

bf_Grayed	2	Item is grayed


cm_xxxx (constants)
cm_XXXX constants     (WObjects unit)

ObjectWindows defines several constants defining ranges of command message constants.

Values

The following command constants are defined:

Constant	Value	Meaning

cm_First	$A000	Beginning of command messages

cm_Count	$6000	Number of command messages

cm_Internal	$FF00	Beginning of command messages reserved for internal use

cm_InternalOffset	cm_Internal - cm_First

cm_ constants are defined for three standard menus: File, Edit, and Window:

Constant	Value	Menu equivalent

cm_EditCut	cm_InternalOffset	Edit|Cut

cm_EditCopy	cm_InternalOffset + 1	Edit|Copy

cm_EditPaste	cm_InternalOffset + 2	Edit|Paste

cm_EditDelete	cm_InternalOffset + 3	Edit|Delete

cm_EditClear	cm_InternalOffset + 4	Edit|Clear

cm_EditUndo	cm_InternalOffset + 5	Edit|Undo

cm_FileNew	cm_InternalOffset + 6	File|New

cm_FileOpen	cm_InternalOffset + 7	File|Open

cm_MDIFileNew	cm_InternalOffset + 8	File|New

cm_MDIFileOpen	cm_InternalOffset + 9	File|Open

cm_FileSave	cm_InternalOffset + 10	File|Save

cm_FileSaveAs	cm_InternalOffset + 11	File|Save As

cm_ArrangeIcons	cm_InternalOffset + 12	Window|Arrange Icons

cm_TileChildren	cm_InternalOffset + 13	Window|Tile

cm_CascadeChildren	cm_InternalOffset + 14	Window|Cascade

cm_CloseChildren	cm_InternalOffset + 15	Window|Close All


coxxxx (constants)
coXXXX constants     (WObjects unit)

The coXXXX constants are passed as the Code parameter to the TCollection.Error method when a TCollection detects an error during an operation.

Values

The following standard error codes are defined for all ObjectWindows collections:

Error code	Value	Meaning

coIndexError	  -1	Index out of range.

The Info parameter passed to the Error method contains the invalid index.

coOverflow	  -2	Collection overflow. TCollection.SetLimit failed to expand the collection to the requested size.

The Info parameter passed to the Error method contains the requested size.


em_xxxx (constants)
em_XXXX constants     (WObjects unit)

Several standard error conditions are flagged by ObjectWindows constants starting with em_.

Values

The following error flags are defined:

Constant	Value	Meaning

em_OutOfMemory	 -1	A memory allocation ate into the safety pool.

em_InvalidClient	 -2	MDI client window could not be created.

em_InvalidChild	 -3	One or more of the window's children is not valid.

em_InvalidWindow	 -4	Window is invalid because Create did not succeed.

em_InvalidMainWindow	 -5	Main window could not be created.


EmsCurHandle (variable)
EmsCurHandle (variable)     (WObjects unit)

Declaration

EmsCurHandle: Word = $FFFF;

Remarks

Holds the current EMS handle as mapped into EMS physical page 0 by a TEmsStream.

TEmsStream avoids costly EMS remapping calls by caching the state of EMS.

If your program uses EMS for other purposes, be sure to set EmsCurHandle and EmsCurPage to $FFFF before using a TEmsStream--this will force the TEmsStream to restore its mapping.

See Also

TEmsStream.Handle


EmsCurPage (variable)
EmsCurPage (variable)     (WObjects unit)

Declaration

EmsCurPage: Word = $FFFF;

Remarks

Holds the current EMS logical page number as mapped into EMS physical page 0 by a TEmsStream.

TEmsStream avoids costly EMS remapping calls by caching the state of EMS.

If your program uses EMS for other purposes, be sure to set EmsCurHandle and EmsCurPage to $FFFF before using a TEmsStream--this will force the TEmsStream to restore its mapping.

See Also

TEmsStream.PageCount


id_XXXX (constants)
id_XXXX constants     (WObjects unit)

ObjectWindows defines several constants defining ranges of child ID messages.

Values

The following child ID message constants are defined:

Constant	Value	Meaning

id_First	$8000	Start of child ID messages

id_Count	$1000	Number of child ID messages

id_Internal	$8F00	Reserved for internal use

id_InternalOffset	id_Internal - id_First;	Internal offset

id_FirstMDIChild	id_InternalOffset + 1	Base for child-ID numbers

id_MDIClient	id_InternalOffset + 2	Child-ID number of the MDI client window


LongRec (record)
LongRec (record)     (WObjects unit)

Declaration

LongRec = record

   Lo, Hi: Word;

end;

Remarks

A useful record type for handling double-word length variables.


MaxCollectionSize (variable)
MaxCollectionSize (variable)     (WObjects unit)

Declaration

MaxCollectionSize = 65520 div SizeOf(Pointer);

Remarks

MaxCollectionSize determines that maximum number of elements that can be contained in a collection, which is essentially the number of pointers that can fit in a 64K memory segment.


nf_xxxx (constants)
nf_XXXX constants     (WObjects unit)

ObjectWindows defines several constants establishing ranges of notification messages.

Values

The following notification message constants are defined:

Constant	Value	Meaning

nf_First	$9000	Beginning of notification messages

nf_Count	$1000	Number of notification messages

nf_Internal	$9F00	Beginning of notification messages reserved for internal use


PString (type)
PString (type)     (WObjects unit)

Declaration

PString = ^String;

Remarks

Defines a pointer to a Pascal string.


PtrRec (record)
PtrRec (record)     (WObjects unit)

Declaration

PtrRec = record

   Ofs, Seg: Word;

end;

Remarks

A record holding the offset and segment values of a pointer.


SafetyPoolSize (variable)
SafetyPoolSize (variable)     (WObjects unit)

Declaration

SafetyPoolSize: Word = 8192;

Remarks

Defines the size of the memory safety pool.

The safety pool is a buffer at the high end of the heap used to ensure that memory allocations do not fail.

See Also

LowMemory

MemAlloc

TApplication.ValidWindow


stxxxx (constants)
stXXXX constants     (WObjects unit)

There are two sets of constants beginning with "st" that are used by the ObjectWindows streams system.

Values

The following stream access mode constants are used by TDosStream and TBufStream to determine the file access mode of a file being opened for an ObjectWindows stream:

Constant	Value	Meaning

stCreate	$3C00	Create new file

stOpenRead	$3D00	Open existing file with read access only

stOpenWrite	$3D01	Open existing file with write access only

stOpen	$3D02	Open existing file with read and write access

The following values are returned by TStream.Error in the TStream.ErrorInfo field when a stream error occurs:

Error code	Value	Meaning

stOk	  0	No error

stError	 -1	Access error

stInitError	 -2	Cannot initialize stream

stReadError	 -3	Read beyond end of stream

stWriteError	 -4	Cannot expand stream

stGetError	 -5	Get of unregistered object type

stPutError	 -6	Put of unregistered object type

See Also

TStream


StreamError (variable)
StreamError (variable)     (WObjects unit)

Declaration

StreamError: Pointer = nil;

Remarks

If non-nil, StreamError points to a procedure that will be called by a stream's Error method when a stream error occurs.

The procedure must be a far procedure with one var parameter that is a TStream. That is, the procedure must be declared as

procedure MyStreamErrorProc(var S: TStream); far;

StreamError allows you to globally override all stream error handling.

To change error handling for a particular type of stream you should override that stream type's Error method.


TByteArray (array type)
TByteArray (array type)     (WObjects unit)

Declaration

TByteArray = array[0..32767] of Byte;

Remarks

A byte array type for general use in typecasts.


TDialogAttr (record)
TDialogAttr (record)     (WObjects unit)

Declaration

TDialogAttr = record

   Name: PChar;

   Param: Longint;

end;

Remarks

TDialog objects store their attribute values in a record of type TDialogAttr.

See Also

TDialog.Attr


tf_xxxx (constants)
tf_XXXX constants     (WObjects unit)

The Transfer method uses flag constants beginning with tf_.

Values

The following transfer function constants are defined:

Constants	Value	Meaning

tf_SizeData	  0	Find out the size of data transferred by the object.

tf_GetData	  1	Retrieve data from the object.

tf_SetData	  2	Send data to set the value of the object.


TItemList (array type)
TItemList (array type)     (WObjects unit)

Declaration

TItemList = array[0..MaxCollectionSize - 1] of Pointer;

Remarks

An array of generic pointers used internally by TCollection objects.


TMessage (record)
TMessage (record)     (WObjects unit)

Declaration

TMessage = record

   Receiver: HWnd;

   Message: Word;

   case Integer of

     0: (WParam: Word;

         LParam: Longint;

         Result: Longint);

     1: (WParamLo: Byte;

         WParamHi: Byte;

         LParamLo: Word;

         LParamHi: Word;

         ResultLo: Word;

         ResultHi: Word);

   end;

Remarks

The message processing loop in TApplication packages Windows message information into TMessage records before passing the information along to the appropriate message response method.

See Also

TApplication.MessageLoop


TMultiSelRec (record)
TMultiSelRec (record)     (WObjects unit)

Declaration

TMultiSelRec = record

   Count: Integer;

   Selections: array[0..0] of Integer;

end;

Remarks

TMultiSelRec holds a list of selected items for transfer to or from a multiple-selection list box.

-	Count indicates the number of selected items.

-	Selections is an open-ended array of integers.

Using AllocMultiSel, you can allocate a record with enough selection items to accommodate as many selected items as the list box has.

See Also

FreeMultiSel


TStreamRec (record)
TStreamRec (record)     (WObjects unit)

Declaration

TStreamRec = record

   ObjType: Word;

   VmtLink: Word;

   Load: Pointer;

   Store: Pointer;

   Next: Word;

end;

Remarks

An ObjectWindows object type must have a registered TStreamRec before its objects can be loaded or stored on a TStream object.

The RegisterType routine registers an object type by setting up a TStreamRec record.

The fields in the stream registration record are defined as follows:

Field	Contents

ObjType	A unique numerical id for the object type

VmtLink	A link to the object type's virtual method table entry

Load	A pointer to the object type's Load constructor

Store	A pointer to the object type's Store method

Next	A pointer to the next TStreamRec

ObjectWindows reserves object type IDs (ObjType) values 0 through 999 for its own use. Programmers can define their own values in the range 1,000 to 65,535.

By convention, a TStreamRec for a Txxxx object type is called Rxxxx. For example, the TStreamRec for a TCalculator type is called RCalculator, as shown in the following code:

type

   TCalculator = object(TDialog)

     constructor Load(var S: TStream);

     procedure Store(var S: TStream);

     ...

   end;

const

   RCalculator: TStreamRec = (

     ObjType: 2099;

     VmtLink: Ofs(TypeOf(TCalculator)^);

     Load: @TCalculator.Load;

     Store: @TCalculator.Store);

begin

   RegisterType(RCalculator);

   ...

end;


TWindowAttr (record)
TWindowAttr (record)     (WObjects unit)

Declaration

TWindowAttr = record

   Title: PChar;

   Style: Longint;

   ExStyle: Longint;

   X, Y, W, H: Integer;

   Param: Pointer;

   case Integer of

     0: (Menu: HMenu);     { window menu's handle or... }

     1: (Id: Integer);     { control's child identifier }

   end;

Remarks

TWindow objects define their attributes in TWindowAttr records.

See Also

TWindow.Attr


TWordArray (array type)
TWordArray (array type)     (WObjects unit)

Declaration

TWordArray = array[0..16383] of Word;

Remarks

A word array type for general use.


wb_xxxx (constants)
wb_XXXX constants     (WObjects unit)

The Flags field in TWindowsObject is a bitmapped field. The bits can be accessed with constants beginning with wb_.

Values

The following values are defined:

Constant	Value	Meaning if set

wb_KeyboardHandler	 $01	Window handles key events like a dialog

wb_FromResource	 $02	Dialog was loaded from a resource

wb_AutoCreate	 $04	Window is created when parent window is created

wb_MDIChild	 $08	Window is an MDI child window

wb_Transfer	 $10	Window participates in the Transfer mechanism. By default, this bit is set by InitResource, cleared by Init.

See Also

TWindowsObject.Flags


wm_xxxx (constants)
wm_XXXX constants     (WObjects unit)

ObjectWindows defines several constants related to the standard Windows messages, defining ranges of messages reserved for Windows.

Values

The following window message constants are defined:

Constant	Value	Meaning

wm_First	$0000	Beginning of Windows messages

wm_Count	$8000	Number of Windows messages


WordRec (record)
WordRec (record)     (WObjects unit)

Declaration

WordRec = record

   Lo, Hi: Byte;

end;

Remarks

A utility record allowing access to the Lo and Hi bytes of a word.

See Also

LongRec


WinTypes Unit

The WinTypes unit defines Turbo Pascal versions of all the types used by the Windows API routines, including simple types and data structures (records) and all the standard Windows constants, including styles, messages, and flags.


Windows API Record
Windows API Records     (WinTypes unit)

TBitmap

TBitmapCoreHeader

TBitmapCoreInfo

TBitmapFileHeader

TBitmapInfo

TBitmapInfoHeader

TCatchBuf

TClientCreateStruct

TCompareItemStruct

TComStat

TCreateStruct

TDCB

TDDEAck

TDDEAdvise

TDDEData

TDDEPoke

TDeleteItemStruct

TDevMode

TDrawItemStruct

THandleTable

TLogBrush

TLogFont

TLogPalette

TLogPen

TMDICreateStruct

TMeasureItemStruct

TMenuItemTemplate

TMenuItemTemplateHeader

TMetaFilePict

TMetaHeader

TMetaRecord

TMsg

TMultiKeyHelp

TOFStruct

TPaintStruct

TPaletteEntry

TPoint

TRect

TRGBQuad

TRGBTriple

TTextMetric

TWndClass


Windows API Types
Windows API Types     (WinTypes unit)

Bool

HBitmap

HBrush

HCursor

HDC

HFont

HIcon

HMenu

HPalette

HPen

HRgn

HStr

HWnd

LPHandle

LPVoid

MakeIntAtom

MakeIntResource

PBool

PByte

PHandle

PInteger

PLongint

PStr

PWord

TAtom

TColorRef

TFarProc

TGlobalHandle

THandle

TLocalHandle

TPattern


Bool (type)
Bool (type)     (WinTypes unit)

Declaration

Bool = System.WordBool;

Remarks

Bool is equivalent to the standard type WordBool. It is provided for compatibility with Windows code written in other languages.


dialog template

A dialog template is a Windows data structure called DLGTEMPLATE or TDlgTemplate. It consists of:

-	a dialog template header (required)

-	font information for the dialog (optional)

-	template information for each of the items in the dialog box (optional)

A pointer to the structure is used by:

CreateDialogIndirect

CreateDialogIndirectParam

DialogBoxIndirect

DialogBoxIndirectParam

Dialog Template Header

Dialog templates begin with a dialog template header. The header consists of:

dtStyle	The style of the dialog box (long integer). This value can be one of, or any combination of, the ds_ Dialog style constants.

dtItemCount	The number of items in the dialog box (byte).

dtX, dtY	The coordinates of the upper-left corner of the dialog box, relative to the origin of the parent window's client area. (If the dialog's style includes ds_AbsAlign, the coordinates are relative to the origin of the screen.)

dtCX, dtCY	The width and height of the dialog box.

Here is an example of a dialog template header:

  type

    DialogTemplateHeader = record

      dtStyle: Longint;

      dtItemCount: Byte;

      dtX, dtY: Integer;

      dtCX, dtCY: Integer;

    end;

Three null-terminated strings follow the coordinates and size of the dialog box:

dtMenuName	 the name of the dialog box's menu

dtClassName	 the name of the dialog box's Windows class

dtCaptionText	 the dialog box's caption.

Font Information

If dtStyle contains ds_SetFont, dtCaptionText must be followed by two items describing the font:

-	the point size of the typeface (short integer)

-	the name of the typeface (null-terminated string)

Dialog Item Templates

Dialog item templates follow the font information. There is one dialog item template for each control in the dialog box. The number of items is determined by dtItemCount .

Each dialog item template consists of:

dtilX, dtilY, dtilCX, dtilCY	the position and size of the control, relative to the origin of the dialog (integers)

dtilID	an integer which gives the dialog item ID of the control

dtilStyle	the style of the dialog-box item (long integer)

one of: BUTTON,

EDIT, STATIC,

LISTBOX, SCROLLBAR,

COMBOBOX	name of the control's Windows class (null-terminated string)

dtilText	the text for the item (null-terminated string)

dtilInfo	value indicating the number of bytes of additional information  (byte). 0 indicates that there is no additional information.

dtilData	information that is passed to CreateWindow  in the CreateParams field of a TCreateStruct. Only used if dtilInfo is non-zero.

See Also

GetDialogBaseUnits


HBitmap (type)
HBitmap (type)     (WinTypes unit)

Declaration

HBitmap = THandle;

Remarks

HBitmap is a handle type for bitmap handles.


HBrush (type)
HBrush (type)     (WinTypes unit)

Declaration

HBrush = THandle;

Remarks

HBrush defines a handle type for brush drawing tools.


HCursor (type)
HCursor (type)     (WinTypes unit)

Declaration

HCursor  = THandle;

Remarks

HCursor defines a handle type for cursor handles.


HDC (type)
HDC (type)     (WinTypes unit)

Declaration

HDC = THandle;

Remarks

HDC defines a handle type for device context handles.

Display contexts are a kind of device context, so display context handles are always stored in variables of type HDC.


HFont (type)
HFont (type)     (WinTypes unit)

Declaration

HFont = THandle;

Remarks

HFont defines a handle type for font drawing tools.


HIcon (type)
HIcon (type)     (WinTypes unit)

Declaration

HIcon = THandle;

Remarks

HIcon defines a handle type for icon handles.


HMenu (type)
HMenu (type)     (WinTypes unit)

Declaration

HMenu = THandle;

Remarks

HMenu defines a handle type for menu resources.


HPalette (type)
HPalette (type)     (WinTypes unit)

Declaration

HPalette = THandle;

Remarks

HPalette defines a handle type for palette handles.


HPen (type)
HPen (type)     (WinTypes unit)

Declaration

HPen = THandle;

Remarks

HPen defines a handle type for pen drawing tools.


HRgn (type)
HRgn (type)     (WinTypes unit)

Declaration

HRgn = THandle;

Remarks

HRgn defines a handle type for region handles.


HStr (type)
HStr (type)     (WinTypes unit)

Declaration

HStr = THandle;

Remarks

HStr defines a handle type for string handles.


HWnd (type)
HWnd (type)     (WinTypes unit)

Declaration

HWnd = THandle;

Remarks

HWnd defines a handle type for window handles.

These are commonly used by ObjectWindows interface objects to keep track of their associated Windows interface elements.

Many API function calls require a window handle to indicate which window they are to act on.


LPHandle (type)
LPHandle (type)     (WinTypes unit)

Declaration

LPHandle = PHandle;

Remarks

LPHandle defines a long pointer to a handle.

It is not used by ObjectWindows, but is included for compatibility with Windows code written in other languages.


LPVoid (type)
LPVoid (type)     (WinTypes unit)

Declaration

LPVoid = Pointer;

Remarks

LPVoid defines a long pointer. It is not used by ObjectWindows, but is included for compatibility with Windows code written in other languages.


MakeIntAtom (type)
MakeIntAtom (type)     (WinTypes unit)

Declaration

MakeIntAtom = PStr;

Remarks

MakeIntAtom is used for typecasting integer numbers into atoms.

It is equivalent to typecasting into the Turbo Pascal type PChar.


MakeIntResource (type)
MakeIntResource (type)     (WinTypes unit)

Declaration

MakeIntResource = PStr;

Remarks

MakeIntResource is used for typecasting integer numbers into resource names.

It is equivalent to typecasting into the Turbo Pascal type PChar.


MakePoint (type)
MakePoint (type)     (WinTypes unit)

Declaration

MakePoint = TPoint;

Remarks

MakePoint is used for typecasting long integer numbers into TPoint records.


PBool (type)
PBool (type)     (WinTypes unit)

Declaration

PBool = ^WordBool;

Remarks

PBool defines a pointer to a 16-bit Boolean value.


PByte (type)
PByte (type)     (WinTypes unit)

Declaration

PByte = ^Byte;

Remarks

PByte defines a pointer to an 8-bit unsigned value.


PHandle (type)
PHandle (type)     (WinTypes unit)

Declaration

PHandle = ^THandle;

Remarks

PHandle defines a pointer to a generic Windows handle.


PInteger (type)
PInteger (type)     (WinTypes unit)

Declaration

PInteger = ^Integer;

Remarks

PInteger defines a pointer to a signed, 16-bit integer number.


PLongint (type)
PLongint (type)     (WinTypes unit)

Declaration

PLongint = ^Longint;

Remarks

PLongint defines a pointer to a 32-bit integer number.


PStr (type)
PStr (type)     (WinTypes unit)

Declaration

PStr = PChar;

Remarks

PStr defines a pointer to a null-terminated string.

It is exactly equivalent to the Turbo Pascal type PChar, and is provided for compatibility with code written in other languages.


PWord (type)
PWord (type)     (WinTypes unit)

Declaration

PWord = ^Word;

Remarks

PWord defines a pointer to an unsigned 16-bit integer number.


TAtom (type)
TAtom (type)     (WinTypes unit)

Declaration

TAtom = Word;

Remarks

TAtom defines a 16-bit number identifying an atom, or message, to be sent between DDE-compliant applications.


TBitmap (record)
TBitmap (record)     (WinTypes unit)

Declaration

TBitmap = record

   bmType: Integer;

   bmWidth: Integer;

   bmHeight: Integer;

   bmWidthBytes: Integer;

   bmPlanes: Byte;

   bmBitsPixel: Byte;

   bmBits: Pointer;

end;

Remarks

The TBitmap record is used by the CreateBitmapIndirect and GetObject functions to describe the size, colors, and bit values for a bitmap.

Fields

bmType

The bmType field defines the bitmap type. A 0 value indicates a logical bitmap.

bmWidth and bmHeight

bmWidth and bmHeight define the width in pixels and the height in raster lines, respectively, of the bitmap. Both must be greater than 0.

bmWidthBytes

bmWidthBytes gives the number of bytes in each raster line, and must be an even number.

bmPlanes and bmBitsPixel

bmPlanes and bmBitsPixel give the number of color planes and the number of adjacent color bits on each plane, respectively.

bmBits

bmBits is a pointer to the actual bits that make up the bitmap. The bits take the form of an array of bytes.


TBitmapCoreHeader (record)
TBitmapCoreHeader (record)     (WinTypes unit)

Declaration

TBitmapCoreHeader = record

   bcSize: Longint;     { used to get to color table }

   bcWidth: Word;

   bcHeight: Word;

   bcPlanes: Word;

   bcBitCount: Word;

end;

Remarks

TBitmapCoreHeader defines the size and colors of a device-independent bitmap. TBitmapCoreHeader records are used as part of TBitmapCoreInfo records to fully define device-independent bitmaps.

Fields

bcSize

bcSize is the number of bytes in the TBitmapCoreHeader record.

bcWidth and bcHeight

bcWidth and bcHeight are the width and height (in pixels) of the bitmap, respectively.

bcPlanes

bcPlanes gives the number of planes for the target device; it must be set to 1.

bcBitCount

bcBitCount gives the number of bits per pixel. Allowed values for bcBitCount are 1, 4, 8, and 24.

The significance of the bcBitCount bits is as follows:

-	bcBitCount is 1, the bitmap is monochrome, the color table must contain two entries, and each bit in the bitmap represents one pixel. A bit that is clear represents the first color in the table; a bit that is set represents the second color.

-	bcBitCount is 4, the bitmap has up to 16 colors, numbered 0 to 15, so each pixel in the bitmap requires four bits to indicate its color. The color table contains 16 entries. Each byte in the bitmap thus represents two pixels, the high-order half-byte first, then the low-order half-byte.

-	bcBitCount is 8, the bitmap has up to 256 colors, so it takes a full byte to represent each pixel. Each byte in the bitmap, then, represents an index between 0 and 255 into the color table.

-	 bcBitCount is 24, the bitmap has up to 224 colors. There is no color table, and each pixel is represented by a trio of bytes, signifying the intensities of the red, green, and blue in the pixel.


TBitmapCoreInfo (record)
TBitmapCoreInfo (record)     (WinTypes unit)

Declaration

TBitmapCoreInfo = record

   bmciHeader: TBitmapCoreHeader;

   bmciColors: array[0..0] of TRGBTriple;

end;

Remarks

TBitmapCoreInfo records combine size and color information from a TBitmapCoreHeader record with a table of color information to fully define a device-independent bitmap.

Fields

bmciHeader

bmciHeader is a TBitmapCoreHeader record, defining the size and color information for the bitmap.

The bcSize field of bmciHeader can be used to provide an offset to the bmciColors field.

bmciColors

bmciColors is an array of TRGBTriple records. The number of elements in that array is determined by the bcBitCount field of the bmciHeader field.

bmciColors can be either an array of RGB color records or an array of indexes into the currently realized logical palette.

The way the field is interpreted depends on the Usage parameter passed to the function accessing the device-independent bitmap.

Use of RGB values for the bmciColors field is strongly encouraged, unless the bitmap is used exclusively by a single application. If the bitmap is stored in a file or transferred to another program, it should not use palette indexing.

See Also

DIB_ Color table identifiers.


TBitmapFileHeader (record)
TBitmapFileHeader (record)     (WinTypes unit)

Declaration

TBitmapFileHeader = record

   bfType: Word;

   bfSize: Longint;

   bfReserved1: Word;

   bfReserved2: Word;

   bfOffBits: Longint;

end;

Remarks

The TBitmapFileHeader record defines the header of a device-independent bitmap file, which contains data defining the type-size, and layout of the bitmap file.

A device-independent bitmap file consists of a TBitmapFileHeader, followed by either a TBitmapInfo record or a TBitmapCoreInfo record, then the actual bitmap data.

Fields

bfType

bfType field gives the type of the file, which must be BM.

bfSize

bfSize field gives the size of the file in 4-byte blocks.

bfReserved1 and bfReserved2

bfReserved1 and bfReserved2 are, as their names imply, reserved by Windows.

bfOffBits

bfOffBits tells how many bytes into the file the actual bitmap information begins.


TBitmapInfo (record)
TBitmapInfo (record)     (WinTypes unit)

Declaration

TBitmapInfo = record

   bmiHeader: TBitmapInfoHeader;

   bmiColors: array[0..0] of TRGBQuad;

end;

Remarks

TBitmapInfo records hold size and color information for device-independent bitmaps for Windows 3.0.

The actual bitmap is defined as an array of bytes representing the pixels of the bitmap.

Fields

bmiHeader

bmiHeader field holds a TBitmapInfoHeader record that defines the size and color formatting for the bitmap.

bmiColors

bmiColors field is an array of TRGBQuad records, defining the colors of the bitmap.

The number of entries in the array is determined by the value of the biBitCount field of the bmiHeader record.


TBitmapInfoHeader (record)
TBitmapInfoHeader (record)     (WinTypes unit)

Declaration

TBitmapInfoHeader = record

   biSize: Longint;

   biWidth: Longint;

   biHeight: Longint;

   biPlanes: Word;

   biBitCount: Word;

   biCompression: Longint;

   biSizeImage: Longint;

   biXPelsPerMeter: Longint;

   biYPelsPerMeter: Longint;

   biClrUsed: Longint;

   biClrImportant: Longint;

end;

Remarks

TBitmapInforHeader records are used by TBitmapInfo records to define the dimensions and color formatting of a device-independent bitmap for Windows 3.0.

Fields

biSize

biSize gives the size, in bytes, of the record.

biWidth and biHeight

biWidth and biHeight are the width and height in pixels, respectively, of the bitmap.

biPlanes

biPlanes is the number of planes for the target device; It must be set to one.

biBitCount

biBitCount gives the number of bits required to describe each pixel in the bitmap.

The meanings of the values of biBitCount correspond exactly to those defined for the bcBitCount field of TBitmapCoreHeader records.

biCompression

biCompression gives the type of compression used for the bitmap; it can be any of the bi_ constants.

biSizeImage

biSizeImage is the size of the bitmap image, in bytes.

biXPelsPerMeter and biYPelsPerMeter

biXPelsPerMeter and biYPelsPerMeter give the horizontal and vertical resolution, respectively, of the target device for the bitmap.

biClrUsed

biClrUsed field specifies the number of color table entries actually used by the bitmap.

The biBitCount value determines the maximum number of entries; a 0 in biClrUsed indicates that the maximum number is used.

A biClrUsed between 1 and 23 indicates the actual number of colors accessed.

If biBitCount is 24, biClrUsed is the size of the reference color table used by Windows to optimize color palette performance.

biClrImportant

biClrImportant gives the number of colors deemed important for the display of the bitmap. A zero value indicates that all colors are important.


TCatchBuf (record)
TCatchBuf (record)     (WinTypes unit)

Declaration

TCatchBuf = array[0..8] of Integer;

Remarks

TCatchBuf is a record that holds the state of all system registers. It is used by the Catch and Throw functions.


TClientCreateStruct (record)
TClientCreateStruct (record)     (WinTypes unit)

Declaration

TClientCreateStruct = record

   hWindowMenu: THandle;

   idFirstChild: Word;

end;

Remarks

TClientCreateStruct holds window ID and menu information when creating MDI client windows.

Fields

hWindowMenu

hWindowMenu field is a handle to the application's menu.

idFirstChild

idFirstChild is the child window ID of the first child window of the MDI application.

Child window IDs are uniquely assigned and maintained by Windows.


TColorRef (type)
TColorRef (type)     (WinTypes unit)

Declaration

TColorRef = Longint;

Remarks

TColorRef is a 32-bit value corresponding to a color, used by numerous GDI functions. It can be interpreted in three different ways, depending on the value of the high-order byte of the high-order word in the long integer.

If that highest-order byte is zero, the next three bytes represent RGB color intensities for blue, green, and red, respectively, so the value $00FF0000 represents full-intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red.

$00000000 is black, and $00FFFFFF is white.

RGB values can most easily be converted into TColorRef values using the RGB function.

If the highest-order byte is one, the next byte must be zero. The low-order word (the next two bytes) form an index into a logical palette. Thus, $01000000 is index zero (the first entry) of a palette. Integer-type palette indexes can be converted into TColorRef values using the GetNearestPaletteIndex function.

If the highest-order byte is two, the next three bytes represent RGB color intensities (as with RGB values described for a zero highest-byte), but the value will be matched to the nearest color in the logical palette in the current device context. Palette-relative RGB TColorRef values can be produced from RGB values with the PaletteRGB function.

In order for palette index or palette-relative TColorRef values to work with a device context, an application with its own palette must select it palette into the device context being written to (using SelectPalette) and realize it (using RealizePalette) in order to have drawing functions use the correct colors from the palette. Similarly, before creating a logical drawing tool, the palette must be selected and realized if the colors are to take effect.


TCompareItemStruct (record)
TCompareItemStruct (record)     (WinTypes unit)

Declaration

TCompareItemStruct = record

   CtlType: Word;

   CtlID: Word;

   hwndItem: HWnd;

   itemID1: Word;

   itemData1: Longint;

   itemID2: Word;

   itemData2: Longint;

end;

Remarks

The TCompareItemStruct record is used for comparing items in sorted owner-draw combo boxes or list boxes.

Adding items to such controls produces a wm_CompareItem message, one of the parameters of which is a pointer to a TCompareItemStruct. Upon receiving the message, the owner compares the items in the record and returns values depending on the result.

Fields

CtlType

CtlType holds an odt_ constant indicating that the control is an owner-draw combo box (odt_ComboBox) or list box (odt_ListBox).

CtlID and hwndItem

CtlID and hwndItem are the control ID and window handle for the control, respectively.

itemID1 and itemData1

itemID1 and itemData1 give the index of the first item in the listbox or combo box being compared and the data for that item.

itemID2 and itemData2

The itemData1 information is the data from the lParam parameter of the message that added the item to the list.

itemID2 and itemData2 provide the same information for the second item.


TComStat (record)
TComStat (record)     (WinTypes unit)

Declaration

TComStat = record

   Flags: Byte;

   cbInQue: Word;

   cbOutQue: Word;

end;

Remarks

TComStat records hold status information on a communications device.

They are used by the GetCommError function.

Fields

Flags

Flags is a bitmapped field, with the bits defined by the com_constants

cbInQue and cbOutQue

cbInQue and cbOutQue fields give the number of characters in the receive and transmit queues, respectively.


TCreateStruct (record)
TCreateStruct (record)     (WinTypes unit)

Declaration

TCreateStruct = record

   lpCreateParams: PChar;

   hInstance: THandle;

   hMenu: THandle;

   hwndParent: HWnd;

   cy: Integer;

   cx: Integer;

   y: Integer;

   x: Integer;

   style: LongInt;

   lpszName: PChar;

   lpszClass: PChar;

   dwExStyle: Longint;

end;

Remarks

The TCreateStruct record is used to pass initialization parameters to the window function of an application.

Fields

lpCreateParams

lpCreateParams points to window creation data.

hInstance, hMenu, and hwndParent

hInstance, hMenu, and hwndParent are handles to the module instance of the module that owns the window, the menu for the window, and the parent window of the new window.

hwndParent

hwndParent is 0 if the window being created is the main window of the application.

cy, cx, y, and x

cy and cx are the height and width of the window. y and x give the vertical and horizontal coordinates of the upper left corner of the window, relative to its parent, if any.

style

style hold the style flags for the window.

lpszName and lpszClass

lpszName and lpszClass point to the null-terminated strings specifying the name and class name, respectively, of the window.

dwExStyle

dwExStyle holds extended style information for the window.


TDCB (record)
TDCB (record)     (WinTypes unit)

Declaration

TDCB = record

   Id: Byte;

   BaudRate: Word;

   ByteSize: Byte;

   Parity: Byte;

   StopBits: Byte;

   RlsTimeout: Word;

   CtsTimeout: Word;

   DsrTimeout: Word;

   Flags: Word;

   XonChar: Char;

   XoffChar: Char;

   XonLim: Word;

   XoffLim: Word;

   PeChar: Char;

   EofChar: Char;

   EvtChar: Char;

   TxDelay: Word;

end;

Remarks

TDCB records hold control information for serial communications devices, used by the BuildCommDCB, GetCommState, and SetCommState functions.

Fields

Id

Id is the ID of the communications device.

If the high-order bit is set (compare with the mask LPTx), the device is a parallel device.

Otherwise it is a serial port.

BaudRate, ByteSize, Parity, and StopBits

BaudRate, ByteSize, Parity, and StopBits define the communications parameters for the port.

ByteSize is the number of bits in each character, ranging from 4 to 8.

Parity is one of the communications constants EvenParity, MarkParity, NoParity, OddParity, or SpaceParity.

StopBits is one of the communications constants OneStopBit, One5StopBits, or TwoStopBits.

RlsTimeout, CtsTimeout, and DsrTimeout

RlsTimeout, CtsTimeout, and DsrTimeout give the time in milliseconds that the device should wait before timing out while waiting for the RLSD, CTS, and DSR signals, respectively.

Flags

In the Flags field, each bit represents a toggle switch on a different kind of error checking.

The bits are defined in the following table. Individual bits can be accessed using the dcb_ constants.

Bit	Meaning if set

fbinary	Port is using binary mode

fRtsDisable	RTS disabled

fParity	Parity-checking enabled

fOutxCtsFlow	CTS monitored on transmission

fOutxDsrFlow	DSR monitored on transmission

fDummy	Reserved

fDtrDisable	DTR disabled

fOutX	Xon/Xoff control used on transmission

fInX	Xon/Xoff control used on receive

fPeChar	Parity errors replaced

fNull	Null characters discarded

fChEvt	EvtChar character is flagged as an event

fDtrFlow	DTR used for receive flow control

fRtsFlow	RTS used for receive flow control

fdummy2	Reserved

XonChar and XoffChar

XonChar and XoffChar give the values of the Xon and Xoff characters for both transmission and reception, respectively.

XoffLim

XoffLim is the number of characters in the receive queue that triggers the sending of an Xoff.

PeChar, EofChar, and EvtChar

PeChar, EofChar, and EvtChar define the characters used to replace parity errors, to signal the end of data, and to signal an event, respectively.

TxDelay

TxDelay is currently not used.


TDDEAck (record)
TDDEAck (trecord)     (WinTypes unit)

Declaration

TDDEAck = record

   Flags: Word;

end;

Remarks

The TDDEAck record holds acknowledgement information, sent in a parameter of a wm_dde_Ack message in response to any DDE message other than wm_dde_Initiate.

Fields

Flags

The Flags field is a bitmapped word, with only two bits currently defined for application use.

The fAck bit, if set, indicates that the request was accepted.

The fBusy bit, if set, indicates that the application is unable to respond to the request. fBusy is only meaningful if fAck is 0.

The low-order byte of Flags is the bAppReturnCode "field," which can be accessed using the dde_AppReturnCode mask. It contains application-specific return codes.

The remaining bits are reserved for Windows.


TDDEAdvise (record)
TDDEAdvise (record)     (WinTypes unit)

Declaration

TDDEAdvise = record

   Flags: Word;

   cfFormat: Integer;

end;

Remarks

The TDDEAdvise record holds a request to a DDE server, and is passed in a parameter of a wm_dde_Advise message.

Fields

Flags

The Flags field is a bitmapped field with only two bits define: fAckReq and fDeferUpd. They can be accessed with dde_ constants.

The 14 lowest-order bits of Flags are undefined, but reserved.

The fAckReq bit, if set, signifies a request to the server to send its wm_dde_Data messages with their fAckReq bit set, as a means of implementing message-flow control.

The fDeferUpd bit, if set, requests that the server send wm_dde_Data messages with their hData handles set to 0, to alert the client of changed data.

When so alerted, the client can respond by sending a wm_dde_Request message to ask for the updated data.

cfFormat

cfFormat specifies the client's preferred data format, using one of the cf_ Clipboard format constants.


TDDEData (record)
TDDEData (record)     (WinTypes unit)

Declaration

TDDEData = record

   Flags: Word;

   cfFormat: Integer;

   Value: array[0..1] of Char;

end;

Remarks

The TDDEData record holds data being transferred from one application to another. It is passed as a parameter in wm_dde_Data messages.

Fields

Flags

The Flags field is a bitmapped field, with only three bits currently defined. These bits, fAckReq, fRelease, and fRequested, can be accessed with dde_ constants.

The fAckReq bit, if set, indicates that the client application should send an acknowledgement upon receiving the data, in the form of a wm_dde_Ack message.

The fRelease bit, if set, means the client should free the data sent with the wm_dde_Data message after processing it.

The fRequested bit, if set, indicates that the data attached comes as a response to a request from the client.

All other Flags bits are reserved.

cfFormat

cfFormat holds a cf_ Clipboard format constant, indicating the format in which the data is sent to the client.

Value

The Value field holds the data being transferred, in the format given by cfFormat.


TDDEPoke (record)
TDDEPoke (record)     (WinTypes unit)

Declaration

TDDEPoke = record

   Flags: Word;

   cfFormat: Byte;

   Value: array[0..1] of Byte;

end;

Remarks

The TDDEPoke record holds unsolicited data, accompanying a wm_dde_Poke message.

Fields

Flags

The Flags field is a bitmapped field with only one bit currently defined: fRelease. The fRelease bit indicates, if set, that the recipient should free the data after processing it.

All other Flags bits are reserve.

Release can be accessed with the dde_Release constant.

cfFormat

cfFormat specifies the client's preferred data format, using one of the cf_ Clipboard format constants.

Value

Value field holds the data being transferred, in the format given by cfFormat.


TDeleteItemStruct (record)
TDeleteItemStruct (record)     (WinTypes unit)

Declaration

TDeleteItemStruct = record

   CtlType: Word;

   CtlID: Word;

   itemID: Word;

   hwndItem: HWnd;

   itemData: Longint;

end;

Remarks

The TDeleteItemStruct record describes an item deleted from an owner-draw combo box or list box. The wm_DeleteItem message comes to the owner of the item, with the lParam parameter pointing to a TDeleteItemStruct record.

Fields

CtlType

CtlType indicates the type of control, either list box (odt_ListBox) or combo box (odt_ComboBox).

CtlId

CtlId is the control ID of the box.

itemID

itemID is the index of the item being deleted.

hwndItem

hwndItem is the control's window handle.

itemData

itemData is the 32-bit value of the indexed item.


TDevMode (record)
TDevMode (record)     (WinTypes unit)

Declaration

TDevMode = record

   dmDeviceName: array[0..cchDeviceName-1] of Char;

   dmSpecVersion: Word;

   dmDriverVersion: Word;

   dmSize: Word;

   dmDriverExtra: Word;

   dmFields: LongInt;

   dmOrientation: Integer;

   dmPaperSize: Integer;

   dmPaperLength: Integer;

   dmPaperWidth: Integer;

   dmScale: Integer;

   dmCopies: Integer;

   dmDefaultSource: Integer;

   dmPrintQuality: Integer;

   dmColor: Integer;

   dmDuplex: Integer;

end;

Remarks

TDevMode records are used by DeviceCapabilities and ExtDeviceMode to hold information on a printer device driver.

Fields

dmDeviceName

dmDeviceName contains a null-terminated string giving the name of the device supported.

dmSpecVersion

dmSpecVersion is the version number of the data specification, currently $0300.

dmDriverVersion

dmDriverVersion is the version number of the driver, specified by the developer.

dmSize

dmSize is the size of the record, excluding the dmDriverData field at the end.

dmDriverExtra

dmDriverExtra gives the size of the dmDriverData field.

dmFields

dmFields is a 32-bit, bitmapped field, indicating which (if any) of the remaining fields have been initialized.

Each bit corresponds to one field, with the constants listed in the following table.

Flag	Field

dm_Color	dmColor

dm_Copies	dmCopies

dm_DefaultSource	dmDefaultSource

dm_Duplex	dmDuplex

dm_Orientation	dmOrientation

dm_PaperLength	dmPaperLength

dm_PaperSize	dmPaperSize

dm_PaperWidth	dmPaperWidth

dm_PrintQuality	dmPrintQuality

dm_Scale	dmScale

dm_SpecVersion	dmSpecVersion

dmOrientation

dmOrientation selects the paper orientation, portrait or landscape, using one of the dmorient_ constants.

dmPaperSize

dmPaperSize selects the paper size, using one of the dmpaper_ constants.

dmPaperLength and dmPaperWidth

dmPaperLength and dmPaperWidth allow the user to override the paper length and width specified in the dmPaper field.

dmScale

dmScale scales the printed output by a factor of dmScale/100.

A value of 75, for example, reduces images to 75% of their normal size.

dm_Copies

dm_Copies selects the number of copies to print.

dmDefaultSource

dmDefaultSource indicates the bin from which paper will feed by default, specified by one of the dmbin_ constants.

dmDefaultSource

dmDefaultSource the print resolution to be used, using one of the device-independent dmres_ constants (which are all negative values), or a positive number, which is a device-dependent, dots-per-inch value.

dmColor

dmColor field selects color or monochrome printing, using the dmcolor_ constants.

dmDuplex

dmDuplex selects one-sided or two-sided printing using the dmdup_ constants.

dmDriverData

dmDriverData contains data specific to, and defined by, the driver.


TDrawItemStruct (record)
TDrawItemStruct (record)     (WinTypes unit)

Delcaration

TDrawItemStruct = record

  CtlType: Word;

  CtlID: Word;

  itemID: Word;

  itemAction: Word;

  itemState: Word;

  hwndItem: HWnd;

  hDC: HDC;

  rcItem: TRect;

  itemData: Longint;

end;

Remarks

The TDrawItemStruct record holds data for painting owner-draw controls.

The owner of the control receives a pointer to a TDrawItemStruct in the lParam parameter of the wm_DrawItem message.

Fields

CtlType

The CtlType field is the control type, designated by one of the odt_constants.

CtlID

Tthe control ID number of the control (not used for menus).

itemID

The menu-item ID of the item index. This can be -1 for empty list boxes or combo boxes.

itemAction

The itemAction field defines drawing actions, using the oda_ constants, to specify when and how to draw the control.

itemState

The itemState field describes the state of the item after it is drawn, using the oda_ constants.

hwndItem

The hwndItem field is the window handle of the control. For a menu it is the handle of the menu containing the item.

hDC

hDC is the handle of the device context that must be used when drawing this control.

rclItem

The rcItem field is the bounding rectangle of the control in the device context. Windows clips owner-draw controls at this boundary.

itemData

The itemData field contains either:

-	an owner-draw list-box or combo-box value provided by the cb_AddString, cb_InsertString, lb_AddString, or lb_InsertString message that created the item; or

-	the long integer value given to the menu item in the NewItem parameter of the InsertMenu call that inserted it.

itemData is undefined for owner-draw buttons.


TFarProc (type)
TFarProc (type)     (WinTypes unit)

Declaration

TFarProc = Pointer;

Remarks

TFarProc is a pointer, usually to a procedure.


TGlobalHandle (type)
TGlobalHandle (type)     (WinTypes unit)

Declaration

TGlobalHandle = THandle;

Remarks

TGlobalHandle is exactly the same as THandle, but you might want to use it to make clear to people reading your code that the handle is to a global item, such as a global memory block.


THandle (type)
THandle (type)     (WinTypes unit)

Declaration

THandle = Word;

Remarks

THandle defines a generic handle type.


THandleTable (record)
THandleTable (record)     (WinTypes unit)

Declaration

THandleTable = record

   objectHandle: array[0..0] of THandle;

end;

Remarks

THandleTable is an array of handles, usually used to store a number of drawing tools.


TLocalHandle (type)
TLocalHandle (type)     (WinTypes unit)

Declaration

TLocalHandle = THandle;

Remarks

TLocalHandle is exactly the same as THandle, but you might want to use it to make clear to people reading your code that the handle is to a local item, such as a local memory block.


TLogBrush (record)
TLogBrush (record)     (WinTypes unit)

Declaration

TLogBrush = record

   lbStyle: Word;

   lbColor: Longint;

   lbHatch: Integer;

end;

Remarks

The TLogBrush record holds the information for creation of a logical brush with the CreateBrushIndirect function.

Fields

lbStyle

lbStyle holds one of the bs_ brush style constants, indicating that the brush should be solid, hollow, hatched, or pattern.

lbColor

lbColor is a TColorRef record. Color is ignored if the brush style is hollow or pattern.

If the style is bs_DIBPattern, the low-order word must contain one of the DIB_ constants, indicating whether the colors specified are explicit or indexed into the current palette.

lbHatch

lbHatch field gives a hatch style. Depending on the style of the brush, lbHatch could contain any of the following:

Style	lbHatch contains

bs_DIBPattern	The handle of a packed device-independent bitmap

bs_Hatched	One of the hs_ hatch style constants, indicating the orientation of the hatch

bs_Hollow	Ignored

bs_Pattern	The handle of the bitmap defining the pattern

bs_Solid	Ignored


TLogFont (record)
TLogFont (record)     (WinTypes unit)

Declaration

TLogFont = record

   lfHeight: Integer;

   lfWidth: Integer;

   lfEscapement: Integer;

   lfOrientation: Integer;

   lfWeight: Integer;

   lfItalic: Byte;

   lfUnderline: Byte;

   lfStrikeOut: Byte;

   lfCharSet: Byte;

   lfOutPrecision: Byte;

   lfClipPrecision: Byte;

   lfQuality: Byte;

   lfPitchAndFamily: Byte;

   lfFaceName: array[0..lf_FaceSize - 1] of Char;

end;

Remarks

The TLogFont record holds the attributes of a logical font for use by the CreateFontIndirect function.

Fields

lfHeight and lfWidth

lfHeight and lfWidth give the average height and width of the font.

lfEscapement and lfOrientation

lfEscapement and lfOrientation are the escapement angle and orientation angle of the text, both given in tenths of degrees, measured counterclockwise from the x-axis.

lfWeight

lfWeight field gives the weight of the font, in inked pixels per 1000. The value may be any value from 0 to 1000.

400 is considered normal, 700 bold. Actual values will vary, depending on the type face.

A 0 value specifies that a default weight is to be used.

lfItalic, lfUnderline, and lfStrikeOut

lfItalic, lfUnderline, and lfStrikeOut fields are normally 0. If non-zero, they signify italic, underlined, or strikeout fonts, respectively.

lfCharSet

lfCharSet is one of three pre-defined font character sets: ANSI_CharSet, OEM_CharSet, or Symbol_CharSet. Other character sets may be defined.

lfOutPrecision

lfOutPrecision field contains one of the out_ font precision flags; By default, it is out_Default_Precis.

lfClipPrecision

lfClipPrecision specifies the clipping precision of the font, defined by the clip_ font precision flags. The default value is clip_Default_Precis.

lfQuality

lfQuality field contains one of the font quality flags: Default_Quality, Draft_Quality, or Proof_Quality.

lfPitchAndFamily

lfPitchAndFamily is a combination of a font pitch flag (either Default_Pitch, Fixed_Pitch, or Variable_Pitch) and a font family flag (such as ff_Roman or ff_Script).

lfFaceName

lfFaceName holds the name of the font in a null-terminated string. A nil in lfFaceName causes GDI to use a default typeface.


TLogPalette (record)
TLogPalette (record)     (WinTypes unit)

Declaration

TLogPalette = record

   palVersion: Word;

   palNumEntries: Word;

   palPalEntry: array[0..0] of TPaletteEntry;

end;

Remarks

The TLogPalette record holds data to define a logical palette, as used by the CreatePalette function.

Fields

palVersion

palVersion gives the version of Windows for the structure, currently $0300.

palNumEntries

palNumEntries is the number of entries in the palette.

palPalEntry

palPalEntry is an array of TPaletteEntry records, one element for each of the entries in the palette.


TLogPen (record)
TLogPen (record)     (WinTypes unit)

Declaration

TLogPen = record

   lopnStyle: Word;

   lopnWidth: TPoint;

   lopnColor: Longint;

end;

Remarks

The TLogPen record holds the attributes of a logical pen, and is used by the CreatePenIndirect function.

Fields

lopnStyle

lopnStyle holds the pen style, one of the ps_ constants.

lopnWidth

lopnWidth is the width of the pen in logical units.

lopnColor

lopnColor is the pen color.


TMDICreateStruct (record)
TMDICreateStruct (record)     (WinTypes unit)

Declaration

TMDICreateStruct = record

   szClass: PChar;

   szTitle: PChar;

   hOwner: THandle;

   x, y: Integer;

   cx, cy: Integer;

   style: LongInt;

   lParam: LongInt;

end;

Remarks

The TMDICreateStruct record holds data for the creation of an MDI child window.

The lParam parameter of a wm_Create message holds a TCreateStruct record, the lpCreateParams field of which points to a TMDICreateStruct record, provided by a wm_MDICreate message.

Fields

szClass

szClass points to the child window's class.

szTitle

szTitle points to the window title.

hOwner

hOwner is the instance handle of the application that creates the window.

cx, cy, x, and y

cx and cy are the initial width and height.  x and y are the initial x- and y-coordinates of the child window.

A value of cw_UseDefault for any of these results in a default value for that coordinate, width, or height, as appropriate.

style

style holds additional styles for the window, which may be any of the following ws_ window styles: ws_Minimize, ws_Maximize, ws_HScroll, or ws_VScroll.

lParam

lParam is defined by the application.


TMeasureItemStruct (record)
TMeasureItemStruct (record)     (WinTypes unit)

Declaration

TMeasureItemStruct = record

   CtlType: Word;

   CtlID: Word;

   itemID: Word;

   itemWidth: Word;

   itemHeight: Word;

   itemData: Longint;

end;

Remarks

The TMeasureItemStruct record holds the dimensions of an owner-draw control.

A wm_MeasureItem message holds a pointer to a TMeasureItemStruct record in its lParam parameter.

If TMeasureItem fields are not properly filled, owner-draw controls will not work correctly.

Fields

CtlType

CtlType is the control type, designated by one of the odt_ constants.

CtlID

CtlID is the control ID number of the control (not used for menus).

itemID

itemID is the menu-item ID of the item index, depending on the control.

itemWidth and itemHeight

itemWidth and itemHeight hold the width and height of the item, respectively.

itemData

itemData field contains either a owner-draw list-box or combo-box value provided by the cb_AddString, cb_InsertString, lb_AddString, or lb_InsertString message that created the item, or the long integer value given to the menu item in the NewItem parameter of the InsertMenu call that inserted it.

itemData

itemData is undefined for owner-draw buttons.


TMenuItemTemplate (record)
TMenuItemTemplate (record)    (WinTypes unit)

Declaration

TMenuItemTemplate = record

  mtOption: Word;

  mtID: Word;

  mtString: PChar;

end;

Remarks

The TMenuItemTemplate record holds information for a menu item. TMenuItemTemplate records can be strung together to form a list of menu items.

When combined with a TMenuItemTemplateHeader, this list forms a complete menu template.

Fields

mtOption

mtOption contains one of (or a combination of) the mf_ Menu flag constants. These define the type and state of the menu item.

mtlD

mtIDholds an ID code for the menu item. Pop-up menu items (those

that bring up another menu) do not have an mtID field.

mtString

mtString holds a null-terminated string that specifies the name of the menu item.


TMenuItemTemplateHeader (record)
TMenuItemTemplateHeader (record)    (WinTypes unit)

Declaration

TMenuItemTemplateHeader = record

   versionNumber: Word;

   offset: Word;

end;

Remarks

The TMenuItemTemplateHeader serves as the header for a menu template. A complete menu template consists of a header and an item list.

The item list is usually a list of TMenuItemTemplate records.

Fields

versionNumber

versionNumber holds the version number of the menu template. This should be zero.

offset

offset gives the offset (in bytes) of the beginning of the item list, relative to the header.


TMetaFilePict (record)
TMetaFilePict (record)     (WinTypes unit)

Declaration

TMetaFilePict = record

   mm: Integer;

   xExt: Integer;

   yExt: Integer;

   hMF: THandle;

end;

Remarks

The TMetaFilePict record defines the format of the metafile picture used to exchange metafile data through the Clipboard.

Fields

mm

mm holds the mapping mode in which the picture was drawn.

xExt and yExt

xExt and yExt are the width and height of the rectangle in which the picture is drawn, unless the mm_mapping mode is mm_Isotropic or mm_Anisotropic, in which case the fields contain suggested sizes (mm_Anitostropic) or relative sizes (mm_Isotropic).

hMF

hMF is a handle of a memory metafile.


TMetaHeader (record)
TMetaHeader (record)     (WinTypes unit)

Declaration

TMetaHeader = record

   mtType: Word;

   mtHeaderSize: Word;

   mtVersion: Word;

   mtSize: Longint;

   mtNoObjects: Word;

   mtMaxRecord: Longint;

   mtNoParameters: Word;

end;

Remarks

The TMetaHeader record defines the format of the header of a metafile.

A metafile consists of a TMetaHeader record, followed by a list of metafile records, usually of type TMetaRecord.

Fields

mtType

mtType field holds one of two values: 1 indicates that the metafile is in memory, and 2 indicates that the metafile is on a disk.

mtHeaderSize

mtHeaderSize field gives the size of the header, in bytes.

mtVersion

mtVersion is the Windows version number, currently $0300 for version 3.0.

mtSize

mtSize is the size, in words, of the file.

mtNoObjects and mtMaxRecord

mtNoObjects and mtMaxRecord fields indicate the maximum number of objects the metafile can hold and the size (in words) of the largest metafile record.

mtNoParameters

mtNoParameters is not currently used.


TMetaRecord (record)
TMetaRecord (record)     (WinTypes unit)

Declaration

TMetaRecord = record

   rdSize: Longint;

   rdFunction: Word;

   rdParm: array[0..0] of Word;

end;

Remarks

The TMetaRecord record defines a typical metafile record. A list of such records follows the header of a metafile.

Fields

rdSize

rdSize gives the size of the record, in words.

rdFunction

rdFunction is the function number, specified by a meta_ constant.

rdParm

rdParm is an array of Word-type parameters for the function, stored in the reverse order that they will be passed to the function.


TMsg (record)
TMsg (record)     (WinTypes unit)

Declaration

TMsg = record

   hwnd: HWnd;

   message: Word;

   wParam: Word;

   lParam: LongInt;

   time: Longint;

   pt: TPoint;

end;

Remarks

The TMsg record holds message data that gets dispatched to applications by Windows. The information is routed to the appropriate elements (windows) for processing. The various fields contain important information for the application.

Fields

hwnd

hwnd is the handle of the window that receives the message.

message

message is the number of the message.

wParam and lParam

wParam and lParam hold word-length and long-integer-length information for the window. This information varies depending on the value of message.

time

time holds the time at which the message was posted.

pt

pt holds the screen position of the cursor when the message was posted.


TMultiKeyHelp (record)
TMultiKeyHelp (record)     (WinTypes unit)

Declaration

TMultiKeyHelp = record

   mkSize: Word;

   mkKeyList: Byte;

   szKeyPhrase: array[0..0] of Byte;

end;

Remarks

The TMultiKeyHelp record holds an index to a table of key words and a phrase to be searched for, for use by the Windows Help system.

Fields

mkSize

mkSize holds the length of the record.

mkKeyList

mkKeyList is a character that indicates which key-word table should be searched.

szKeyPhrase

szKeyPhrase is a null-terminated string holding the key word to be located.


TOFStruct (record)
TOFStruct (record)     (WinTypes unit)

Declaration

TOFStruct = record

   cBytes: Byte;

   fFixedDisk: Byte;

   nErrCode: Word;

   reserved: array[0..3] of Byte;

   szPathName: array[0..127] of Char;

end;

Remarks

The TOFStruct record holds information on a file, read when the file was opened.

Fields

cBytes

cBytes holds the length of the record.

fFixedDisk

fFixedDisk is non-zero if the file is on a fixed (hard) disk; 0 otherwise.

nErrCode

nErrCode holds the DOS error code if the OpenFile function failed. (OpenFile returns -1 if it fails.)

reserved

reserved holds four bytes, reserved for future Windows use.

szPathName

szPathName is a null-terminated string holding the full path name of the file.


TPaintStruct (record)
TPaintStruct (record)     (WinTypes unit)

Declaration

TPaintStruct = record

   hdc: HDC;

   fErase: Bool;

   rcPaint: TRect;

   fRestore: Bool;

   fIncUpdate: Bool;

   rgbReserved: array[0..15] of Byte;

end;

Remarks

The TPaintStruct record holds information used by an application for painting the client areas of its windows.

Most of the information is reserved for internal use by Windows, but several fields can be used by the user.

Fields

hdc

hdc field is the handle of the display context on which the painting is to occur.

fErase

fErase indicates whether the background has been redrawn; a 0 indicates it has not been redrawn.

rcPaint

rcPaint defines the rectangle in which painting is to take place.

All the other fields are reserved for internal Windows use.


TPaletteEntry (record)
TPaletteEntry (record)     (WinTypes unit)

Declaration

TPaletteEntry = record

   peRed: Byte;

   peGreen: Byte;

   peBlue: Byte;

   peFlags: Byte;

end;

Remarks

The TPaletteEntry record type defines an entry in a logical palette, such as that defined by TLogPalette.

Fields

peRed, peGreen, and peBlue

peRed, peGreen, and peBlue represent the intensities of red, green, and blue, respectively, in the palette entry.

peFlags

peFlags contains information on how the palette is to be used.

It can be 0 or one of the pc_ flags: pc_Explicit, pc_NoCollapse, or pc_Reserved.


TPattern (type)
TPattern (type)     (WinTypes unit)

Declaration

TPattern = TLogBrush;

Remarks

TPattern is another name for TLogBrush.

When a logical brush is used for pattern-filling, you might want to use the TPattern name for clarity.


TPoint (record)
TPoint (record)     (WinTypes unit)

Declaration

TPoint = record

   x: Integer;

   y: Integer;

end;

Remarks

The TPoint record is very simple, but it is also very useful.

It specifies the x- and y-coordinates (in the x and y fields, respectively) of a point on the screen or in a window.


TRect (record)
TRect (record)     (WinTypes unit)

Declaration

TRect = record

   left: Integer;

   top: Integer;

   right: Integer;

   bottom: Integer;

end;

Remarks

The TRect record defines a rectangular region, given its upper left and lower right corners.

Fields

left and top

left and top are the x- and y-coordinates of the upper left corner of the rectangle.

right and bottom

right and bottom are the x- and y-coordinates of the lower right corner.

Note: A rectangle may not exceed 32,768 units in width or height.


TRGBQuad (record)
TRGBQuad (record)     (WinTypes unit)

Declaration

TRGBQuad = record

   rgbBlue: Byte;

   rgbGreen: Byte;

   rgbRed: Byte;

   rgbReserved: Byte;

end;

Remarks

The TRGBQuad record holds RGB color data for use by bitmaps, such as in the bmiColors field of a TBitmapInfo record.

Fields

rgbBlue, rgbGreen, and rgbRed

rgbBlue, rgbGreen, and rgbRed represent the intensities of blue, green, and red, respectively, in the bitmap pixel entry.

rgbReserved

rgbReserved is not used, and must be 0.


TRGBTriple (record)
TRGBTriple (record)     (WinTypes unit)

Declaration

TRGBTriple = record

   rgbtBlue: Byte;

   rgbtGreen: Byte;

   rgbtRed: Byte;

end;

Remarks

The TRGBTriple record specifies RGB color intensities for bitmaps, such as in the bmciColors field of a TBitmapCoreInfo record.

Fields

rgbtBlue, rgbtGreen, and rgbtRed

rgbtBlue, rgbtGreen, and rgbtRed represent the intensities of blue, green, and red, respectively, in the bitmap pixel entry.


TTextMetric (record)
TTextMetric (records)     (WinTypes unit)

Declaration

TTextMetric = record

   tmHeight: Integer;

   tmAscent: Integer;

   tmDescent: Integer;

   tmInternalLeading: Integer;

   tmExternalLeading: Integer;

   tmAveCharWidth: Integer;

   tmMaxCharWidth: Integer;

   tmWeight: Integer;

   tmItalic: Byte;

   tmUnderlined: Byte;

   tmStruckOut: Byte;

   tmFirstChar: Byte;

   tmLastChar: Byte;

   tmDefaultChar: Byte;

   tmBreakChar: Byte;

   tmPitchAndFamily: Byte;

   tmCharSet: Byte;

   tmOverhang: Integer;

   tmDigitizedAspectX: Integer;

   tmDigitizedAspectY: Integer;

end;

Remarks

The TTextMetric record holds numerous fields describing a physical font in units that depend on the display context's mapping mode.

TTextMetric records are used by the GetDeviceCaps and GetTextMetrics functions.

Fields

tmHeight, tmAscent, and tmDescent

tmHeight field is the height of characters in the font, equal to the sum of the ascent (tmAscent) above the baseline and descent (tmDescent) below the baseline.

tmInternalLeading and tmExternalLeading

tmInternalLeading and tmExternalLeading specify the amount of space allowed beyond the range of tmHeight.

tmInternalLeading is space inside the boundary; tmExternalLeading is added between rows of text. Either field may be set to 0.

tmAveCharWidth and tmMaxCharWidth

tmAveCharWidth and tmMaxCharWidth give the average and maximum character widths of characters in the font.

tmWeight

tmWeight is the weight of the font.

tmItalic, tmUnderlined, and tmStruckOut

tmItalic, tmUnderlined, and tmStruckOut, if non-zero, indicate italic, underlined, and strikeout text, respectively.

tmFirstChar, tmLastChar and tmDefaultChar

The range of defined characters in the font is given by tmFirstChar and tmLastChar, with characters outside that range having the character specified in tmDefaultChar substituted for them.

tmBreakChar

tmBreakChar is the character that delineates word breaks for justification purposes.

tmPitchAndFamily and tmCharSet

The pitch, family, and character set of the font are defined by tmPitchAndFamily and tmCharSet.

The lowest-order bit in tmPitchAndFamily determines the pitch of the font: fixed if the bit is clear, variable if the bit is set. The four high-order bits determine the font family, which can be set or checked using the ff_ font family flags.

The character set is set in tmCharSet, using the font character set flags.

tmOverhang

tmOverhang holds the extra width added per string to some fonts that have to be synthesized, such as when making a bold font from a normal font.

tmDigitizedAspectX and tmDigitizedAspectY

The horizontal and vertical aspects of the device for which the font was designed are in the tmDigitizedAspectX and tmDigitizedAspectY fields, respectively.


TWndClass (record)
TWndClass (record)     (WinTypes unit)

Declaration

TWndClass = record

   style: Word;

   lpfnWndProc: TFarProc;

   cbClsExtra: Integer;

   cbWndExtra: Integer;

   hInstance: THandle;

   hIcon: HIcon;

   hCursor: HCursor;

   hbrBackground: HBrush;

   lpszMenuName: PChar;

   lpszClassName: PChar;

end;

Remarks

The TWndClass record holds the attributes of a window class, also known as the registration attributes, as they are registered with the RegisterClass function.

Fields

style

style holds the class style. It can hold one or a combination of the cs_ class style constants.

lpfnWndProc

lpfnWndProc points to the window's window function, the routine that receives and processes messages.

cbClsExtra

cbClsExtra is the number of bytes to be allocated at the end of the TWndClass record.

These are called the class' extra bytes, and can be accessed with the GetWindowLong or GetWindowWord functions, or set with the SetWindowLong or SetWindowWord functions.

cbWndExtra

cbWndExtra gives the number of bytes to allocate at the end of the window instance.

hInstance

hInstance is an instance handle that must indicate the class module. It must not be zero.

hIcon, hCursor, and hbrBackground

hIcon, hCursor, and hbrBackground are the handles of the class' icon and cursor, and the class' background color, respectively.

The background color should be a color value (one of the standard system colors, given by a color_ constant, incremented by 1) or the handle of a brush for painting the background.

If hbrBackground is 0, the application's background must be painted whenever its client area is painted. The need for this can be determined by processing the wm_EraseBkgnd message or by checking the fErase field of the TPaintStruct record created by BeginPaint.

lpszMenuName and lpszClassName

lpszMenuName and lpszClassName both point to null-terminated strings, being the resource name of the class menu and the name of the class, respectively.


WinProcs Unit

The WinProcs unit defines function and procedure headers for the Windows API.

Every routine provided by the standard Windows libraries can be accessed through WinProcs.

Together with the WinTypes unit, WinProcs defines the Turbo Pascal implementation of the Windows API.

See Also

Alphabetical Index of Windows API Procedures and Functions

Categorical Index of Windows API Procedures and Functions


Dynamically-Linked Libraries (DLLs)

In the Windows environment, dynamic-link libraries (DLLs) permit several applications to share code and resources.

A DLL is an executable module (extension .DLL) that contains code or resources that are used by other DLLs or applications.

DLLs provide the ability for two programs ("clients") to share a single copy of a routine they have in common. The .DLL file must be present when the client program runs.

The Turbo Pascal concept closest to a DLL is a unit. However, routines in units are linked into your executable at link time ("statically linked"), whereas DLL routines are made available at run time ("dynamically linked").

The Windows program loader dynamically links the procedure and function calls in the program to their entry points in the DLLs used by the program.

A Turbo Pascal application can use DLLs that were not written in Turbo Pascal. Also, programs written in other languages can use DLLs written in Turbo Pascal.

See Also

Using DLLs

Writing DLLs

Import units


Using DLLs

For a module to use a procedure or function that is in a DLL, the module must import the procedure or function using an external declaration.

In imported procedures and functions, the external directive takes the place of the declaration and statement parts that would otherwise be present.

Imported procedures and functions behave just like normal ones, except they must use the far call model (use a far procedure directive or a {$F+} compiler directive.

Turbo Pascal provides three ways to import procedures and functions:

 -	by name

 -	by new name

 -	by ordinal

Although a DLL can have variables, it is not possible to import them in other modules. Any access to a DLL's variables must take place through a procedural interface.

Example

This external declaration imports the function GlobalAlloc from the DLL called KERNEL (the Windows kernel):

  function GlobalAlloc(Flags: Word; Bytes: Longint): THandle; far; external 'KERNEL' index 15;

Note: The DLL name specified after the external keyword and the new name specified in a name clause don't have to be string literals. Any constant string expression is allowed.

Likewise, the ordinal number specified in an index clause can be any constant integer expression. For example:

  const

    TestLib = 'TESTLIB';

    Ordinal = 5;

  procedure ImportByName;    external TestLib;

  procedure ImportByNewName; external TestLib name 'REALNAME';

  procedure ImportByOrdinal; external TestLib index Ordinal;

See Also

Writing DLLs

Import units


Importing routines from DLLs by name

When you import a routine from a DLL with no index or name clause specified, the procedure or function is imported explicitly by name.

The name used is the procedure's or function's identifier.

Example

Here, the ImportByName procedure is imported from the TESTLIB DLL using the name IMPORTBYNAME:

  procedure ImportByName;    external 'TESTLIB';


Importing routines from DLLs by new name
Importing routines from DLLs by a new name

When you import a routine from a DLL with a name clause specified, the procedure or function is imported by a different name than its identifier.

Example

Here the ImportByNewName procedure is imported from the TESTLIB DLL using the name ANOTHERNAME:

  procedure ImportByNewName; external 'TESTLIB' name 'ANOTHERNAME';


Importing routines from DLLs by ordinal number

When you import a routine from a DLL with an index clause present, the procedure or function is imported by ordinal.

Importing by ordinal reduces the load time of the module, because Windows doesn't have to look up the name in the DLL's name table.

Example

Here, the ImportByOrdinal procedure is imported as the fifth entry point in the DLL called TESTLIB:

  procedure ImportByOrdinal; external 'TESTLIB' index 5;


Import units

You can place declarations of imported procedures and functions directly in the program that imports them.

Usually, though, they are grouped together in an "import unit" that contains declarations for all procedures and functions in a DLL, along with any constants and types required to interface with the DLL.

The WinTypes and WinProcs units are import units.

Import units are not a requirement of the DLL interface, but they do simplify maintenance of projects that use multiple DLLs. Also, when the associated DLL is modified, only the import unit needs updating to reflect the changes.


Writing DLLs

The structure of a Turbo Pascal DLL is identical to that of a program, except that a DLL starts with a library header instead of a program header.

The library header tells Turbo Pascal to produce an executable file with the extension .DLL instead of .EXE. It also ensures that the executable file is marked as being a DLL.

If procedures and functions are to be exported by a DLL, they must be compiled with the export procedure directive.

Example

This implements a very simple DLL with two exported functions:

  library MinMax;

  {The export procedure directive prepares Min and Max for exporting}

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

  begin

    if X < Y then Min := X else Min := Y;

  end;

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

  begin

    if X > Y then Max := X else Max := Y;

  end;

  {The exports clause actually exports the two routines, supplying an optional ordinal number for each of them}

  exports

    Min index 1,

    Max index 2;

  begin

  end.

Libraries often consist of several units. In such cases, the library source file itself is frequently reduced to a uses clause, an exports clause, and the library's initialization code.

For example:

  library Editors;

  uses EdInit, EdInOut, EdFormat, EdPrint;

  exports

    InitEditors index 1,

    DoneEditors index 2,

    InsertText index 3,

    DeleteSelection index 4,

    FormatSelection index 5,

    PrintSelection index 6,

     .

     .

    SetErrorHandler index 53;

  begin

    InitLibrary;

  end.

See Also

Using DLLs

Import units


Resources

Resources are data stored in a program's executable (.EXE) file, but stored separately from the program's normal data segment.

Resources are designed and specified outside the program code, then added to the program's compiled code to create a program's executable file.

These are the resources you will create and use most often:

 -	Bitmaps

 -	Character strings

 -	Dialog boxes

 -	Icons and cursors

 -	Keyboard accelerators

 -	Menus

See Also

Adding Resources to an EXE File

Creating Resources

Loading Resources into an Application

Resource Compiler Command-Line Options

Resource Compiler Hints

Running the Resource Compiler


Creating Resources

With Turbo Pascal, you can create resources using a resource editor or a resource compiler.

You normally create a binary resource file (<FileName>.RES) for each application. This resource file contains binary information for all of the menus, dialogs, bitmaps, and other resources used by your application.

You use the $R <file name> compiler directive to add the binary resource file to your executable file (.EXE) during compilation. The result is a file that contains the application's compiled code and its resources.

You must also write code that loads the resources into memory. Each resource must be loaded into memory separately.

See Also

Adding Resources to an EXE File

Loading Resources into an Application

Resource Compiler Command-Line Options

Resource Compiler Hints

Resources (defined)

Running the Resource Compiler


Adding Resources to an EXE File

There are three ways to add resources to an executable file:

 -	Use the resource editor to copy resources from a .RES file into the program's already-compiled .EXE file.

 -	Specify the $R <file name> directive in the source code file.

Each Pascal program can have only one resource file (although that resource file can include other resource files). All the files must be .RES files that store the resources in binary format.

 -	Use the Microsoft Resource Compiler

See Also

Creating Resources

Loading Resources into an Application

Resource Compiler Command-Line Options

Resource Compiler Hints

Resources (defined)

Running the Resource Compiler


Running the Resource Compiler

The Resource Compiler is a DOS application that

 1)	Takes a resource script file (<FileName>.RC) as input and generates a binary resource file (<FileName>.RES).

 2)	Adds the resources directly to the executable file (this eliminates the need to use the $R <file name> directive).

You can combine both steps to directly modify an existing .EXE file to update the resources. In each case, your Turbo Pascal source code (<FileName>.PAS) must include commands for loading the resources into memory.

You run the Resource Compiler at the DOS prompt or in a DOS window in Windows.

Syntax

{To generate a binary .RES file:}

  RC [options]  <.RC input file>   [.EXE output file]

{To attach the .RES file to the executable file:}

  RC <.RES binary file>

{To directly update the resources in the .EXE file:}

  RC <.RC input file>

Note: Items in square brackets are optional.

See Also

Adding Resources to an EXE File

Creating Resources

Loading Resources into an Application

Resource Compiler Command-Line Options

Resource Compiler Hints

Resources (defined)


Resource Compiler Command-Line Options

Option	Meaning

-r	Create a .RES file

-l	Create an application that uses LIM 3.2 EMS

-e	Create a driver that uses EMS memory

-m	Set multiple instance flag

-p	Create a private library

-t	Create a protected mode only application

-v	Verbose (print progress messages)

-d	Define a symbol

-fo	Rename .RES file

-fe	Rename .EXE file

-i	Add a path for INCLUDE searches

-x	Ignore INCLUDE environment variable

-k	Keep segments in .DEF file order (do not sort segments for fast load)

See Also

Adding Resources to an EXE File

Creating Resources

Loading Resources into an Application

Resource Compiler Hints

Resources (defined)

Running the Resource Compiler


Resource Compiler Hints

These are a few things to note about the Resource Compiler script programming language:

   1)	Comments begin with semicolon (;) and run to the end of the line. You can also use C-style comments (text between /* and */).

   2)	Resource Compiler is not case sensitive with keywords (such as begin and end).

   3)	Resource Compiler is case sensitive to symbolic names (such as cmFileNew and AboutBox).

   4)	Resource Compiler is not sensitive to the use of whitespace.

   5)	You must use the #include directive to include header files of constants. These are defined using the C-style #define command.

   6)	You can use the #rcinclude directive to include other resource script files (*.RC or *.DLG); for example, to include compiled dialog boxes.

   7)	It is best to use symbolic constant names, rather than numbers, for constants such as string IDs, menu command IDs, etc.

These are normally defined using C-style constant definitions in a header file. You will also need to define Pascal constants in your programs to refer to these constants symbolically.

   8)	Each menu item constant command ID and string ID must be unique.

   9)	Menus can be nested arbitrarily (this gives hierarchical menus).

 10)	Inside menu and dialog control items, the ampersand (&) tells the program to underline the next character.

 11)	Inside menu items, the text \t generates a tab character to line up text. This is often used to line up keyboard command equivalents.

 12)	Hot keys must be defined in an accelerator table. The text included in menus does not automatically create accelerators.

 13)	Controls such as static text that are never accessed under program control normally have the ID -1.

 14)	Dialog and control locations are defined in the order Left, Top, Width, Height.

 15)	Menu items, dialogs, and dialog control items, such as scrollbars, edit fields, and buttons, can be modified with Windows-style constants. Add them using the bitwise or operator, which is a vertical bar (|).

 16)	Resource script files must be compiled using the Resource Compiler.

 17)	In most cases it is easier to use a resource editor rather than write complex resoure definitions using script files.

 18)	You must include code in your Turbo Pascal program to load and use the resources.

See Also

Adding Resources to an EXE File

Creating Resources

Loading Resources into an Application

Resource Compiler Command-Line Options

Resources (defined)

Running the Resource Compiler


Loading Resources into an Application

Once a resource has been added to the executable file, the application must explicitly load the resource before using it. The specific way to load a resource depends on the resource type.

Menu Resources

You load menu resources by calling the LoadMenu function with the menu ID string when a new window object is constructed.

Accelerator Resources

Accelerator resources are stored in an accelerator table.

To load an accelerator table, use the LoadAccelerators function, which returns a handle to the table.

 -	Each application can only have one accelerator table.

 -	Application objects reserve one object field, HAccTable, to store a handle to the accelerator resource.

 -	You will usually load the accelerator resource in the application object's InitInstance method:

Dialog-box Resources

Dialog boxes are the only resource type to have directly-corresponding ObjectWindows object types.

TDialog and its descendant types, including TDlgWindow, define interface objects that use dialog box resources.

Each dialog box object is typically associated with one dialog box resource, which specifies its size, location, and assortment of controls, such as buttons and list boxes.

Cursor and Icon Resources

Each window object type has special attributes called registration attributes, including the window's cursors and icons.

To set these attributes for a window type, you must define a method called GetWindowClass and one called GetClassName.

The cursor is specified for one window, while the icon represents the entire application.

(One exception to the one-icon-per-application rule is an application that follows the multiple document interface (MDI) standard, for which each MDI child window has its own icon.)

String Resources

Two principal reasons for defining an application's strings as resources are to make it easy to

1)	customize the application for particular uses, or

2)	translate the application into other languages.

If the strings are defined as resources, they are stored in a string table within the application's executable file.

Each executable file can have only one string table.

To load a string from the string table into a buffer in your application's data segment, use the LoadString function.You can use a string resource to

 -	display text within a message box.

 -	add or append items to a menu in your source code.

Bitmap Resources

The LoadBitmap function loads bitmap resources by loading the bitmap into memory and returning its handle.

Once a bitmap is loaded, it will stay in memory until you explicitly delete it (with DeleteObject)..

Windows supplies predefined bitmaps as part of the Windows graphical interface. Your application can load these bitmaps by substituting 0 for HInstance in the LoadBitmap call:

Once the bitmap is loaded, your application can use it in several principal ways:

 -	To draw a picture on the display.

 -	To create a brush you can use to fill an area of the display or to serve as a window's background.

 -	To display pictures rather than text for menu items or for items in a list box.

See Also

Adding Resources to an EXE File

Creating Resources

Resource Compiler Command-Line Options

Resource Compiler Hints

Resources (defined)

Running the Resource Compiler