Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many drives?
Message
From
28/02/2017 10:26:33
 
 
To
22/02/2017 17:11:53
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01648372
Message ID:
01648619
Views:
58
Thank you Dragan.

>>I want to know what are the drives in my computer. Perhaps there's a vfp function that would tell me that but I don't remember.
>
>
	ofso=createobject("scripting.filesystemobject")
>*!*	* Enumerate CD-ROMs, removable drives and Floppy
>	loDrives = EnumerateDrivesEx("ALL")
>
>*-----------------------------------------
>function EnumerateDrivesEx
>	lparameters tcTypes2Return
>* tcTypes2Return - a list of drive types to return. ALL is default
>	local lcTypeList, loDrives as collection, lnI, lnDriveType, lcDriveType, lcTypes2Return, loShellApp, lcTypeExtended
>
>	lcTypes2Return 	= upper(evl(tcTypes2Return, "ALL"))
>	loDrives		= createobject("Collection")
>	lcTypeList		= "UNKNOWN,REMOVABLE,FIXED,NETWORK,CDROM,RAMDISK"
>	loShellApp = createobject("Shell.Application")
>
>	for lnI = asc("A") to asc("Z")
>		lnDriveType = drivetype(chr(lnI))
>		if between(lnDriveType, 2, 6)
>			lcDriveType = getwordnum(lcTypeList, lnDriveType, [,])
>			if lcDriveType == "REMOVABLE"  ;
>					and "FLOPPY" $ upper(loShellApp.NameSpace(chr(lnI)+ ":").self.type)
>				lcDriveType = "FLOPPY"
>			endif
>			if lcTypes2Return = "ALL" or (lcDriveType $ lcTypes2Return)
>				loDrives.add(lcDriveType, chr(lnI)+":")
>			endif
>		endif
>	endfor
>	return loDrives
>
>
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Previous
Reply
Map
View

Click here to load this message in the networking platform