IDWriteLocalizedStrings::FindLocaleName メソッド (dwrite.h)

指定したロケール名を持つロケール名/文字列ペアの 0 から始まるインデックスを取得します。

構文

HRESULT FindLocaleName(
  [in]  WCHAR const *localeName,
  [out] UINT32      *index,
  [out] BOOL        *exists
);

パラメーター

[in] localeName

型: const WCHAR*

検索するロケール名を含む文字の null で終わる配列。

[out] index

型: UINT32*

ロケール名/文字列ペアの 0 から始まるインデックス。 このメソッドは、 インデックスUINT_MAXに初期化します。

[out] exists

型: BOOL*

このメソッドが戻るときに、ロケール名が存在する場合は TRUE が含まれます。それ以外の場合は FALSE。 このメソッドは FALSE に初期化されます

戻り値

型: HRESULT

指定したロケール名が存在しない場合、戻り値はS_OKされますが、インデックスUINT_MAXされ、存在する場合は FALSE になります

注釈

ロケール名が存在しない場合、戻り値は成功であり、 exists パラメーターは FALSE であることに注意してください。 フォントのフォント ファミリ名を取得していて、指定したロケール名が存在しない場合は、次に示すようにインデックスを 0 に設定します。 フォント ファミリには常に少なくとも 1 つのロケールがあります。

UINT32 index = 0;
BOOL exists = false;

wchar_t localeName[LOCALE_NAME_MAX_LENGTH];

if (SUCCEEDED(hr))
{
    // Get the default locale for this user.
    int defaultLocaleSuccess = GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH);

    // If the default locale is returned, find that locale name, otherwise use "en-us".
    if (defaultLocaleSuccess)
    {
        hr = pFamilyNames->FindLocaleName(localeName, &index, &exists);
    }
    if (SUCCEEDED(hr) && !exists) // if the above find did not find a match, retry with US English
    {
        hr = pFamilyNames->FindLocaleName(L"en-us", &index, &exists);
    }
}

// If the specified locale doesn't exist, select the first on the list.
if (!exists)
    index = 0;

要件

   
サポートされている最小のクライアント Windows 7、Windows Vista SP2 および Windows Vista 用プラットフォーム更新プログラム [デスクトップ アプリ |UWP アプリ]
サポートされている最小のサーバー Windows Server 2008 R2、Windows Server 2008 SP2 および Windows Server 2008 用プラットフォーム更新プログラム [デスクトップ アプリ |UWP アプリ]
対象プラットフォーム Windows
ヘッダー dwrite.h
Library Dwrite.lib
[DLL] Dwrite.dll

こちらもご覧ください

IDWriteLocalizedStrings