Help and Support
 

powered byLive Search

How to Obtain the Active Drive Letters in a Visual FoxPro App

Article ID:137407
Last Review:February 11, 2000
Revision:1.1
This article was previously published under Q137407

SUMMARY

Call the GetLogicalDriveStrings API to get all the drive letters used in the active session of Windows NT or Windows 95. This API is not supported in Win32s, so it cannot be used when Visual FoxPro is running under Windows 3.x.

MORE INFORMATION

The following code fragment returns an array called aMyarray containing all the used drive letters for that session of Windows NT or Windows 95. The code uses the GetLogicalDriveStrings Windows API, which is supported under Win32 only, not Win32s. The Number of drives is in a variables called NumberOfDrives.
   DECLARE INTEGER GetLogicalDriveStrings IN Win32API as getit;
       INTEGER nBuffSize, STRING  lpString
   CLEAR
   DIMENSION aMyarray(1)
   lpString=SPACE(200)
   nBuffSize=LEN(lpString)
   =getit(nBuffSize,@lpString)
   NumberOfDrives=OCCURS(":",lpString)
   DIMENSION aMyarray(NumberOfDrives)
   FOR  i=1 TO  NumberOfDrives
      aMyarray(i)=SUBSTR(lpString,AT(":",lpString,i)-1,1)
   ENDFOR
				

APPLIES TO
Microsoft Visual FoxPro 3.0 Standard Edition

Back to the top

Keywords: 
kbcode KB137407

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.