Dela via


DisplaySpecifiers Container

Visningsspecificerare lagras efter språk i containern DisplaySpecifiers i konfigurationscontainern. Eftersom konfigurationscontainern replikeras i hela skogen sprids visningsspecificerare över alla domäner i en skog.

Containern Configuration lagrar containern DisplaySpecifiers, som sedan lagrar containrar som motsvarar varje språk. Dessa nationella containrar namnges med hjälp av den hexadecimala representationen av språkidentifieraren. Den amerikanska/engelska nationella containern heter till exempel 409, den tyska nationella nationella containern heter 407 och den japanska nationella containern heter 411. Mer information och en lista över möjliga språkidentifierare finns i Language Identifier Constants and Strings.

Varje språkcontainer lagrar objekt i displaySpecifier-klass.

Om du vill visa alla visningsspecificerare för en språkvariant räknar du upp alla displaySpecifier objekt i den angivna nationella containern i containern DisplaySpecifiers.

Följande kodexempel innehåller en funktion som binder till containern för visningsspecificeraren för det angivna språket:

/**********
This function returns a pointer to the display specifier container 
for the specified locale.

If locale is NULL, use default system locale and then return the 
locale in the locale parameter.
***********/
HRESULT BindToDisplaySpecifiersContainerByLocale(
    LCID *locale,
    IADs **ppDispSpecCont)
{
HRESULT hr = E_FAIL;
 
if ((!ppDispSpecCont)||(!locale))
    return E_POINTER;
 
// If no locale is specified, use the default system locale.
if (!(*locale))
{
    *locale = GetSystemDefaultLCID();
    if (!(*locale))
        return E_FAIL;
}
 
// Be sure that the locale is valid.
if (!IsValidLocale(*locale, LCID_SUPPORTED))
    return E_INVALIDARG;
 
LPOLESTR szPath = new OLECHAR[MAX_PATH*2];
IADs *pObj = NULL;
VARIANT var;
 
hr = ADsOpenObject(L"LDAP://rootDSE",
                     NULL,
                     NULL,
                     ADS_SECURE_AUTHENTICATION,
                     IID_IADs,
                     (void**)&pObj);
 
if (SUCCEEDED(hr))
{
    // Get the DN to the configuration container.
    hr = pObj->Get(CComBSTR("configurationNamingContext"), &var);
    if (SUCCEEDED(hr))
    {
        // Build the string to bind to the container for the
        // specified locale in the DisplaySpecifiers container.
        swprintf_s(
            szPath, 
            L"LDAP://cn=%x,cn=DisplaySpecifiers,%s", 
            *locale, 
            var.bstrVal);

        // Bind to the container.
        *ppDispSpecCont = NULL;
        hr = ADsOpenObject(szPath,
                     NULL,
                     NULL,
                     ADS_SECURE_AUTHENTICATION,
                     IID_IADs,
                     (void**)ppDispSpecCont);
 
        if(FAILED(hr))
        {
            if ((*ppDispSpecCont))
            {
                (*ppDispSpecCont)->Release();
                (*ppDispSpecCont) = NULL;
            }
        }
    }
}
 
// Cleanup.
VariantClear(&var);
if (pObj)
    pObj->Release();
 
return hr;
}