2014-03-04 3 views
1

"OpenWith" 대화 상자를 열어야하는데, 사용자가 어떤 파일을 열 수있는 프로그램을 선택할 수 있습니다 (예 : .xml).
비스타와 강판에서는 SHOpenWithDialog을 통해 처리 할 수 ​​있지만 Windows XP도 지원해야합니다.Windows XP 용 SHOpenWithDialog 아날로그?

+1

[가능한 "파일 열기 대화 상자를 어떻게 표시합니까?] (http://stackoverflow.com/questions/4726441/how-can-i-show-the-open-with- 파일 대화 상자) –

답변

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