|
In a typical computer, most file types are registered
with known applications so the user can appropriately open a file. Sometimes
the user may be in the presence of a file that no application is
automatically configured to open. In some cases, the user can use the Open
With dialog box to select an application to open the file.
|
To display the Open With dialog box, you can call the
SHOpenWithDialog() function. Its syntax is:
HRESULT SHOpenWithDialog(
__in_opt HWND hwndParent,
__in const OPENASINFO *poainfo
);
Here is an example:
void CExerciseDlg::OnBnClickedOpenwithBtn()
{
OPENASINFO oai;
oai.pcszFile = L"C:\\Exercise\\Something.bmp";
oai.pcszClass = NULL;
oai.oaifInFlags = OAIF_ALLOW_REGISTRATION;
SHOpenWithDialog(m_hWnd, &oai);
}
This would produce: