Releases any object that is connected to the specified OLEObject variable.
OLEObject objects
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. |
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.
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.
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()