Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connected to Network
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00144975
Message ID:
00145440
Vues:
28
Sounds good. I'll give it a try and let you know how I get along. Thanks for the info

Greg

>Hi Greg,
>
>At the end of this message, I'll show you how to get a list of mapped drives via the API.
>
>As far as WNetEnumResource, it will give you what you're looking for. It may, however, be more practical just to get the networks that have already been mapped to. When you call WNetOpenEnum, use RESOURCE_GLOBALNET as the scope parameter and RESOURCETYPE_DISK as the type. I wrote an article in the May, 1998 issue of FoxPro Advisor on the various problems in dealing with WANs. Include in the article was the code necessary to do what you're looking for. There was one difference, I used the function to return the list of "remembered" servers via RESOURCE_REMEMBERED. If you need more help, just post.
>
>Now the drives, there are two functions you need to look at: GetLogicalDrives and GetLogicalDriveStrings. Here's some sample code as to how I'd deal with them.
>* GetLogicalDrives sample
>DECLARE INTEGER GetLogicalDrives IN Win32API
>lndrives = GetLogicalDrives()
>FOR lni = 0 TO 25
>  IF BITTEST(lndrives, lni)
>    * The drive is in use
>    lcdrive = CHR(65 + lni) + ":"
>  ENDIF
>NEXT
>* GetLogicalDriveStrings
>DECLARE INTEGER GetLogicalDriveStrings IN Win32API;
>  INTEGER lnbufferlength, STRING @lcbuffer
>lcbuffer = SPACE(105)
>lnresult = GetLogicalDriveStrings(105, @lcbuffer)
>lcbuffer = LEFT(lcbuffer, lnresult)
>lndrives = OCCURS(CHR(0), lcbuffer)
>lnstart = 1
>FOR lni = 1 TO lndrives
>  ? SUBSTR(lcbuffer, lnstart, 3)
>  lnstart = AT(CHR(0), lcbuffer, lni) + 1
>NEXT
>hth,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform