| Home | Previous Lesson: OLE - PowerBuilder Implementation Next Lesson: Opening a Sub-Storage |
This function comes in lot of flavors. Only the first format is discussed here and other topics are explained in the "OLE Storages and Streams" session. Open opens the specified file in the OLE control. The following example opens an OLE file, however you can open any OLE server file such as a word document, excel spread sheet, etc. and save as a OLE file. All the examples shown in this section are available in the "w_ole_20" window in the OLE2.PBL library.
All the code in the library uses a directory called "c:\workdir". Make sure you have the directory on your computer and unzip the zip file you download into the "c:\workdir" directory.You can run the window and test the functionality, since all the support files are also available with this.
Open the application "object_embedding_n_linking-2_0" from "ole2.pbl" library. Run the application. Select "Module/OLE 2.0 Control Examples" option from the menu. Click on the "Open Doc" CommandButton.
String
lFileNameWithFullPath, lFileName lResult = GetFileOpenName(
"Select Document File " + & If lResult <> 1 Then Return lResult = ole_1.Open(
lFileNameWithFullPath ) |
We are asking the user to select the file to open by calling GetFileOpenName() function. We are then opening that document in the OLE control using Open() function.
| Home | Previous Lesson: OLE - PowerBuilder Implementation Next Lesson: Opening a Sub-Storage |