|
-
Apr 23rd, 2004, 12:03 PM
#1
how can I figure out the "type" of a drive?
I want to know whether a drive is a cdrom, network, hdd, etc...
I think I did it a long time ago with APIs, but wondering if .NET has any methods to get information about this?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 23rd, 2004, 12:08 PM
#2
Frenzied Member
use FSO (faster)
or use WMI
-
Apr 23rd, 2004, 12:11 PM
#3
Originally posted by kovan
use FSO (faster)
or use WMI
hmm can you explain a bit more? are you talking about the IO.FileSystemInfo class?I remember somethign about that nasty fso in vb6, but dunno about vb.net
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 23rd, 2004, 12:55 PM
#4
Frenzied Member
yep thats what i am refering to
File system Object
you can reference it in your project reference as Microsoft Runtime Scripting
it provides you with the classes you need for Drives to determine what type of a drive is certain letter.
you can accomlish this through WMI but WMI is a lot slower than FSO.
-
Apr 23rd, 2004, 07:50 PM
#5
I wonder how many charact
Stick with the API's...
VB Code:
Private Declare Function GetDriveType Lib "kernel32" Alias
"GetDriveTypeA" (ByVal nDrive As String) As Int32
Private Enum DriveTypes 'used with GetDriveType
Unknown = 0
Invalid_or_Not_Mounted=1 'invalid path: eg no volume mounted
Removable = 2
Fixed = 3
Remote = 4
CDROM = 5
RAMDisk = 6
End Enum
'in a click event or something
Dim iDriveType = GetDriveType(myDrive)
'decide type of drive and display appropriate drive letter.
Select Case iDriveType
Case DriveTypes.CDROM
'cd
Case DriveTypes.Fixed
'hard
Case DriveTypes.Remote
'remote
Case DriveTypes.Removable
'removable
Case DriveTypes.RAMDisk
'ramdisk
Case Else
'unkown
-
Apr 23rd, 2004, 07:52 PM
#6
hehe thank you both of you
umm I like the idea of sticking with APIs as well. btw would using the FSO object create any compatibility problems?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Apr 23rd, 2004, 07:53 PM
#7
I wonder how many charact
The API was the recommend way from a Microsoft MVP, he also stated that a DriveInfo class would be included in the next release of the .Net framework:
http://www.dotnet247.com/247referenc...36/183112.aspx
Here's his sample:
http://dotnet.mvps.org/dotnet/code/f...tem/index.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|