Assigning a Drive to a Share
The following example demonstrates how to connect a drive letter to a remote server share with a call to the WNetAddConnection2 function. The sample informs the user whether or not the call was successful.
Windows Me/98/95: This code sample is not supported.
To test the following code sample, perform the following steps:
Change the following lines to valid strings: szUserName[32] = "myUserName",
szPassword[32] = "myPassword",
szLocalName[32] = "Q:",
szRemoteName[MAX_PATH] = "\\\\products2\\relsys";
Add the file to a console application called AddConn2.
Link the library MPR.LIB to the compiler list of libraries.
Compile and run the program AddConn2.EXE.