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
H

hillclymr

@hillclymr
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • problem with WNetAddConnection2 and WNetCancelConnection2!!
    H hillclymr

    A clip from an older project. Deletes all connections. Modify to suite your needs. Hope this helps. /+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- // DeleteAllConnections() // Purpose: Delete all network connections // Added : 4/06/04 //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- void TestDlg::DeleteAllConnections() { DWORD dwResult; HANDLE hEnum; DWORD cbBuffer = 16384; DWORD cEntries = 0xFFFFFFFF; LPNETRESOURCE lpnrDrv; #if _DEBUG return; #endif dwResult = WNetOpenEnum( RESOURCE_CONNECTED, RESOURCETYPE_ANY,0,NULL,&hEnum ); if (dwResult != NO_ERROR) { GetErrorMsg(dwResult); return; } // start enumerating all the connections while( dwResult != ERROR_NO_MORE_ITEMS ) { lpnrDrv = (LPNETRESOURCE) GlobalAlloc( GPTR, cbBuffer ); dwResult = WNetEnumResource( hEnum, &cEntries, lpnrDrv, &cbBuffer); if (dwResult == NO_ERROR) { for( DWORD ii = 0; ii < cEntries; ii++ ) { if( lpnrDrv[ii].lpLocalName != NULL ) dwResult=WNetCancelConnection(lpnrDrv[ii].lpLocalName, TRUE ); else dwResult=WNetCancelConnection(lpnrDrv[ii].lpRemoteName,TRUE ); GetErrorMsg(dwResult); } } } // cleanup GlobalFree( (HGLOBAL) lpnrDrv ); WNetCloseEnum(hEnum); } Erik

    C / C++ / MFC sysadmin help question
  • Login

  • Don't have an account? Register

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