Syntax 7 For opening OLE streams
Description
Opens a stream in an open OLE storage object and loads it
into an OLE stream object.
Controls
OLE stream objects
Syntax
1 |
<span>olestream</span>.<span>Open</span> ( <span>sourcestorage</span>, <span>streamname</span> {, <span>readmode</span> {, <span>sharemode</span> } } ) |
Argument |
Description |
---|---|
olestream |
The name of a object variable of type |
sourcestorage |
An OLE storage that contains the stream |
streamname |
A string specifying the name of the stream |
readmode |
A value of the enumerated datatype stgReadMode
|
sharemode |
A value of the enumerated datatype stgShareMode
|
Return Values
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 |
integer result |
1 |
boolean str_found |
1 |
OLEStorage stg_stuff |
1 |
OLEStream mystream |
1 |
1 |
stg_stuff = CREATE OLEStorage |
1 |
result = stg_stuff.<span>Open</span>("c:ole2mystuff.ole") |
1 |
IF result < 0 THEN RETURN |
1 |
1 |
result = stg_stuff.MemberExists("info", str_found) |
1 |
IF result < 0 THEN RETURN |
1 |
1 |
IF str_found THEN |
1 |
mystream = CREATE OLEStream |
1 |
result = mystream.<span>Open</span>(stg_stuff, "info", & |
1 |
stgRead!, stgDenyNone!) |
1 |
IF result < 0 THEN RETURN |
1 |
END IF |