| Home | Previous Lesson: Opening a File in a OLE_20 Control Next Lesson: Insert Class in the OLE Control |
Another flavor of Open() allows you open a sub-storage into the OLE control. OLE 2.0 supports storages and sub-storages. In simple terms, Storages are like DOS file structures. From the operating file structure, the storage file looks like a single file, however, you can have lot other sub-storages within a storage, even though you can't see from the operating system. To open a sub-storage in the OLE control, first we need to open the storage file into a variable of type OLEStorage and you can use that variable as the argument for the Open() for the OLE control.
To see it in the action, run the application. Select "Module/OLE 2.0 Control Examples" option from the menu. Click on the "Open SubStorage" CommandButton.
The following example, opens the storage file 'OLE_TEST.OLE' into the ole storage file iOLEStorage. The next line opens 'OLE_TEST.XLS' which is stored in the storage file 'OLE_STORAGE.OLE' into the OLE control. More on storages, sub-storages and streams in the next session.
Integer lResult, i lResult = iOLEStorage.Open( "c:\workdir\ole_test.ole" ) lResult = ole_1.Open(
iOLEStorage, "ole_test.xls" ) |
| Home | Previous Lesson: Opening a File in a OLE_20 Control Next Lesson: Insert Class in the OLE Control |