dim fdata() as byte open "e:\1.dat" for binary as #1redim fdate(200-1) get #1,1,fdataredim fdate(400-1) get #1,,fdataredim fdate(300-1) get #1,,fdataclose #1
Dim aChunkSizes() as Byte Dim readRtn as long 'hFile 是你的文件handle,用CreateFile API得到 SetFilePointer hFile, 0&, 0&, 0& ReDim aChunkSizes(0 To 199) ReadFile hFile, aChunkSizes(0), 200, readRtn, ByVal 0& If readRtn=200 then Debug.Print "Read First part successfully" '你的后续处理程序在这里处理 Else CloseHandle hFile Exit Sub End IfReDim aChunkSizes(0 To 399) ReadFile hFile, aChunkSizes(0), 400, readRtn, ByVal 0& If readRtn=400 then Debug.Print "Read 2nd part successfully" '你的后续处理程序在这里处理 Else CloseHandle hFile Exit Sub End IfReDim aChunkSizes(0 To 299) ReadFile hFile, aChunkSizes(0), 300, readRtn, ByVal 0& If readRtn=300 then Debug.Print "Read Last part successfully" '你的后续处理程序在这里处理 Else CloseHandle hFile Exit Sub End IfIf Not hFile = 0& then CloseHandle hFile
open "e:\1.dat" for binary as #1redim fdate(200-1)
get #1,1,fdataredim fdate(400-1)
get #1,,fdataredim fdate(300-1)
get #1,,fdataclose #1
Dim readRtn as long
'hFile 是你的文件handle,用CreateFile API得到
SetFilePointer hFile, 0&, 0&, 0&
ReDim aChunkSizes(0 To 199)
ReadFile hFile, aChunkSizes(0), 200, readRtn, ByVal 0&
If readRtn=200 then
Debug.Print "Read First part successfully"
'你的后续处理程序在这里处理
Else
CloseHandle hFile
Exit Sub
End IfReDim aChunkSizes(0 To 399)
ReadFile hFile, aChunkSizes(0), 400, readRtn, ByVal 0&
If readRtn=400 then
Debug.Print "Read 2nd part successfully"
'你的后续处理程序在这里处理
Else
CloseHandle hFile
Exit Sub
End IfReDim aChunkSizes(0 To 299)
ReadFile hFile, aChunkSizes(0), 300, readRtn, ByVal 0&
If readRtn=300 then
Debug.Print "Read Last part successfully"
'你的后续处理程序在这里处理
Else
CloseHandle hFile
Exit Sub
End IfIf Not hFile = 0& then CloseHandle hFile