FSO vs. System.IO ??

  • Thread starter Thread starter Rob R. Ainscough
  • Start date Start date
R

Rob R. Ainscough

FSO appears to provide more information -- specifically about the type of drive (i.e. floppy vs. hard drive vs. network drive vs. removable drive i.e. CD-ROM/DVD) than the System.IO .NET framework approach unless I just can't find the properties and/or method I need to get the information about a drive?

I'm trying to use

System.IO.Directory.GetLogicalDrives

I get the drives, but I can't seem to get any info about the drive like I could get with the FSO (File System Object) approach I used in VB6.

Thanks, Rob.
 
Hi Rob,

It's bad to use FSO because it's unmanaged... you are however
(unfortunately) correct when you say you cannot derive drive types etc from
it... and you will have to resort to the Windows API for this.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations

FSO appears to provide more information -- specifically about the type of
drive (i.e. floppy vs. hard drive vs. network drive vs. removable drive i.e.
CD-ROM/DVD) than the System.IO .NET framework approach unless I just can't
find the properties and/or method I need to get the information about a
drive?

I'm trying to use

System.IO.Directory.GetLogicalDrives

I get the drives, but I can't seem to get any info about the drive like I
could get with the FSO (File System Object) approach I used in VB6.

Thanks, Rob.
 
* "Rob R. Ainscough said:
FSO appears to provide more information -- specifically about the type of drive (i.e. floppy vs. hard drive
vs. network drive vs. removable drive i.e. CD-ROM/DVD) than the System.IO .NET framework approach unless I just
can't find the properties and/or method I need to get the information about a drive?

There are no classes about drives. The next release of the .NET
Framework will include a 'DriveInfo' class.

You can determine the type of a drive like this:

<http://www.mvps.org/dotnet/dotnet/code/filesystem/index.html#bkm1>
(Text is written in German, code in VB.NET)
 
Hi Rob,

I once changed the function from Herfried a little I thought, so as addition to his link, it is another approach to the same.

\\\needs a reference to system.management
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" _
)
Dim diskProperty As PropertyData
For Each diskProperty In disk.Properties
Console.WriteLine( _
"{0} = {1}", _
diskProperty.Name, diskProperty.Value _
)
Next diskProperty
///

Cor
 
* "Tom Spink said:
It's bad to use FSO because it's unmanaged... you are however
(unfortunately) correct when you say you cannot derive drive types etc from
it... and you will have to resort to the Windows API for this.

ACK. P/invoke on 'GetDriveType' or WMI (see my other post).
 
Thanks folks,

Unmanaged is the only way -- bummer. I was trying to keep everything
managed but the more I get into VB.NET with the requirements of my
project, the more I see it is pretty hard to stay "managed only".

Any word on when the next .NET Framework?

Thanks, Rob.
 
* (e-mail address removed)-spam.invalid (Robains) scripsit:
Unmanaged is the only way -- bummer. I was trying to keep everything
managed but the more I get into VB.NET with the requirements of my
project, the more I see it is pretty hard to stay "managed only".

Any word on when the next .NET Framework?

2H 2004.
 
Back
Top