Syntax 7: For opening OLE streams
Description
Opens a stream in an open OLE storage object and loads it into an
OLE stream object.
Applies to
OLE stream objects
Syntax
1 |
olestream.Open ( sourcestorage, streamname {, readmode {, sharemode } } ) |
Argument |
Description |
---|---|
olestream |
The name of a object variable of type OLEStream |
sourcestorage |
An OLE storage that contains the stream to be |
streamname |
A string specifying the name of the stream within |
readmode (optional) |
A value of the enumerated datatype stgReadMode that
|
sharemode (optional) |
A value of the enumerated datatype stgShareMode
|
Return value
Integer.
Returns 0 if it succeeds and one of the following negative values
if an error occurs:
-1 — Stream not found
-2 — Stream already exists
-3 — Stream is already open
-4 — Storage not open
-5 — Access denied
-6 — Invalid name
-9 — Other error
If any argument’s value is null, Open returns null.
Examples
This example opens the object in the file MYSTUFF.OLE and loads it
into the OLEStorage variable stg_stuff. Then it checks whether a stream
called info exists in the OLE object, and if so, opens it with read
access. 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 11 12 13 14 15 16 17 18 |
integer result boolean str_found OLEStorage stg_stuff OLEStream mystream stg_stuff = CREATE OLEStorage result = stg_stuff.Open("c:ole2mystuff.ole") IF result < 0 THEN RETURN result = stg_stuff.MemberExists("info", str_found) IF result < 0 THEN RETURN IF str_found THEN mystream = CREATE OLEStream result = mystream.Open(stg_stuff, "info", & stgRead!, stgDenyNone!) IF result < 0 THEN RETURN END IF |
See also