Partager via


CeStreamSeek (EDB)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function changes the current seek position of an open stream.

Syntax

BOOL CeStreamSeek(
  HANDLE hStream,
  DWORD cbMove,
  DWORD dwOrigin,
  LPDWORD lpcbNewOffset
);

Parameters

  • hStream
    [in] Handle to the stream object. The handle is obtained with the CeOpenStream (EDB) function.
  • cbMove
    [in] Number of bytes to move the current seek position relative to the origin specified by the dwOrigin parameter.
  • 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_CUR
      The new seek position is an offset relative to the current seek position. In this case, cbMove is the signed displacement from the current seek position. You must cast cbMove ** to a LONG value.
    • STREAM_SEEK_END
      The new seek position is an offset relative to the end of the stream. In this case, cbMove is the new seek position relative to the end of the stream.
    • STREAM_SEEK_SET
      The new seek position is an offset relative to the beginning of the stream. In this case, cbMove is the new seek position relative to the beginning 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 set to NULL.

Return Value

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

Return Value Description

ERROR_INVALID_HANDLE

The hStream parameter is set to NULL or equal to INVALID_HANDLE_VALUE.

ERROR_INVALID_PARAMETER

The dwOrigin parameter is not a valid STREAM_SEEK type.

ERROR_KEY_DELETED

The parent record 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 record is locked for write access, which prevents the row from being deleted.

ERROR_NO_MORE_ITEMS

The database from which the stream object was opened had its seek position changed. To prevent this, open a stream, perform the operations, and then close the stream object before doing anything else in 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 to fail. For example, if the stream was 100 bytes in length, 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 cbMove set to zero. On return, lpcbNewOffset contains the size of the stream.

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
CeOpenStream (EDB)