Mapping a Network Drive with Delphi WITHOUT WNetAddConnection2
Recently I built a GUI app that maps a network connection to a drive in Windows. Unfortunately it uses the WNetAddConnection2() call to accomplish this. It's unfortunate because the Windows API sucks when it comes to Mapping remote WebDAV connections. It seems to work OK in Vista, except when trying to enable SSL, and it just doesn't work in XP unless you spec开发者_运维知识库ify a folder (You can't map it to the root URL. Eg: http://mywebdavserver.tld). Also SSL doesn't work in XP. Basically, I find using WNetAddConnection2() extremely unreliable.
That said, is there any way to Map a network drive with WebDAV WITHOUT using WNetAddConnection2()?
Many thanks in advance, Brad
Basically you are complaining that OS implementation of WebDAV support doesn't meet your expectations. It's no wonder, cause even in Windows 7 this client implementation has serious problems with compatibility and standard compliance. I think that maybe this product will do the job better (we don't use it cause we have our own WebDAV client and server implementation, so I can't say anything about it's quality).
I think that it's possible using WMI. The class WIN32_Share have a method Create with this comment: "Class method that initiates sharing for a server resource.".
Search for WMI and execute a method. You will find some questions about this (and responses).
The {RRUZ} blog have a lot of information about this.
Regards.
精彩评论