CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Jul 2005
    Posts
    1

    Question Urgent ADSI / using IADsNameTranslate in C++

    Hi,

    I am using ADSI api and want to extract Net BIOS name from DNS using C++.
    I got following sample from MSDN. But this sample is not compiling. I got following compilation error:
    error C2065: 'IADsNameTranslate' : undeclared identifier

    I have Included "activeds.h" and "Iads.h" in the header files but still I am not able to get the desired result.

    If someone has worked on it then please sent me the working code.


    #include "activeds.h"
    #include "Iads.h"

    int wmain( int argc, wchar_t *argv[] )
    {
    IADsNameTranslate *pNto;
    HRESULT hr;
    hr = CoCreateInstance(CLSID_NameTranslate,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_IADsNameTranslate,
    (void**)&pNto);
    if(FAILED(hr)) { exit 1;}

    hr = pNto->InitEx(ADS_NAME_INITTYPE_SERVER,
    CComBSTR("aDsServer"),
    CComBSTR("aUser"),
    CComBSTR("userDomain"),
    CComBSTR("passwd"));
    if (FAILED(hr)) { exit 1;}

    hr =pNto->Set(ADS_NAME_TYPE_1779,
    CComBSTR("cn=jeffsmith,cn=users,dc=Fabrikam,dc=com"));
    if(FAILED(hr)) {exit 1;}

    BSTR bstr;
    hr = pNto->Get(ADS_NAME_TYPE_NT4, &bstr);
    printf("Translation: %S\n", bstr);

    SysFreeString(bstr);
    pNto->Release();
    }


    Thanks and Regards
    Ankur
    Last edited by Ankur_Gupta_US; July 14th, 2005 at 05:55 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured