|
-
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.
-
Nov 3rd, 2002, 01:45 PM
#2
PowerPoster
It looks to me as though you've done everything correctly. What error or problem are you getting?
-
Nov 3rd, 2002, 01:51 PM
#3
Thread Starter
Member
No problems with it, I'm just wondering what the use of it is (lpDistanceToMoveHigh parameter)
-
Nov 3rd, 2002, 01:54 PM
#4
PowerPoster
so you don't think that
I am trying to get this function to work
implies that you did NOT get it to work? I take it from your current comment that it DID work, yes?
-
Nov 3rd, 2002, 02:09 PM
#5
Thread Starter
Member
It just emptys the file (File Size : 0)
oh, I get it... I should've use '0' in place of 'vbNull'. God I'm stoopid
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
|