Syntax 6 For opening an OLE storage member into a storage
Description
Opens a member of an open OLE storage and loads it into another
OLE storage object in memory.
Controls
OLE storage objects
Syntax
|
1 |
<span>olestorage</span>.<span>Open</span> ( <span>substoragename</span>, <span>readmode</span>, <span>sharemode</span>, <span>sourcestorage</span> ) |
|
Argument |
Description |
|---|---|
|
olestorage |
The name of a object variable of type |
|
substoragename |
A string specifying the name of the storage |
|
readmode |
A value of the enumerated datatype stgReadMode
|
|
sharemode |
A value of the enumerated datatype stgShareMode
|
|
sourcestorage |
An open OLEStorage object containing substoragename. |
Return Values
Return value
Integer. Returns 0 if it succeeds and
one of the following negative values if an error occurs:
-
-2 The parent storage is not open
-
-3 The member is not found (when opened
for reading) -
-9 Other error
If any argument’s value is null, Open returns null.
Usage
An OLE storage file is structured like a directory. Each OLE
object can contain other OLE objects (substorages) and other data
(streams). You can open the members of an OLE storage belonging
to a server application if you know the structure of the storage.
However, PowerBuilder’s functions for manipulating storages
are provided so that you can build your own storage files for organizing
the OLE objects used in your applications.
The whole file can be an OLE object and substorages within
the file can also be OLE objects. More frequently, the structure
for a storage file you create is a root level that is not an OLE
object but contains independent OLE objects as substorages. Any
level in the storage hierarchy can contain OLE objects or be simply
a repository for another level of substorages.
Opening nested objects
Because you can specify path information within an OLE storage
with a backslash as the separator, you can open a deeply nested
object with a single call to Open. However, there
is no error checking for the path you specify and if the Open fails,
you will not know why. It is strongly recommended that you open
each object in the path until you get to the one you want.
Examples
This example opens the object in the file MYSTUFF.OLE and
loads it into the OLEStorage variable stg_stuff,
as in the previous example. Then it opens the substorage drawing_1 into
a second storage variable. This example does not include code to
close and destroy any of the objects that were opened.
|
1 |
integer result |
|
1 |
OLEStorage stg_stuff, stg_drawing |
|
1 |
|
1 |
stg_stuff = CREATE OLEStorage |
|
1 |
result = stg_stuff.<span>Open</span>("c:ole2mystuff.ole") |
|
1 |
IF result >= 0 THEN |
|
1 |
stg_drawing = CREATE OLEStorage |
|
1 |
result = opest_drawing.<span>Open</span>("drawing_1", & |
|
1 |
stgRead!, stgDenyNone!, stg_stuff) |
|
1 |
END IF |