I am trying to make one File Browser dialog box. I am getting everything fine.
I am using ManagementObjectSercher to search all the drives of the local system. My code
is like this :
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * From Win32_LogicalDisk ");
ManagementObjectCollection queryCollection = query.Get();
return queryCollection;
But with this code I get only the logical drives.
But I need all the contents inside My Computer which we get when we double click My Compuetr Icon e.i CD Drives, Some network drives like GMail Drive, and
may be some shared folders etc.
What query I sholud write for that or is ther any other way. Can anyone help me plz.
Thank You
Craig MurphyPosted Feb 12, 2007, 11:49 AM
You might have more success using the following code snippet:
using System;
using System.IO;
...
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" File type: {0}", d.DriveType);
Console.WriteLine(" Volume label: {0}", d.VolumeLabel);
Console.WriteLine(" File system: {0}", d.DriveFormat);
}
}
HTH