I am using WNetAddConnection2 and WNetCancelConnection2 to map or unmap drives.
What i am trying to do is as follows:
I mapped a folder(eg:Folder1) on server(eg:myserver). so the path is \\myserver\Folder1 and i map it to drive X.
Now i want to map another folder(eg:Folder2) on same myserver to drive Y programmatically.
When i call the method WNetAddConnection2 after mapping one folder it returns 1219 instead of 0 and i get the error:Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.
I am confused because i can map Folder2 on the same server by doing a right click on MyComputer and choosing map network drive..., but not programmatically.
Am i missing something or do i need to use the NETRESOURCE structure differently or anyhting else?
Thanks