ADSI Terminal Server Extensions (IADsTSUserEx)
I am very new to ADSI programming and am stuck on probably a simple thing.
I am getting the following error in VC++ 6.0 when compiling & executing the ADSI sample code (see below) taken straight from MSDN.
error C2065: 'IID_IADsTSUserEx' : undeclared identifier
I have imported the required "tsuserex.h" and "tsuserex.c" files for using the IADsTSUserEx class and the actual object definition compiles successfully with no problems. It just seems to be something to do with the interface on the IADsTSUserEx object that is not recognised by the compiler.
Does anyone have any advice on why this could be happening?
Thanks in advance.
Alex.
CODE-------->
IADsContainer *pContainer = NULL;
IDispatch *pNewObject = NULL;
IADsTSUserEx *pTSUser = NULL;
IADsUser *pUser = NULL;
HRESULT hr = ERROR_SUCCESS;
CoInitialize(NULL);
//
// Bind to the known container.
//
hr = ADsGetObject(L"LDAP://CN=Users,DC=Server1,DC=Domain,DC=com",
IID_IADsContainer,
(void**)&pContainer);
if( !SUCCEEDED(hr)) {
wprintf(L"ADsGetObject ret failed with 0x%x\n", hr);
return FALSE;
}
//
// Create the new Active Directory Service Interfaces User object.
//
hr = pContainer->Create(L"user",
L"cn=test3",
&pNewObject);
pContainer->Release();
if( !SUCCEEDED(hr)) {
wprintf(L"Create ret failed with 0x%x\n", hr);
return FALSE;
}
//
// Get the IADsTSUser interface from the user object.
//
hr = pNewObject->QueryInterface(IID_IADsTSUserEx, (void**)&pTSUser);
if( !SUCCEEDED(hr)) {
wprintf(L"QueryInterface for IADsTSUser failed with ret 0x%x\n", hr);
return FALSE;
}
//
// Get the IADsTSUser interface from the user object.
//
hr = pNewObject->QueryInterface(IID_IADsUser, (void**)&pUser);
if( !SUCCEEDED(hr)) {
wprintf(L"QueryInterface for IAsUser failed with 0x%x\n", hr);
return FALSE;
}
pNewObject->Release();
//
// Set TerminalServicesProfilePath
//
pTSUser->put_TerminalServicesProfilePath(L"c:\\windows");
pTSUser->Release();
//
// Commit the object data to the directory.
//
pUser->SetInfo();
pUser->Release();
CoUninitialize();
<----------

