Handle Data Type

Purpose

A 32-bit integral data type.

Example

Dim name As Handle

Description

A Handle occupies 32 bit (4 bytes). It doesn't have a type declaration character.

The Handle data type is meant to store values that identify an object; an indirect reference to an operating system resource. Often a handle is a number assigned to a window that is used by the operating system to keep track of the attributes of the window. But a handle can also be a pointer to memory, a number identifying an opened file, etc.

Although the Handle data type is a 32-bit integer, it cannot be used in arithmetic operations. This provides some security against writing. A Handle can be assigned to another data type, however that would undo its purpose.

In the same way, a value can be assigned to a Handle. A conversion is made using CHandle().

Example

Dim h As Handle

h = _File(# 1)

If h != Null

h ++       // Error: Operation not allowed on Handle

EndIf

See Also

Boolean, Byte, Card, Short, Word, Int16, Long, Int, Integer, Int32, Int64, Large, Single, Double, Currency, Date, Handle, String, Variant, Object

{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}