Results 1 to 4 of 4

Thread: Determining between local drives and networked drives

  1. #1

    Thread Starter
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375

    Determining between local drives and networked drives

    Hi, is there anyway to determine between a local physical drive and a network drive that has been mapped?

    Eg. I just want to search the A: C: and any other drives that are physically located on the machine.

    I want the program to ignore any network mapped drives M: for example.

    I am currently using the Filesystem object.

    Thanks in advance
    MarkusJ

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Try this
    GetDriveType
    The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

    UINT GetDriveType(
    LPCTSTR lpRootPathName // pointer to root path
    );

    Parameters
    lpRootPathName
    Pointer to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory.
    Return Values
    The return value specifies the type of drive. It can be one of the following values:

    Value Meaning
    DRIVE_UNKNOWN The drive type cannot be determined.
    DRIVE_NO_ROOT_DIR The root directory does not exist.
    DRIVE_REMOVABLE The disk can be removed from the drive.
    DRIVE_FIXED The disk cannot be removed from the drive.
    DRIVE_REMOTE The drive is a remote (network) drive.
    DRIVE_CDROM The drive is a CD-ROM drive.
    DRIVE_RAMDISK The drive is a RAM disk.
    VB Code:
    1. Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
    2. Private Sub Form_Load()
    3. 'Set the graphic mode to persistent
    4.     Me.AutoRedraw = True
    5.     'Get information about the C:\
    6.     Select Case GetDriveType("C:\")
    7.         Case 2
    8.             Me.Print "Removable"
    9.         Case 3
    10.             Me.Print "Drive Fixed"
    11.         Case Is = 4
    12.             Me.Print "Remote"
    13.         Case Is = 5
    14.             Me.Print "Cd-Rom"
    15.         Case Is = 6
    16.             Me.Print "Ram disk"
    17.         Case Else
    18.             Me.Print "Unrecognized"
    19.     End Select
    20. End Sub
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375

    Smile

    Thanks for that

  4. #4
    Hyperactive Member Steve Stunning's Avatar
    Join Date
    Jul 1999
    Location
    Fairfax, Virginia
    Posts
    314
    Ya, Thanks.... This is rather handy!
    Steve Stunning

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width