What's the error number returned? You can get a list of error constants from the API Viewer (utility that can be installed as part of Visual Sttudio). For example, 5 is Access Denied.
WNetAddConnection uses the current acocunt to try and access the share. If your account doesn't then the function will fail. You might also try terminating the resource name with a chr(0). The SDK help says that the string should be NULL terminated.
HTH.
>I'm using this API call to establish a connection to a server during program execution, but it's not working. I'm using code I found on the UT:
>
>Declare INTEGER WNetAddConnection IN "mpr.dll" ;
> STRING cRemoteName, ;
> STRING cPassword, ;
> STRING cLocalName
>
>cResource = "\\Eddc002\Construction"
>cPassword = ""
>cDriveLetter = "G:"
>
>?WNetAddConnection(cResource, cPassword, cDriveLetter)
>
>An integer is returned, but I have no idea what it means because the MSDN help only lists error messages, not their correpsonding #'s.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao