storage cards?

K

Katie

Hi,

I use FileAttributes.Temporary with the compact framework to find storage
cards (SD & CF .) on a Pocket PC. However, using FileAttributes.Temporary
doesn't work using the regular .NET Framework on my desktop PC. Does anyone
know how I can determine if a drive on the desktop PC is a removable card?



Thanks
 
P

Peter Foot [MVP]

On the desktop you can use Environment.GetLogicalDrives to return an array
of all physical drives on the PC. However I'm not sure of a way to determine
whether a drive is removable or not from the desktop framework.

Peter
 
A

Alex Feinman [MVP]

On the desktop you need to PInvoke GetDriveType()

if ( GetDriveType(@"E:\") == DriveType.DRIVE_REMOVABLE)
{
....
}
[DllImport("kernel32")]DriveType GetDriveType( string lpRootPathName );enum DriveType{ DRIVE_UNKNOWN =0, DRIVE_NO_ROOT_DIR =1, DRIVE_REMOVABLE =2, DRIVE_FIXED =3, DRIVE_REMOTE =4, DRIVE_CDROM =5, DRIVE_RAMDISK =6}
 
K

Katie

Thanks peter.

I found that i can use the COM FileSystemObject and Drives.DriveType to get
removable info but i would rather not use COM if i can get the same
information using the framework.

If i find the answer i will let you know

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top