[]
Gets file-association string from the registry.
public static extern uint AssocQueryString(int flags, int str, string pszAssoc, string pszExtra, StringBuilder pszOut, ref uint pcchOut)
Public Shared Function AssocQueryString(flags As Integer, str As Integer, pszAssoc As String, pszExtra As String, pszOut As StringBuilder, ByRef pcchOut As UInteger) As UInteger
| Type | Name | Description |
|---|---|---|
| int | flags | Use Win32.ASSOCF constants. |
| int | str | Use Win32.ASSOCSTR constants. |
| string | pszAssoc | |
| string | pszExtra | |
| StringBuilder | pszOut | |
| uint | pcchOut |
| Type | Description |
|---|---|
| uint | An Win32.OLE success/error code. |
To get associated exe's length/exe:
uint assocLen = 0;
AssocQueryString(ASSOCF.ASSOCF_INIT_DEFAULTTOSTAR,ASSOCSTR.ASSOCSTR_EXECUTABLE,Path.GetExtension(OutputFileName),"open",null,ref assocLen);
For existing files, another option is FindExecutable.