error 1202 - ERROR_DEVICE_ALREADY_REMEMBERED in WNetAddConnection2A
- by Don
I used the function - WNetAddConnection2A(n, UserName, Password, dwFlags) to programmatically map a drive and read the drive info out, and then used WNetCancelConnection2A(DriveLetter, dwFlags, ForceDisconnect) to unmap the drive. The first map and unmap were fine. But the next map will bring me the error 1202 - ERROR_DEVICE_ALREADY_REMEMBERED when the same driver letter is used.
I set dwFlags = 0. It works in my development machine but fails in server. How to eliminate the error 1202?
Thanks!