Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine if path is local or remote
Message
De
01/12/1998 02:20:39
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00162674
Message ID:
00162680
Vues:
18
>My program needs to determine whether a given path points to a local disk drive or a network drive. I thought of simply looking for two slash marks at the beginning of the string, e.g., at("\\",m.string)<>0, but if the network directory had been assigned to a drive letter (e.g., d:), the expression would evaluate false.
>
>Is there an API call or any other means of determining this?
>
>Thanks.
for ix = 1 to 26
   ? chr(ASC("A")-1+ix)+":",cDriveType(chr(ASC("A")-1+ix))
endfor

function cDriveType
lparameters cDriveLetter
local aDrvTypes
dimension aDrvTypes[7]
aDrvTypes[1]="CANNOT_DETERMINE"
aDrvTypes[2]="INVALID_DRIVE"
aDrvTypes[3]="DRIVE_REMOVABLE"
aDrvTypes[4]="DRIVE_FIXED"
aDrvTypes[5]="DRIVE_REMOTE"
aDrvTypes[6]="DRIVE_CDROM"
aDrvTypes[7]="DRIVE_RAMDISK"
DECLARE integer GetDriveType in WIN32API string @cDrvLetter
cDriveLetter = left(cDriveLetter,1)+":\"
return aDrvTypes(GetDriveType(@cDriveLetter)+1)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform