Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NOVELL
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Re: NOVELL
Miscellaneous
Thread ID:
00117137
Message ID:
00117658
Views:
24
>>>It is giving error WNetAddConnection function not found..
>>>
>>>Please help me.
>>>
>>>Regards
>>>MMK
>>
>>
>>FUNCTION AddConn
>>LPARAMETERS cUNCToMap, cDriveLetter, cPasswordToUse
>>IF TYPE('cUNCToMap') # 'C' OR TYPE('cDriveLetter') # 'C'
>>	RETURN .F.
>>ENDIF
>>IF TYPE('cPasswordToUse') # 'C'
>>	cPasswordToUse = ''
>>ENDIF
>>
>>DECLARE INTEGER WNetAddConnection IN Win32API ;
>> STRING cRemoteUNC, ;
>> STRING cPassword, ;
>> STRING cLocalDrive
>>
>>RETURN (WNetAddConnection( cUNCToMap, cPasswordToUse + CHR(0), cDriveLetter) = 0)
>>
>Ed,
>
>I think the declaration should be:
>DECLARE INTEGER WNetAddConnection IN Win32API;
>  STRING @lpszRemoteName, STRING @lpszPassword, STRING @lpszLocalName
>with all parameters being passed by reference. So, using your example:
>RETURN (WNetAddConnection(@cUNCToMap, 0, @cDriveLetter) = 0)
>will work.
>

The code I gave does work, but you may be right. VFP seems to handle the LPTSTR ref properly even with the use of STRING cVarName rather than STRING @cVarName. It's old code from one of our classlibs at work, which we've replaced with calls to WNetAddConnection3(), which requires an HWND and an LPNETRESOURCE

The C prototype for the API call is:

DWORD WNetAddConnection( LPTSTR lpRemoteName, // pointer to network device name
LPTSTR lpPassword, // pointer to password
LPTSTR lpLocalName // pointer to local device name);

>If Nishit has access to this past May's issue of FoxPro Advisor, he can see may article on this subject for additional information.
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