Partager via


InternetSetFilePointer

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function sets a file position for InternetReadFile. This is a synchronous call; however, subsequent calls to InternetReadFile might block or return pending if the data is not available from the cache and the server does not support random access.

Syntax

DWORD InternetSetFilePointer(
  HINTERNET hFile,
  LONG lDistanceToMove, 
  PVOID pReserved, 
  DWORD dwMoveMethod, 
  DWORD dwContext
);

Parameters

  • hFile
    [in] Valid HINTERNET handle returned from a previous call to InternetOpenUrl (on an HTTP or HTTPS URL) or HttpOpenRequest (using the GET or HEAD method and passed to HttpSendRequest or HttpSendRequestEx). This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set.
  • lDistanceToMove
    [in] Long integer value that contains the number of bytes to move the file pointer. A positive value moves the pointer forward in the file; a negative value moves it backward.
  • pReserved
    [in] Reserved. Must be set to NULL.
  • dwMoveMethod
    [in] Unsigned long integer value that indicates the starting point for the file pointer move. The following table shows the possible values. This parameter can be one of these values.

    Value Description

    FILE_BEGIN

    Starting point is zero or the beginning of the file. If FILE_BEGIN is specified, lDistanceToMove is interpreted as an unsigned location for the new file pointer.

    FILE_CURRENT

    Current value of the file pointer is the starting point.

    FILE_END

    Current end-of-file position is the starting point. This method fails if the content length is unknown.

  • dwContext
    Reserved. Must be set to zero.

Return Value

Returns the current file position if the function succeeds, or –1 otherwise.

Remarks

This function cannot be used once the end of file has been reached by InternetReadFile.

For HINTERNET handles created by HttpOpenRequest and sent by HttpSendRequestEx, a call to HttpEndRequest must be made on the handle before this function is used.

InternetSetFilePointer cannot be used reliably if the content length is unknown, and with chunked transfers.

Requirements

Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

HttpEndRequest
HttpOpenRequest
HttpSendRequest
HttpSendRequestEx
InternetOpenUrl
InternetReadFile
WinInet Functions

Concepts

About HINTERNET Handles