Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loop through all Hard-disks to check for a file
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01198517
Message ID:
01198524
Vues:
13
This message has been marked as the solution to the initial question of the thread.
Hi Bhavbhuti,
#DEFINE DRIVE_UNKNOWN     0
#DEFINE DRIVE_NO_ROOT_DIR 1
#DEFINE DRIVE_REMOVABLE   2
#DEFINE DRIVE_FIXED       3
#DEFINE DRIVE_REMOTE      4
#DEFINE DRIVE_CDROM       5
#DEFINE DRIVE_RAMDISK     6

LOCAL lcPom,liy,liy

DECLARE INTEGER GetDriveType IN kernel32 String lpszRootPathName
DECLARE INTEGER GetLogicalDriveStrings IN kernel32 integer,String @

lcpom=SPACE(254) && Set buffer
=GetLogicalDriveStrings(LEN(lcpom),@lcpom) && Read all known HDD, etc.
lcpom=ALLT(lcpom)
lcpom=LEFT(lcpom,LEN(lcpom)-1) && remove \0 char

FOR lii=OCCURS(CHR(0),lcpom) TO 1 STEP -1
    lcDRV=SUBS(lcpom,AT(CHR(0),lcpom,lii)-3,3)
    IF INLIST(GetDriveType(lcDRV),DRIVE_REMOVABLE,DRIVE_FIXED)
       ?lcDRV
    ENDIF
NEXT
MartiJ

>Hi all
>
>What API's can I use to loop through Hard-disks to check for a file? Currently I am checking only drives C: and D:, but now this client has a CD drive in D: and second partition as E:
>
>Please advise.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform