|
-
Nov 3rd, 2002, 01:27 PM
#1
Thread Starter
Member
SetFilePointer
I'm trying to use this API function as an alternative to Seek.
I am a bit puzzled by two parameters:
lDistancetoMove
lDistancetoMoveHigh
In what circumstances would I use the lDistancetoMoveHigh parameter? I'm guessing it's for use when you want to seek to a very high position in the file. In which case, how would I call the function to get to (for example) position 20,000,000 in a file?
[EDIT]
I'm going to try to be move specific. I am trying to get this function to work:
Private Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As Long
Private Declare Function SetEndOfFile Lib "kernel32" (ByVal hFile As Long) As Long
Private Sub TruncateFile(FilePath As String, EndPosition As Long)
Dim fHandle As Long
fHandle = CreateFile(FilePath, GENERIC_WRITE, 0, vbNull, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, vbNull)
SetFilePointer fHandle, EndPosition, 0, 0
SetEndOfFile fHandle
End Sub
Notice that I don't use the lDistancetoMoveHigh parameter. Can someone help me get this to work?
Last edited by CactusCat; Nov 3rd, 2002 at 01:34 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|