Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connected to Network
Message
From
10/10/1998 09:41:29
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00144975
Message ID:
00145658
Views:
37
>* 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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform