C#

[C#/PDA]디스크 용량 구하기 예제

선영아 사랑해 2016. 3. 4. 14:56

PDA(WIN CE/WINDOWS MOBILE)의 디스크 용량 정보 구하는 API입니다.



[System.Runtime.InteropServices.DllImport("coredll", SetLastError = true)]
static extern bool GetDiskFreeSpaceEx(string directoryName, ref long freeBytesAvailable, ref long totalBytes, ref long totalFreeBytes);


private void button_Click(object sender, EventArgs e)

{

long freeBytesAvailable = 0, totalBytes = 0, totalFreeBytes = 0;


if (GetDiskFreeSpaceEx("\\Application", ref freeBytesAvailable, ref totalBytes, ref totalFreeBytes))
{
       MessageBox.Show(freeBytesAvailable + "\n" + totalBytes + "\n" + totalFreeBytes);
}

}