IQueryAssociations::GetString method (shlwapi.h)

Searches for and retrieves a file or protocol association-related string from the registry.


HRESULT GetString(
  [in]            ASSOCF   flags,
  [in]            ASSOCSTR str,
  [in, optional]  LPCWSTR  pszExtra,
  [out, optional] LPWSTR   pszOut,
  [in, out]       DWORD    *pcchOut


[in] flags


A flag that can be used to control the search. It can be any combination of the following ASSOCF values.

[in] str


An ASSOCSTR value that specifies the type of string that is to be returned.

[in, optional] pszExtra


A pointer to an optional, null-terminated Unicode string with information about the location of the string. It is typically set to a Shell verb such as open. Set this parameter to NULL if it is not used.

[out, optional] pszOut


A pointer to a null-terminated Unicode string used to return the requested string. Set this parameter to NULL to retrieve the required buffer size.

[in, out] pcchOut

Type: DWORD*

A pointer to a value that, on entry, is set to the number of characters in the pwszOut buffer. When the function returns successfully, it points to the number of characters placed in the buffer.

If the ASSOCF_NOTRUNCATE flag is set in flags and the buffer specified in pwszOut is too small, the function returns E_POINTER and pcchOut points to the required size of the buffer.

If pwszOut is NULL, the function returns S_FALSE and pcchOut points to the required size of the buffer.

Return value


Returns a standard COM error value, including the following:

Error Meaning
S_OK Success.
E_POINTER The pwszOut buffer is too small to hold the entire string.
S_FALSE pwszOut is NULL. pcchOut contains the required buffer size.


Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shell32.dll (version 5.0 or later)