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. Experts !Problem with WNetOpenEnum

Experts !Problem with WNetOpenEnum

Scheduled Pinned Locked Moved C / C++ / MFC
helptutoriallearning
1 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.
  • Y Offline
    Y Offline
    ykutanoor
    wrote on last edited by
    #1

    I am trying to get the list of domains AND LIST OF COMPUTERS under each domain. I am getting domains when I use the parameter RESOURCE_GLOBALNET in WNetOpenEnum. I am getting list of only computers when I use the parameter RESOURCE_CONTEXT in WNetOpenEnum. But my requirement is I would like to get computers under each domain. How should I achive this .This is the code.Pls tell me where I am going wrong. NETRESOURCE res[10]; HANDLE hMain; int x,y,i; DWORD dwCnt = 0xffffffff; DWORD dwSize; DWORD dwRes; dwRes = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, NULL, &hMain); dwSize = sizeof (res); if (WNetEnumResource (hMain, &dwCnt, res, &dwSize) == NO_ERROR) { HANDLE hEnum; dwRes = WNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, res,&hEnum); while (dwRes == NO_ERROR || dwRes == ERROR_MORE_DATA) { dwCnt = 9; dwSize = sizeof (NETRESOURCE) * 10; dwRes = WNetEnumResource (hEnum, &dwCnt, res, &dwSize); if (dwRes != ERROR_NO_MORE_ITEMS) { for ( i = 0; i < dwCnt; i++) { if (res[i].lpLocalName != NULL || res[i].lpRemoteName!= NULL) { //MessageBox(0,res[i].lpLocalName,res[i].lpRemoteName,0); //Add this in to a list box. SendMessage (hwndList, LB_ADDSTRING, 0, (LPARAM)res[i].lpRemoteName) ; } } } WNetCloseEnum (hEnum); } WNetCloseEnum (hMain); Pls guide

    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