Share via


Metodo IDWriteLocalizedStrings::GetString (dwrite.h)

Copia la stringa con l'indice specificato nella matrice specificata.

Sintassi

HRESULT GetString(
        UINT32 index,
  [out] WCHAR  *stringBuffer,
        UINT32 size
);

Parametri

index

Tipo: UINT32

Indice in base zero della coppia lingua/stringa da esaminare.

[out] stringBuffer

Tipo: WCHAR*

Matrice con terminazione Null di caratteri che riceve la stringa dalla coppia lingua/stringa. Il buffer allocato per questa matrice deve essere almeno la dimensione delle dimensioni. GetStringLength può essere usato per ottenere le dimensioni della matrice prima di usare questo metodo.

size

Tipo: UINT32

Dimensione della matrice in caratteri. Le dimensioni devono includere spazio per il carattere Null terminante. GetStringLength può essere usato per ottenere le dimensioni della matrice prima di usare questo metodo.

Valore restituito

Tipo: HRESULT

Se questo metodo ha esito positivo, restituisce S_OK. In caso contrario, restituisce un codice di errore HRESULT .

Commenti

La stringa restituita deve essere allocata dal chiamante. È possibile ottenere le dimensioni della stringa usando il metodo GetStringLength prima di chiamare GetString, come illustrato nell'esempio seguente.

UINT32 length = 0;

// Get the string length.
if (SUCCEEDED(hr))
{
    hr = pFamilyNames->GetStringLength(index, &length);
}

// Allocate a string big enough to hold the name.
wchar_t* name = new (std::nothrow) wchar_t[length+1];
if (name == NULL)
{
    hr = E_OUTOFMEMORY;
}

// Get the family name.
if (SUCCEEDED(hr))
{
    hr = pFamilyNames->GetString(index, name, length+1);
}

Requisiti

Requisito Valore
Client minimo supportato Windows 7, Windows Vista con SP2 e Aggiornamento della piattaforma per Windows Vista [app desktop | App UWP]
Server minimo supportato Windows Server 2008 R2, Windows Server 2008 con SP2 e Platform Update per Windows Server 2008 [app desktop | App UWP]
Piattaforma di destinazione Windows
Intestazione dwrite.h
Libreria Dwrite.lib
DLL Dwrite.dll

Vedi anche

IDWriteLocalizedStrings