Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WNetAddConnection returning 487

WNetAddConnection returning 487

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadminquestionlearning
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Still learning how to code
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • S Still learning how to code

      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

      S Offline
      S Offline
      Still learning how to code
      wrote on last edited by
      #2

      Just discovered that this is fixed by:- NETRESOURCE = { '\0' }; :-D :-D :-D

      Doug

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups