Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UNC versus drive letter
Message
De
11/12/2001 05:11:45
 
 
À
11/12/2001 04:49:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00591571
Message ID:
00592561
Vues:
17
>> > read ... from the memory location given by the pointer in the result buffer
>>
>> You can use the functions from my ClsHeap class to do this ...
>
>Ed, thank you for the interesting info. However, I was not thinking clearly last night or I would not have posted that code at all: there is no guarantee that the pointer contained in the result buffer is still valid by the time you access that buffer from Fox. As returned by Windows the pointer points into the buffer itself, and it will still point to the same memory location even if Fox copies the buffer elsewhere. IOW, the only sane way of using WNetResourceInfo() would be from C code (FLL, or OCX/DLL as you suggested).

Which is why ClsHeap provides a mechanism to work with static buffers outside the VFP memory space (it allocates space on a heap, passes back pointers to these buffers, and provides methods to move data to and from these buffers, as well as providing pointer dereferencing, data format translation and minimalist deallocation and recovery.)

As I said, it's possible to call most APIs that don't require a provision for a callback routine, especially in VFP7 where the OBJECT parameter type is provided so that you can easily pass back object refs, so that you can have Fox take a COM interface returned by an API call. ClsHeap is strictly VFP with DLL calls; Christof's STRUCT is easier to use, but relies on an external DLL to manage memory issues (he had discussed using a strategy similar to ClsHeap to avoid the need for the DLL, but I don't know if he ever released the revision.)

>
>> Even easier is to use WNetGetConnection() or WNetGetConnection2() ...; both return the UNC for a resource in a string buffer passed by reference to the API call.
>
>These functions can be safely used from Fox so there seems to be no reason to play with WNetResourceInfo() at all in this case ... To atone for my sins I wrote a new UNCPath() prg and tested it:
>
No need - almost identical code already exists in the API section. You can always add to the entries out there; we've only got Fox translations for a couple hundred of the thousands of API calls in the Platform SDK. If you feel a need for absolution, add a few more.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform