Syntax 6: For opening an OLE storage member into a storage – PB Docs 2017

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

Argument

Description

olestorage

The name of a object variable of type OLEStorage
into which you want to load the OLE object.

substoragename

A string specifying the name of the storage member
within sourcestorage that you want to open. Note the reversed
order of the sourcestorage and substoragename arguments from
Syntax 4.

readmode

A value of the enumerated datatype stgReadMode that
specifies the type of access you want for substoragename. Values
are:

  • stgReadWrite! — Read/write access. If the member
    does not exist, Open creates it.

  • stgRead! — Read-only access. You cannot change
    substoragename.

  • stgWrite! — Write access. You can rewrite
    substoragename but not read its current contents. If the
    member does not exist, Open creates it.

sharemode

A value of the enumerated datatype stgShareMode
that specifies how other attempts, by your own or other
applications, to open substoragename will fare. Values
are:

  • stgExclusive! — (Default) No other attempt to open
    substoragename will succeed.

  • stgDenyNone! — Any other attempt to open
    substoragename will succeed.

  • stgDenyRead! — Other attempts to open
    substoragename for reading will fail.

  • stgDenyWrite — Other attempts to open
    substoragename for writing will fail.

sourcestorage

An open OLEStorage object containing
substoragename.

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.

See also

Close

Save

SaveAs


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x