thanks for answer, is that ah way to resolve a network drive to this LAN name?
My Letter is this one P on network, "P:\project\projectname.pf" how to resolve this name to "\\server\project\"??? Is there any solution for this??
I select this folder over an File Dialog, and they give me this path back, but how to convert him to this LAN name!
Thanks for any help!
The "\" is known as the (or one of?) "escape" character.
that means that if you want to put a tab, for example in a string you would put "\t" to indicate a tablature; that means that the string will look at the "\" and the next character after that and see a "t" and will understand it as a "tablature" (same thing for quotes and double quotes)
so, in general, when a string (CString) encounters a "\" in a string it will check the next character and see if it means something.
the question is how can I put a literal "\" in string without being recognize as an escape character ?
the anwser is to double the "\" ...
str = "C:\\Windows";
When hard-coding paths in string one should always put "\\", but, for example, if you have a UI with an edit box to type in the path, you don't need to use the "\\" you can just use the "\".
The '\\' notation is only needed for the compiler. It isn't needed in the runtime. (when you select a file from the open file dialog, the path is returned as "C:\New Folder"
If you want to replace them for other reasons, then use 4 '\'. i.e. to specify a SMB server, you would use CString strServer = "\\\\server_name\\folder";.
To replace it you just need a replace function. If you are using something liks CString, it as a Replace() method.
CString strName = "\\hello";
//strName is now "\\hello" if it were printed to screen, or "\\\\hello" from the compilers view
I have to connect to WebDAV Server, example: http://webdav.pspace.co.kr
But I cannot find any code example for DavAddConnection Function.
And, in MSDN I found this:
"Use this function when you are connecting to a WebDAV server using the Secure Sockets Layer (SSL) protocol and therefore must specify a certificate. To connect to a WebDAV server without specifying a certificate, use a Windows networking function such as WNetAddConnection2 or WNetAddConnection3."
Does anyone know some examples of DavAddConnection?
Found some code examples for WNetAddConnection2 and tried to connect, but, unsuccessfully.
Running your code with locname=_T("\\\\webdav.pspace.co.kr\\") and running a packet sniffer I get the response
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<title>401 Authorization Required</title></head><body>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<address>Apache Server at webdav.pspace.co.kr Port 80</address>
I'm sure you can figure out what the problem is from the response
I have never used WNetAddConnection2, and what I have been telling you is from reading MSDN and running your code on my computer so i dont know of any reasons that this might be hapening. Since i dont have an account on webdav.pspace.co.kr[^] the best i can offer is that you run Wireshark[^] and start the sniffer while you try to connect to the server to see what the server is sending back to you.
lpLocalName should be NULL in you case
"A pointer to a null-terminated string that specifies the name of a local device to redirect, such as "F:" or "LPT1". The string is treated in a case-insensitive manner."
but you use webdav.pspace.co.kr, which may cause the problem I think...
Last Visit: 31-Dec-99 18:00 Last Update: 30-Sep-23 2:37