Advanced PowerBuilder

HomePrevious Lesson: Saving the OLE Control as Another File
Next Lesson: Getting Image From the Database To OLE Control

Linking the OLE Control's Object To a File

Calling LinkTo() allows you to link the OLE object to another object.
String lFileNameWithFullPath, lFileName
Integer lResult
lResult = GetFileOpenName( "Select Document to " + &
              "link from OLE Control", + &
              lFileNameWithFullPath, lFileName, "Doc", &
              "Documents (*.doc), *.doc" ) 
If lResult <> 1 Then Return
lResult = ole_1.LinkTo( lFileNameWithFullPath )
If lResult <> 0 Then
   MessageBox( "File Link Error", lResult )
   Return -1000
End If

To see it in the action, run the application. Select 'Module > OLE Control Examples' menu option. Open a OLE Storage file in the OLE Control by clicking on the Open SubStorage CommandButton and click on the Link CommandButton.
HomePrevious Lesson: Saving the OLE Control as Another File
Next Lesson: Getting Image From the Database To OLE Control