Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many drives?
Message
De
28/02/2017 10:26:33
 
 
À
22/02/2017 17:11:53
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01648372
Message ID:
01648619
Vues:
59
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é
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform