gpt4 book ai didi

c++ - SHOpenWithDialog 模拟 Windows XP?

转载 作者:太空宇宙 更新时间:2023-11-04 13:54:19 25 4
gpt4 key购买 nike

我需要打开“OpenWith”对话框,用户可以在其中选择将打开某些文件的程序,例如.xml
在 vista 和 grater 中,它可以通过 SHOpenWithDialog 完成,但我也需要支持 windows XP。

最佳答案

 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);
}

关于c++ - SHOpenWithDialog 模拟 Windows XP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22177851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com