共用方式為


DisplaySpecifiers 容器

顯示規範會依地區設定儲存在組態容器的 DisplaySpecifiers 容器中。 因為組態容器會復寫到整個樹系,因此顯示規範會傳播到樹系中的所有網域。

組態容器會儲存 DisplaySpecifiers 容器,然後儲存對應至每個地區設定的容器。 這些地區設定容器是使用地區設定標識碼的十六進位表示法來命名。 例如,US/English 地區設定容器的名稱為 409、德文地區設定的容器命名為 407,而日文地區設定的容器則命名為 411。 如需詳細資訊,以及可能的語言標識符清單,請參閱 語言標識碼常數和字串

每個地區設定容器都會儲存 displaySpecifier 類別的物件

若要列出地區設定的所有顯示規範,請 列舉 DisplaySpecifiers 容器內指定地區設定容器中的所有 displaySpecifier 物件。

下列程式代碼範例包含系結至指定地區設定之顯示規範容器的函式:

/**********
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;
}