简体   繁体   中英

SHOpenWithDialog analog for windows XP?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM