Microsoft KB Archive/136979

How to Get Drive Letters in Visual FoxPro

PSS ID Number: Q136979 Article last modified on 09-21-1995

3.00

WINDOWS

= SUMMARY =

Use the GetLogicalDrives API call to get all the drive letters used in the active session of Windows 3.X, Windows NT, or Windows 95.

= MORE INFORMATION =

The following code fragment returns all the drive letters for that session of Windows in an array called aMyarray. The code uses the GetLogicalDrives Windows API that is supported under both Win32s and Win32. The Number of drives is in a variable called ArrayCount.

DECLARE INTEGER GetLogicalDrives IN Win32API as GetDrives CLEAR DIMENSION aMyarray(1) ArrayCount=1 ReturnDWORD=GetDrives COUNTER=0 FOR i=1 TO 26 && Count all English charactors IF (BITTEST(ReturnDWORD,i)=.T.) TempChar=chr(65+COUNTER) DIMENSION aMyarray(ArrayCount) aMyarray(Arraycount)=TempChar ArrayCount=ArrayCount+1 ENDIF COUNTER=COUNTER+1 ENDFOR

Additional reference words: 3.00 VFoxWin KBCategory: kbprg kbcode KBSubcategory: FxprgGeneral ============================================================================= Copyright Microsoft Corporation 1995.