Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter ThreeData Types and Operators (continued)

CloseHandle Function

Overview

The CloseHandle function takes a valid, open handle and closes it.

Syntax/Parameters

Syntax

int = CloseHandle ( handle handle );

Parameters

handle

A handle value retrieved from a function such as OpenFile or LogCreate.

Return Value

Returns an int as ERROR_NONE if the function succeeds or ERROR_INVALID_HANDLE if handle is invalid.

Remarks

The CloseFile and CloseHandle functions are essentially the same. Each takes a valid, open handle and performs the necessary cleanup to ‘close’ a handle. In the case of a basic file or mapped text object, the file is released and available for use by other processes, users, or elsewhere within the program.

If an object was opened within a function as a locally defined variable, the handle will automatically be closed when function returns. Likewise, the script automatically closes and releases objects on exit. Good coding practices suggest the use of the CloseHandle function to be clear to readers regarding the programmer’s intention.

The action of closing a handle will not generally save the state of the object or the data. It will also not warn of unsaved or changed data.

Related Functions

Base Legato

ClipboardCreate — Empties the clipboard and returns a clipboard handle.

CloseFile — Closes file (handle). Same as CloseHandle.

CreateFile — Creates a basic file with optional access mode and characteristics.

CreateMappedTextFile — Creates a file and then opens it as a Mapped Text Object.

CSVCreate — Creates a CSV Object for reading and writing comma-separated data.

DataObjectCreate — Creates a Data Object.

DataSheetCreate — Creates a data sheet object with optional rows and columns.

FTPOpenConnection — Opens an FTP connection with optional user name, password, port and passive mode flag.

GetEditObject — Gets an Edit Object and associates it with an edit window.

GetFirstFile — Gets the first file in a series of matching of files.

HTTPOpenConnection — Sets up for a connection to a specific server for HTTP traffic.

IsValidHandle — Tests a handle value as being a valid Legato object handle.

LogCreate — Creates a general log object with an optional log name and target filename base.

OpenFile — Opens the specified file as a Basic File Object.

OpenMappedTextFile — Opens the specified file as a Mapped Text Object.

PoolCreate — Creates a String Pool Object (SPO) and optionally loads the pool with a string.

WordParseCreate — Creates a Word Parse Object with options.

ZipCreate — Creates an empty Zip Object.

In addition, other modules and extensions may create handles.

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic