>* 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.