Hi everyone,
I am working in VB.NET 1.0. I am trying to use the Windows API function GetFileSize. It's a bit of a long story why I must use this function, rather then the built-in .NET System.IO.FileI nfo.Length property. I have the function declared as follows:
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
<DllImport("ker nel32", EntryPoint:="Ge tFileSize", SetLastError:=T rue, _
ExactSpelling:= True, CallingConventi on:=CallingConv ention.StdCall) _
Shared Function GetFileSize(ByV al hFile As IntPtr, ByRef lpFileSizeHigh As Integer) As Integer
End Function
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
I am calling the function as follows:
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
Dim loworder As Integer
Dim highorder As Integer
loworder = GetFileSize(hfi le, highorder)
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
The function works as long as the file size is under 6 GB. When the file size is over 6 GB, highorder is still 1. For example for a 7.56 GB file, highorder is still 1, and lowerder -450 MB or so. In this example, highorder wants to be 2, but I am just not getting that from the function. I must be missing something obvious. Am using the wrong datatypes?
Thanks!
I am working in VB.NET 1.0. I am trying to use the Windows API function GetFileSize. It's a bit of a long story why I must use this function, rather then the built-in .NET System.IO.FileI nfo.Length property. I have the function declared as follows:
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
<DllImport("ker nel32", EntryPoint:="Ge tFileSize", SetLastError:=T rue, _
ExactSpelling:= True, CallingConventi on:=CallingConv ention.StdCall) _
Shared Function GetFileSize(ByV al hFile As IntPtr, ByRef lpFileSizeHigh As Integer) As Integer
End Function
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
I am calling the function as follows:
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
Dim loworder As Integer
Dim highorder As Integer
loworder = GetFileSize(hfi le, highorder)
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
The function works as long as the file size is under 6 GB. When the file size is over 6 GB, highorder is still 1. For example for a 7.56 GB file, highorder is still 1, and lowerder -450 MB or so. In this example, highorder wants to be 2, but I am just not getting that from the function. I must be missing something obvious. Am using the wrong datatypes?
Thanks!
Comment