Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to force reconnection of a network mapped drive?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00713586
Message ID:
00715977
Views:
10
>
>	DECLARE Long WNetGetConnection in WIN32API;
>		STRING @lpzLocalName, ;
>		STRING @lpzRemoteName, LONG @lpnSize
>		
>	lcLocalName = "T:"
>	lcRemoteName = Space(255)
>	lnSize = 255
>	
>	lnRet = WNetGetConnection( @lcLocalName, @lcRemoteName, @lnSize)
>	
>	* lnRet # 0 : not a mapped resource, or not connected, or other error
>
There are a couple of problems with WNetGetConnection(); first, it provides no mechanism to provide a user name and password to use to connect the resource, which means that it will always attempt to make the connection based on the user name and password (and by inference, domain) for your Windows login. The second is that it is officially listed as a legacy API call; this means that, at some point in the future, it may stop working on a new OS version, or may require you to run the app using it in a compatibility mode (it's officially a holdover from Win3.x)
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
Reply
Map
View

Click here to load this message in the networking platform