Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need an API call
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00364159
Message ID:
00364184
Views:
39
>Anyone know of an API call to Map/Unmap a network drive?
>
>TIA

In addition to the WSH that was previously mention, you could also use UNCs. However, to answer the question directly:
    DECLARE INTEGER WNetAddConnection IN Win32API;
  STRING @lpszRemoteName, STRING @lpszPassword, STRING @lpszLocalName
DECLARE INTEGER WNetCancelConnection IN Win32API;
 STRING @lpszName, INTEGER fForce
* Map a drive
* lcserver is the server name
* lcdrive is the drive specifier.
* The below uses the "remembered" password name
* If the mapping was successful lnresult will equal 0
lnresult = WNetAddConnection(@lcserver, 0, @lcdrive)
* Below uses provided password.
lnresult = WNetAddConnection(@lcserver, @lcpassword, @lcdrive)
* Unmap/Disconnect
lnresult = WNetCancelConnection(lcdrive, 0) && 0 if success.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform