Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many drives?
Message
De
22/02/2017 17:11:53
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
22/02/2017 16:52:27
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:
01648377
Vues:
82
J'aime (1)
>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

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform