Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WNetAddConnection -- Declaration?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00166668
Message ID:
00166783
Views:
48
>Have you guys tried calling WNetAddConnection2 instead of WNetAddConnect? According to the documentation WNetAddConnect2 supersedes the WNetAddConnect function. If you have, how can we mimic the 1st parm (NETRESOURCE structure).

Actually, I normally use WNetAddConnection3(); the NETRESOURCE structure is not one conveniently built using just VFP (there are several pointers to strings that are not convenient to build without use of HeapAlloc() and a memory copy facility like RtlMoveMemory() or lstrcopy() to move data to and from VFP memory space and the string buffers.) I use a wrapper .DLL on the API function which handles this for me.

There is a very strong alternative to using the API call; one of the OLE Automation objects in the Windows Scripting Host, Wscript.Network has a very strong set of methods for accessing network functionality. The Windows Scripting Host is built into Win98 and WinNT 5; it can be conveniently added to NT 4.0 through Option Pack 4, or to any of the Win32 platforms from the self-installing .EXE available from Microsoft's Web site.

If Wscript.Network were the only useful automation object in WSH, I wouldn't be as enthusiastic about it; there are some other automation objects (Wscript.Shell, which provides a good deal of Shell functionality, including access to a shortcut and URL shortcut automation object, access to the Special Folders colection, environment strings, and the ability to create and execute VBScript and JScript through the WSCRIPT.EXE and CSCRIPT.EXE executables bundled into WSH.

It's considerably easier to work with than the Win32 API inside of VFP, too.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform