CeStreamSeek (EDB) (Windows CE 5.0)

Send Feedback

This function is used to change the current seek position of an opened stream.

This function does not work with CEDB databases. For more information about CEDB, see CEDB Reference.

BOOL CeStreamSeek(HANDLEhStream,DWORDcbMove,DWORDdwOrigin,LPDWORDlpcbNewOffset);

Parameters

  • hStream
    [in] A handle to the stream object. The handle is obtained by using the CeOpenStream (EDB) function.
  • cbMove
    [in] The number of bytes to move the current seek position. The amount moved is relative to the origin specified by dwOrigin.
  • dwOrigin
    [in] Specifies the origin from which to seek. Valid values for this parameter are defined by the STREAM_SEEK type, and can be one of the following:
    • STREAM_SEEK_SET

      The new seek position is an offset relative to the beginning of the stream. In this case, the cbMove parameter is the new seek position relative to the beginning of the stream.

    • STREAM_SEEK_CUR

      The new seek position is an offset relative to the current seek position. In this case, the cbMove parameter is the signed displacement from the current seek position. You must cast cbMove to a LONG.

    • STREAM_SEEK_END

      The new seek position is an offset relative to the end of the stream. In this case, the cbMove parameter is the new seek position relative to the end of the stream.

  • lpcbNewOffset
    [out] On successful return, contains the new seek position of the stream as a byte offset from the beginning of the stream. The value can be NULL.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists possible values returned by GetLastError:

Return Value Description
ERROR_INVALID_PARAMETER Indicates that dwOrigin is not a valid STREAM_SEEK type.
ERROR_INVALID_HANDLE Indicates that hStream 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 only happen 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_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.

Remarks

For performance reasons, changing the seek position does not cause an attempt to read data.

It is possible for a call to this function to succeed, but then subsequent functions that use the seek position to access the data may fail. For example, if the stream was 100 bytes in length, then a stream seek to 200 would succeed, but a later operation would fail.

This function can be used to obtain the size of a stream. To do so, use STREAM_SEEK_END, with a value of 0 for the cbMove parameter. On return, lpcbNewOffset contains the size of the stream.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Windbase.h.
Link Library: Coredll.lib.

See Also

CeOpenStream (EDB)

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.