DisconnectObject

Description

Releases any object that is connected to the specified OLEObject variable.

Applies to

OLEObject objects

Syntax

oleobject.DisconnectObject ( )

Argument

Description

oleobject

The name of an OLEObject variable that you want to disconnect from an OLE object. You cannot specify an OLEObject that is the Object property of an OLE control.


Return value

Integer.

Returns 0 if it succeeds and one of the following negative values if an error occurs:

-1 -- Invalid call: the argument is the Object property of a control

-9 -- Other error

If oleobject is null, DisconnectObject returns null.

Usage

The OLEObject variable is used for OLE automation, in which the PowerBuilder application asks the server application to manipulate the OLE object programmatically.

For more information about OLE automation, see ConnectToObject.

Examples

This example creates an OLEObject variable and connects it to a new Excel object; then after some unspecified code, it disconnects:

integer result
OLEObject myoleobject
 
myoleobject = CREATE OLEObject
result = myoleobject.ConnectToNewObject( &
    "excel.application")
. . .
result = myoleobject.DisconnectObject()

See also

ConnectToObject

ConnectToNewObject