SHOpenWithDialog function (shlobj_core.h)

Displays the Open With dialog box.

Syntax

SHSTDAPI SHOpenWithDialog(
  [in, optional] HWND             hwndParent,
  [in]           const OPENASINFO *poainfo
);

Parameters

[in, optional] hwndParent

Type: HWND

The handle of the parent window. This value can be NULL.

[in] poainfo

Type: const OPENASINFO*

A pointer to an OPENASINFO structure, which specifies the contents of the resulting dialog.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Starting in Windows 10, the OAIF_ALLOW_REGISTRATION, OAIF_FORCE_REGISTRATION, and OAIF_HIDE_REGISTRATION flags will be ignored by SHOpenWithDialog. The Open With dialog box can no longer be used to change the default program used to open a file extension. You can only use SHOpenWithDialog to open a single file.

If SHOpenWithDialog is called without passing OAIF_EXEC, the user will receive a dialog that informs them that they can change the default programs used to open file extensions in their Settings.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h)
Library Shell32.lib
DLL Shell32.dll
API set ext-ms-win-shell-shell32-l1-2-1 (introduced in Windows 10, version 10.0.10240)