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.
Applies to
OLE storage objects
Syntax
1 |
olestorage.Open ( substoragename, readmode, sharemode, sourcestorage ) |
Argument |
Description |
---|---|
olestorage |
The name of a object variable of type OLEStorage |
substoragename |
A string specifying the name of the storage member |
readmode |
A value of the enumerated datatype stgReadMode that
|
sharemode |
A value of the enumerated datatype stgShareMode
|
sourcestorage |
An open OLEStorage object containing |
Return value
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 2 3 4 5 6 7 8 9 10 |
integer result OLEStorage stg_stuff, stg_drawing stg_stuff = CREATE OLEStorage result = stg_stuff.Open("c:ole2mystuff.ole") IF result >= 0 THEN stg_drawing = CREATE OLEStorage result = opest_drawing.Open("drawing_1", & stgRead!, stgDenyNone!, stg_stuff) END IF |
See also