>>* 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,
>
>I've taken this and included into a function of mine (your name is mentioned, if you can recognize it :). Being a FoxTools freak, simply had to replace AT() with WordNum(), but, alas (I'm not advertising my company here!), it doesn't take chr(0) as a word delimiter, so it looks like this:
>
>_diskovi=""
>_delim=""
>* Džordž Tasker, 9.10.98
>* GetLogicalDriveStrings
>DECLARE INTEGER GetLogicalDriveStrings IN Win32API;
> INTEGER lnbufferlength, STRING @lcbuffer
>lcbuffer = SPACE(105)
>lnresult = GetLogicalDriveStrings(105, @lcbuffer)
>lcbuffer = LEFT(lcbuffer, lnresult)
>lcBuffer=ChrTran(lcBuffer,chr(0), chr(1))
>for i=1 to words(lcBuffer, chr(1))
> _diskovi=_diskovi+_delim+WordNum(lcBuffer, i, chr(1))
> _delim=";"
>endfor
>retu _diskovi
>
>
>BTW, what's the scope of Declare API command? For how long does an API function stay declared, and if it remains, when should it be unloaded? I've seen some people here clearing them out, but it seems to have only CLEAR DLLS which clearse them ALL out, unlike other CLEAR commands which know how to be selective.
And then, for the Wscript-enabled among us, there's:
oWshNet = CREATEOBJ('Wscript.Network')
oNetDrives = oWshNet.EnumNetworkDrives
DECLARE aNetDrives[1,2], nNetDriveCount, i
nNetDriveCount = 0
aNetDrives = ''
FOR i = 0 TO oNetDrives.Count - 1 STEP 2
nNetDriveCount = nNetDriveCount + 1
DECLARE aNetDrives[nNetDriveCount,2]
aNetDrives[nNetDriveCount,1] = oNetDrives.Item(i)
aNetDrives[nNetDriveCount,2] = oNetDrives.Item(i+1)
ENDFOR
Column 1 is the drive letter, column 2 the UNC assigned to it.
You need to install the Windows Scripting Host (you can download it from M$; it's installed with 98, NT with Option Pack 4, and NT 5 beta 2. You can also download WSH.EXE from MSDN OnLine; it installs itself nicely under all current Win32 versions except Win32s. There's a ton of functionality in the objects exposed through WSHOM.OCX, the main ProgIDs on interest being "Wscript.Shell" and "WScript.Network".