Correct the behaviour of OpenWith Dialog

147 views Asked by At

I write a C++ project using MFC, and I've catched a small but unpleasant bug. I have an option to open, for example, .ai file using OpenWith Dialog box. As you know, there is a checkbox “Always use the selected program to open this kind of file” Option in OpenWithDialog Box. And if user, for example selects WindowsImageViewer(WIV) and forgets to disable checkbox, windows opens this file in WIV and of cource writes, that file cannot be opened. And then, all files of .ia format can be open only with WIM. This problem can be solved by editing regedit but it is not user friendly.

Can you advise something helpful, for example deleting or making inactive the checkbox.

That is the way, how I call OpenWithDialog: AGS::WString path = L"shell32.dll,OpenAs_RunDLL " + f.getAbsolutePath(); ShellExecute(NULL, L"open", L"rundll32.exe", path.c_str(), NULL, SW_SHOW);

2

There are 2 answers

2
Razomni On

Added " " to the end of file path. AGS::WString path = L"shell32.dll,OpenAs_RunDLL " + f.getAbsolutePath() + " ";

0
rrirower On

Try using SHOpenWithDialog and setting the appropriate flags.