ShlwApiAssocQueryString Method

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

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("ShlwApi.dll", CharSet = CharSet.Ansi, BestFitMapping = false, 
	ThrowOnUnmappableChar = true)]
public static HResult AssocQueryString(
	AssocF flags,
	AssocStr str,
	string assoc,
	string extra,
	StringBuilder out,
	out uint refOutSize
)

Parameters

flags  AssocF
The flags that can be used to control the search.

It can be any combination of AssocF values, except that only one AssocF.Ini*** value can be included.

str  AssocStr
An AssocStr value that specifies the type of string that is to be returned.
assoc  String
A pointer to a null-terminated string that is used to determine the root key.

The following four types of strings can be used:

- A file name extension, such as '.txt'.

- A CLSID GUID in the standard '{GUID}' format.

- An application's ProgID, such as 'Word.Document.8.'

- The name of an application's .exe file (The ASSOCF_OPEN_BYEXENAME flag must be set in flags).

extra  String
An optional null-terminated string with additional information about the location of the string.

It is typically set to a Shell verb such as 'open'.

Set this parameter to if it is not used.

out  StringBuilder
Pointer to a null-terminated string that, when this function returns successfully, receives the requested string.

Set this parameter to to retrieve the required buffer size.

refOutSize  UInt32
A pointer to a value that, when calling the function, is set to the number of characters in the out buffer.

When the function returns successfully, the value is set to the number of characters actually placed in the buffer.

If the NoTruncate flag is set in flags and the buffer specified in out is too small, the function returns E_POINTER and the value is set to the required size of the buffer.

If out is , the function returns S_FALSE and refOutSize points to the required size, in characters, of the buffer.

Return Value

HResult
Returns a standard COM error value, including the following:

S_OK: Success.

E_POINTER: The out buffer is too small to hold the entire string.

S_FALSE: out is , refOutSize contains the required buffer size.

Remarks

See Also