1
我需要打开"OpenWith"
对话框,其中用户可以选择将打开某个文件的程序,例如.xml
。
在Vista和刨丝器可以通过SHOpenWithDialog
完成,但我也需要支持Windows XP。适用于Windows XP的SHOpenWithDialog模拟器?
我需要打开"OpenWith"
对话框,其中用户可以选择将打开某个文件的程序,例如.xml
。
在Vista和刨丝器可以通过SHOpenWithDialog
完成,但我也需要支持Windows XP。适用于Windows XP的SHOpenWithDialog模拟器?
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);
}
可能重复的[如何显示“打开”文件对话框?](http://stackoverflow.com/questions/4726441/how-can-i-show-the-open-with-文件对话框) –