maps drive Q: to \\SomeServer\AppShare share, does not update the user profile data to auto-map the drive again, using the user id "Foo" and the password "Bar", and this functionality exists in even the version 1 WSH implementation. The first two parameters -m the local device and the share name as a UNC are mandatory. The third parameters is optional, when true, it updates the currently logged-in user profile to auto-map this drive again when logging in. The fourth and fifth parameters are optional user name and password; the Windows Login username and password will be passed if not specified.
The Win32 API's WNetAddConnection3() is more capable, but is a bit of a PITA to implement in VFP - there's sample code showing one approach in my NETRESOURCE class on UT, and ChristofLange wrote a STRUCT class which makes the implementation easier if you don't want to use CLSHEAP for managing the structure memory yourself."
One way is use the windows scripting host. There is lots of information on it at:
msdn.microsoft.com/scripting
I think this is the code you need, but I am referencing a print-out (from the site I gave you) that is several years old.
Unfortunately, I'm on the fly right now and can't try to put something together for you at this time. However, the documentation I have shows:
Set WshNetwork=Wscript.CreateObject("Wsscipt.network"
WshNetwork.MapNetworkDrive "Z:", "\\Server\Share"
* to remove
WshNetwork.RemoveNetworkDrive "Z:"
Again, you'll have to play with connecting this from VFP. It's not all that difficult, but I don't have the time right now. Maybe someone else can provide more immediate feedback?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.