Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connected to Network
Message
 
À
10/10/1998 09:41:29
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00144975
Message ID:
00145661
Vues:
36
Hi Dragan,

>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
>
>
Actually, I hadn't thought about using CHRTRAN() to convert the CHR(0) to CHR(1) or I would've used foxtools. I knew that CHR(0) wouldn't work as the delimeter passed to either Words() or WordNum(). You do have me pegged, don't you?

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

The scope, AFAIK, is global. Once declared, the function becomes part of the language almost (but not quite :-)). It stays resident until a CLEAR DLLS is issued. You're right, you cannot clear a specific DLL in VFP. Personally, just because of my style, and because they do use resources, any object that uses an API call has CLEAR DLLS in its .Destroy method. Depending on the usage, I may declare functions in the .Init of the object (if the object will complete its work before any other object is referenced) or in the needed functions, if the object is to exist for a longer period of time. In most cases, this prevents the possibility of the DLLs being cleared by another object.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform