WNetAddConnection returning 487
-
Hi, I'm trying to map a network storage drive by using the following code:- NETRESOURCE NetResource; NetResource.dwType = RESOURCETYPE_ANY; //RESOURCETYPE_DISK; NetResource.lpRemoteName = "\\\\STORAGE-93F8\\PUBLIC"; NetResource.lpLocalName = "Z:"; DWORD dwRC; dwRC = WNetAddConnection2(&NetResource,"","",0); This gives a return code of 487 which is obviously an error but I can't a definmition for it - some references on the 'net imply resource not found. In a cmd window, I can issue "net use z: \\STORAGE-93F8" and this is successful. So what's wrong with the call to WNetAddConnection ? :confused: Any help appreciated ! Doug
-
Hi, I'm trying to map a network storage drive by using the following code:- NETRESOURCE NetResource; NetResource.dwType = RESOURCETYPE_ANY; //RESOURCETYPE_DISK; NetResource.lpRemoteName = "\\\\STORAGE-93F8\\PUBLIC"; NetResource.lpLocalName = "Z:"; DWORD dwRC; dwRC = WNetAddConnection2(&NetResource,"","",0); This gives a return code of 487 which is obviously an error but I can't a definmition for it - some references on the 'net imply resource not found. In a cmd window, I can issue "net use z: \\STORAGE-93F8" and this is successful. So what's wrong with the call to WNetAddConnection ? :confused: Any help appreciated ! Doug
Just discovered that this is fixed by:- NETRESOURCE = { '\0' }; :-D :-D :-D
Doug