home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / ADSDK.ZIP / Samples / Start / Rename / vc / Rename.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-18  |  594 b   |  32 lines

  1. // Rename.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "stdio.h"
  6. #include "activeds.h"
  7.  
  8. int main(int argc, char* argv[])
  9. {
  10.     HRESULT hr;
  11.     IADsContainer *pCont=NULL;
  12.     IDispatch *pDisp=NULL;
  13.  
  14.     CoInitialize(NULL);
  15.  
  16.     hr = ADsGetObject(L"WinNT://INDEPENDENCE", IID_IADsContainer, (void**) &pCont);
  17.     if ( !SUCCEEDED(hr) )
  18.     {
  19.         return 0;
  20.     }
  21.     hr = pCont->MoveHere(L"WinNT://INDEPENDENCE/JSmith",L"JJohnson", &pDisp );
  22.  
  23.     if ( SUCCEEDED(hr) )
  24.     {
  25.         pDisp->Release();
  26.     }
  27.  
  28.     CoUninitialize();
  29.  
  30.     return 0;
  31. }
  32.