IQueryAssociations::Init method (shlwapi.h)
Initializes the IQueryAssociations interface and sets the root key to the appropriate ProgID.
Syntax
HRESULT Init(
[in] ASSOCF flags,
[in, optional] LPCWSTR pszAssoc,
[in, optional] HKEY hkProgid,
[in, optional] HWND hwnd
);
Parameters
[in] flags
Type: ASSOCF
A flag that specifies how the search is to be initialized. It is typically set to zero, but it can also take one of the following ASSOCF values.
[in, optional] pszAssoc
Type: LPCWSTR
A Unicode string that is used to determine the root key. If a value is specified for hkProgid, set this parameter to NULL. Four types of string can be used:
File name extension
A file name extension, such as .txt.
CLSID
A CLSID GUID in the standard "{GUID}" format.
ProgID
An application's ProgID, such as Word.Document.8.
Executable name
The name of an application's .exe file. The ASSOCF_OPEN_BYEXENAME flag must be set in flags.
[in, optional] hkProgid
Type: HKEY
The HKEY value of the subkey that is used as a root key. The search looks only below this key. If a value is specified for pwszAssoc, set this parameter to NULL.
[in, optional] hwnd
Type: HWND
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
This method initializes the interface, and is also called each time you need to specify a new root key. You can use pwszAssoc to specify a string, such as a file name extension or its associated ProgID, that identifies the root key. You can also specify the root key's HKEY value. Init will then use this information to locate the root key in the registry. Subsequent calls to the other IQueryAssociations methods will use it as their starting point and search for the information in the root key's subkeys.
Requirements
Requirement | Value |
---|---|
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) |