Advanced PowerBuilder

HomePrevious Lesson: Insert Class In the OLE Control
Next Lesson: Inserting an Object In the OLE Control

Inserting an Existing File In the OLE Control

Calling the InsertFile() embeds a copy of the existing object into the control. The following example inserts the specified object.
String lFileNameWithFullPath, lFileName
Integer lResult
lResult = GetFileOpenName( "Select File to Open " + &
        "in OLE Control", lFileNameWithFullPath,lFileName)
If lResult = 0 Then Return
lResult = ole_1.InsertFile( lFileNameWithFullPath )
If lResult <> 0 Then
   MessageBox( "File Insert Error", lResult )
   Return -1000
End If
ole_1.Activate( InPlace! )

Activate() function activates the inserted file, i.e., invokes the OLE Server (The program that created the file).

To see it in the action, run the application. Select 'Module > OLE Control Examples' menu option. Click on the Insert File CommandButton.
HomePrevious Lesson: Insert Class In the OLE Control
Next Lesson: Inserting an Object In the OLE Control