Here is what I have, I am not getting back any values all are returned as
zero. But it seems to me that the call is not running at all. what am i
doing wrong or missing?
public class WinApi
{
[DllImport("kern el32.dll", SetLastError=tr ue, CharSet=CharSet .Auto)]
public static extern bool GetDiskFreeSpac eEx(
[MarshalAs(Unman agedType.LPTStr )] string lpDirectoryName ,
[MarshalAs(Unman agedType.U8)] long lpFreeBytesAvai lable,
[MarshalAs(Unman agedType.U8)] long lpTotalNumberOf Bytes,
[MarshalAs(Unman agedType.U8)] long lpTotalNumberOf FreeBytes);
}
protected void GetFreeSpace()
{
long lFreeBytes = 0;
long lTotBytes = 0;
long lTotFreeBytes = 0;
string sDir = "C:\\";
bool bOk = WinApi.GetDiskF reeSpaceEx(sDir , lFreeBytes, lTotBytes,
lTotFreeBytes);
if (bOk)
Console.Write(l FreeBytes.ToStr ing());
}
zero. But it seems to me that the call is not running at all. what am i
doing wrong or missing?
public class WinApi
{
[DllImport("kern el32.dll", SetLastError=tr ue, CharSet=CharSet .Auto)]
public static extern bool GetDiskFreeSpac eEx(
[MarshalAs(Unman agedType.LPTStr )] string lpDirectoryName ,
[MarshalAs(Unman agedType.U8)] long lpFreeBytesAvai lable,
[MarshalAs(Unman agedType.U8)] long lpTotalNumberOf Bytes,
[MarshalAs(Unman agedType.U8)] long lpTotalNumberOf FreeBytes);
}
protected void GetFreeSpace()
{
long lFreeBytes = 0;
long lTotBytes = 0;
long lTotFreeBytes = 0;
string sDir = "C:\\";
bool bOk = WinApi.GetDiskF reeSpaceEx(sDir , lFreeBytes, lTotBytes,
lTotFreeBytes);
if (bOk)
Console.Write(l FreeBytes.ToStr ing());
}
Comment