Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WNetOpenEnum
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00185007
Message ID:
00185193
Vues:
80
>>>Win98
>>>Which DLL has the definitions of WNet API functions. I've tried using NETAPI32.DLL and I get no entry point found in .dll. I've only tried it with WNetOpenEnum so far. Also, where is a 'complete' list of Windows System API calls and where they are located? The MSDN disks only say windows95 or above and list the .h and .lib filenames but not the .dll and I don't have a developers reference. Maybe I'm looking in the wrong place?
>>
>>Use the WIN32API catchall; I believe the .DLL for this call is SVRAPI.DLL under Win9x, but I'm not 100% certain. WIN32API works for the WNet family calls, which use different .DLLs under different operating system and operating system versions.
>
>That works yup. Question about using clsheap. The parameter list for WNetOpenEnum calls for a pointer to a structure and another pointer to a handle. If I create a pointer to some block of memory thats fine. But the first structure is supposed to be a representation of a network container or null. If I pass .null. in the call I get a datatype mismatch. Anyway, if I pass it a pointer to some empty block of memory I get back an empty block of memory. Ever used that API call before?
DECLARE INTEGER WNetOpenEnum IN WIN32API ;
   INTEGER dwScope, ;
   INTEGER dwType, ;
   INTEGER dwUsage, ;
   STRING @ lpNetResource, ;
   INTEGER @ lphEnum

DECLARE INTEGER WNetEnumResource IN WIN32API ;
   INTEGER hEnum, ;
   INTEGER @lpCount, ;
   STRING @lpBuffer, ;
   INTEGER @lpBufferSize 

dwScope = RESOURCE_CONTEXT
dwType = RESOURCETYPE_DISK
dwUsage = RESOURCEUSAGE_CONNECTABLE
hEnum = 0

IF WNetOpenEnum(dwScope, dwType, dwUsage, 0, @hEnum) = 0
   *  it opened the enum;  retrieve with WNetEnumResource
   nCount = 0xFFFFFFFF
   cBuffer = REPL(CHR(0),512)
   nBufSize = 512
   nResult = WNetEnumResource(@hEnum, @nCount, @cBuffer, @nBufSize)
   *  do something with the returned NETRESOURCEs in cBuffer
ENDIF
You can construct a NETRESOURCE in a string; anything pointed to by the NETRESOURCE will need to be constructed off the heap, and deallocated from there. Later, you'll retrieve things from WNetEnumResource in a string buffer allocated and passed by reference; you can retrieve the things referenced by embedded pointers in a NETRESOURCE using the GetMem() and GetMemString() functions after decoding the embedded pointers into numbers using DWORDToNum(). Use the value returned in hEnum from WNetOpenEnum as the hEnum argument to WNetEnumResource(), and pass it by ref when you call WNetEnumResource, so it gets properly molested to point to the next group of things to enum.

The code above is off the top of my head - I use a wrapper .DLL for this stuff myself.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform