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.
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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.