CeOpenStream (EDB) (Windows CE 5.0)
This function is used to open a stream object on a CEVT_STREAM typed property.
This function does not work with CEDB databases. For more information about CEDB, see CEDB Reference.
[in] A handle to the database that is positioned on the desired row in which you want to open the stream object.
[in] The property ID of the property on which to open the stream object. This property must be a CEVT_STREAM type.
[in] The access mode, which can be either of the following flags:
Provides read access to the stream.
Provides both write and read access to the stream.
A handle to the stream object indicates success; a return value of INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError. The following table lists possible values returned by GetLastError:
|ERROR_INVALID_PARAMETER||Indicates one of the following:
|ERROR_INVALID_HANDLE||Indicates that hDatabase is NULL or equal to INVALID_HANDLE_VALUE.|
|ERROR_KEY_DELETED||Indicates that the parent row of the stream object has been deleted. This can happen only if the stream object was opened for read access. When a stream is opened for write access, the parent row is locked for write access, which prevents the row from being deleted.|
|ERROR_ACCESS_DENIED||Indicates one of the following:
|ERROR_NO_MORE_ITEMS||Indicates that the database from which the stream object was opened had its current row seek position changed. To prevent this, you should open a stream, perform the operations, and then close the stream object before doing anything else on the parent database.|
A stream handle allows you to efficiently read and write the contents of a stream-typed property. A stream-typed property can be very large, such as an image or an e-mail attachment, and it would be inefficient to load the entire contents of the stream into memory at once. For smaller binary properties, you should use the CEVT_BLOB or the CEVT_LPWSTR typed property.
The database must be positioned on the desired row in which you want to open the stream.
The following stream functions can be used once a stream object is opened:
- CeStreamRead (EDB)
- CeStreamWrite (EDB)
- CeStreamSaveChanges (EDB)
- CeStreamSetSize (EDB)
- CeStreamSeek (EDB)
Only one stream can be opened for write access at a time for a single database handle. If you open a stream for write access, you must remember to save the changes that you have made to the stream by calling the CeStreamSaveChanges function.
A stream that has been created with the flag DB_PROP_COMPRESSED can't be opened on a CEVT_STREAM property. Instead, you must use the CeWriteRecordProps (EDB) function.
A stream can't be opened for read if there is no value assigned to the property. However, the stream can be opened for write.
If the seek position of the database is changed, then the stream handle is abandoned.
The handle returned from this function must be closed by using the CloseHandle function.
OS Versions: Windows CE 5.0 and later.
Link Library: Coredll.lib.
Send Feedback on this topic to the authors