CeOpenStream (EDB)
A version of this page is also available for
4/8/2010
This function opens a stream object on a CEVT_STREAM typed property.
Syntax
HANDLE CeOpenStream(
HANDLE hDatabase,
CEPROPID propid,
DWORD dwMode
);
Parameters
- hDatabase
[in] Handle to the database in which you want to open the stream object.
- propid
[in] Property ID of the property on which to open the stream object. This property must be a CEVT_STREAM type.
dwMode
[in] Access mode. The following are possible values:- GENERIC_READ
Provides read access to the stream. - GENERIC_WRITE
Provides both write and read access to the stream.
- GENERIC_READ
Return Value
A handle to the stream object indicates success. INVALID_HANDLE_VALUE indicates failure. To get extended error information, call GetLastError. The following table shows possible values.
Return Value | Description |
---|---|
ERROR_ACCESS_DENIED |
Indicates one of the following:
|
ERROR_INVALID_HANDLE |
The hDatabase parameter is set to NULL or equal to INVALID_HANDLE_VALUE. |
ERROR_INVALID_PARAMETER |
Indicates one of the following:
|
ERROR_KEY_DELETED |
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. |
ERROR_NO_MORE_ITEMS |
The database from which the stream object was opened had its current row seek position changed. To prevent this, open a stream, perform the operations, and then close the stream object before doing anything else on the parent database. |
Remarks
A stream handle enables efficient reading from and writing to the contents of a stream. A stream can be very large, such as an image or an e-mail attachment, and it is inefficient to load the entire contents of the stream into memory at once. For smaller binary properties, use the CEVT_BLOB or the CEVT_LPWSTR property types.
The database must be positioned at the desired record in which you want to open the stream.
The following stream functions can be used once a stream object is open:
- CeStreamRead (EDB)
- CeStreamWrite (EDB)
- CeStreamSaveChanges (EDB)
- CeStreamSetSize (EDB)
- CeStreamSeek (EDB)
Only one stream can be opened for write access at a time for a database handle. If you open a stream for write access, you must save changes by calling the CeStreamSaveChanges (EDB) function.
A stream that has been created with the flag DB_PROP_COMPRESSED set cannot be opened with a CEVT_STREAM property. Instead, you must use the CeWriteRecordProps (EDB) function.
A stream cannot be read if there is no value assigned to the property. However, the stream can be opened for writing.
If the seek position of the database is changed, the stream handle is abandoned.
The handle returned from this function must be closed with the CloseHandle function.
Requirements
Header | windbase.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
EDB Functions
CeStreamRead (EDB)
CeStreamWrite (EDB)
CeStreamSaveChanges (EDB)
CeStreamSetSize (EDB)
CeStreamSeek (EDB)
CeWriteRecordProps (EDB)