Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine if path is local or remote
Message
From
01/12/1998 02:20:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/12/1998 01:51:08
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00162674
Message ID:
00162680
Views:
23
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform