1

I need to open "OpenWith" dialog , where user can select program which will open some file, for example .xml.
In vista and grater it can be done via SHOpenWithDialog , but I need to support windows XP as well.

  • 1
    possible duplicate of [How can I show the "Open with" file dialog?](http://stackoverflow.com/questions/4726441/how-can-i-show-the-open-with-file-dialog) – Hans Passant Mar 04 '14 at 16:47

1 Answers1

0
 bool BrowseOpenWith(const HWND hwnd, LPCTSTR lpszFilename)
{
ASSERT(!IsBadStringPtr(lpszFilename,INFINITE));
ASSERT(_tcslen(lpszFilename));

if (hwnd) {
    ASSERT(IsWindow(hwnd));
}

const CString strCmd=
    TEXT("shell32.dll,OpenAs_RunDLL ")
    +CString(lpszFilename);

const int nRet
    =(int)ShellExecute(hwnd,TEXT("open")
    ,TEXT("Rundll32.exe")
    ,strCmd
    ,NULL
    ,SW_SHOW);

return (nRet>32);
}
Carc
  • 1
  • 1
  • 1