15.2 LPTPort Object

The entry point to LPTPort properties and methods.

15.2.1 BytesWritten property

Returns the number of bytes written in the previous Write operation.

Syntax

 object.BytesWritten
 

Type

Long.

Attributes

Read-only.

Example

This example returns the number of bytes written in the previous Write operation.

 Set Lpt=createobject ("UCX:LPTPort") 
 Lpt.port = LPT1 
 Lpt.open() 
 if(Lpt.Ready) then 
      Lpt.Write("Once again, NetWare leads the way") 
      print(Lpt.BytesWritten) 
 endif
 Lpt.Close()
 

See Also

15.2.2 Port property

Sets or returns the port number of the printer.

Syntax

 object.Port[=Number As Integer]
 

Type

Integer.

Attributes

Read/write.

Remarks

Number is an optional parameter that sets the printer's port number.

Example

The Example returns the prot number of the printer.

15.2.3 Ready property

Determines whether or not the LPT port is ready.

Syntax

 object.Ready
 

Type

Boolean.

Attributes

Read-only.

Example

The Example returns TRUE if LPT1 is ready; otherwise, FALSE.

15.2.4 Close method

Closes a parallel port.

Syntax

 object.Close()
 

Parameters

None.

Return Values

Boolean. Returns TRUE if the Close operation is successful; otherwise, FALSE.

Remarks

This property closes the parallel port that was opened by the Open method. If Close is not called, the object destructor will close the parallel port.

Example

The Example closes the parallel port LPT1.

15.2.5 Open method

Opens the parallel port specified by the Port property.

Syntax

 object.Open()
 

Parameters

None.

Return Values

Boolean. Returns TRUE if the Open operation is successful; otherwise, FALSE.

Remarks

The port number is specified by the Port property. When the data transfer is finished, the Close method must be issued to properly close the parallel port. The port number cannot be changed in between.

Example

The Example opens the parallel port LPT1.

15.2.6 Write method

Writes to a parallel port.

Syntax

 object.Write(
    Data As String)
 

Parameters

Data
The data to be written to the parallel port.

Return Values

Boolean. Returns TRUE if the Write operation is successful; otherwise, FALSE.

Remarks

This property writes to the parallel port that was opened by the Open method.

Example

The Example writes the data "Once again, NetWare leads the way" to parallel port LPT1.