>I've used this function quite a bit in the past. Off the top of my head, my declaration and execution of the call look like this.
DECLARE INTEGER WNetAddConnection IN Win32API;
> STRING @lpszRemoteName, STRING @lpszPassword, STRING @lpszLocalName
>lnresult = WNetAddConnection(@cResource, 0, @cDriveLetter)
IOW, the strings should be passed by reference. To pass a null pointer for the password, use 0 rather than an empty string.
Warning: WNetAddConnection is officially obsoleted; I'd recommend replacing calls to it with calls to WNetAddConnection2(0 or WNetAddConnection3() (there's sample code in my NETRESOURCE class, and I think in Christof's STRUCT class, both in the Files section, and there's this little-known item in the WSH Wscript.Network call MapNetworkDrive; I think you might have heard rumors about it...