Exact duplicate: Getting the size (free, total) of a Windows Mobile mobile drive using C #
expensive,I know that my problem took a long time, and many of them helped me, but I am new to C # and this is my first application.
Now I read the article:
C # Signature:
[DllImport("coredll.dll", SetLastError=true, CharSet=CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,
out ulong lpFreeBytesAvailable,
out ulong lpTotalNumberOfBytes,
out ulong lpTotalNumberOfFreeBytes);
Code example:
ulong FreeBytesAvailable;
ulong TotalNumberOfBytes;
ulong TotalNumberOfFreeBytes;
bool success = GetDiskFreeSpaceEx("C:\\", out FreeBytesAvailable, out
TotalNumberOfBytes,out TotalNumberOfFreeBytes);
if (!success)
throw new System.ComponentModel.Win32Exception();
Console.WriteLine("Free Bytes Available: {0,15:D}", FreeBytesAvailable);
Console.WriteLine("Total Number Of Bytes: {0,15:D}", TotalNumberOfBytes);
Console.WriteLine("Total Number Of FreeBytes: {0,15:D}", TotalNumberOfFreeBytes);
Now, how do I use this GetDiskFreeSpaceEx function, and should I add a C # signature somewhere?!? and what about coredll.dll?!?
my code looks like this:
FolderInfo = (CONADefinitions.CONAPI_FOLDER_INFO)Marshal.PtrToStructure(Buffer,
typeof(CONADefinitions.CONAPI_FOLDER_INFO));
if (FolderInfo.pstrName[0].ToString() != "C" && level == 0)
{
}
I searched on google but I don’t have enough experience to find out the correct tag
Thnx
source
share