我有用 VC++ 开发的 Windows 应用程序。我正在使用 CFileDialog 来显示一个对话框。但是,当我右键单击该对话框时,它崩溃了。相同的代码在 XP 中运行良好。我读到一些不再支持 Vista 风格的地方。所以我修改了代码如下。我还是崩溃了
CFileDialog dlg(FALSE, _T("*.xml"),strFileName ,OFN_HIDEREADONLY,
_T("(*.xml)|*.xml|(*.*)|*.*||"), NULL, 0,FALSE);
if (IDOK == dlg.DoModal()) //crash here on right click
{
//CString folder = dlg.GetFolderPath();
strFileName = dlg.GetPathName();
SetFileName ( T2CW (strFileName));
}
以下是堆栈跟踪
ole32!CServerContextActivator::CreateInstance+245 ole32!ActivationPropertiesIn::DelegateCreateInstance+5e ole32!CApartmentActivator::CreateInstance+88 ole32!CProcessActivator::CCICallback+4e ole32!CProcessActivator::AttemptActivation+33 ole32!CProcessActivator::ActivateByContext+7f ole32! CProcessActivator::CreateInstance+77 ole32!ActivationPropertiesIn::DelegateCreateInstance+5e ole32!CClientContextActivator::CreateInstance+eb ole32!ActivationPropertiesIn::DelegateCreateInstance+5e ole32!ICoCreateInstanceEx+5f5 ole32!CoCreateInstance+17b shell32!_SHCoCreateInstance+209 shell32!SHExtCoCreateInstance+28 shell32!DCA_SHExtCoCreateInstance+3d shell32!HDXA_QueryContextMenu+287 shell32!CDefFolderMenu::QueryContextMenu+625 shell32!CContextMenuOnContextMenuArray::_QueryNthContextMenu shell32!CContextMenuOnContextMenuArray::QueryContextMenu+b0 shell32!CDefView::_DoContextMenuPopup+19d shell32!CDefView::OnBackgroundContextMenu+2d1 shell32!CListViewHost::ShowContextMenu+1f1 shell32!CDefView::_OnContextMenu+110 shell32!CDefView::WndProc+889 shell32!CDefView::s_WndProc+7c user32!UserCallWinProcCheckWow+ 1ad user32!CallWindowProcAorW+dc user32!CallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::_ViewSubclassWndProc+3e1 shell32!CListViewHost::s_ViewSubclassWndProc+4f comctl32_7fefbdd0000!CallNextSubclassProc +8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchClientMessage+c3 user32!_fnDWORD+2d ntdll!KiUserCallbackDispatcherContinue user32!ZwUserMessageCall+a user32!RealDefWindowProcWorker+a4 user32!RealDefWindowProcW+5a uxtheme!DoMsgDefault+2a uxtheme!OnDwpContextMenu+ef uxtheme!_ThemeDefWindowProc+209 uxtheme!ThemeDefWindowProcW+11 user32!DefWindowProcW+e6 comctl32_7fefbdd0000!CListView::WndProc+2a42 comctl32_7fefbdd0000!CListView::s_WndProc+6cd user32!UserCallWinProcCheckWow+1ad user32 !CallWindowProcAorW+dc user32!CallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow +1ad user32!SendMessageWorker+682 user32!SendMessageW+5c comctl32_7fefbdd0000!CLVMouseManager::HandleMouse+f8c comctl32_7fefbdd0000!CListView::WndProc+9dc comctl32_7fefbdd0000!CListView::s_WndProc+6cd user32!UserCallWinProcCheckWow+1ad user32!CallWindowProcAorW+dc user32!CallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+ 8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 userShow32!DialogBoxIndirectParamW+18 comdlg32 保存: !_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThreadProc+19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1dUserCallWinProcCheckWow+1ad user32!CallWindowProcAorW+dc user32!CallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+ e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNew !CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThreadProc+19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1dUserCallWinProcCheckWow+1ad user32!CallWindowProcAorW+dc user32!CallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+ e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNew !CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThreadProc+19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1dCallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+ 3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d s +19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1dCallWindowProcW+18 comctl32_7fefbdd0000!CallOriginalWndProc+1d comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!DefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+ 3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d s +19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1dDefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+ 135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThreadProc+19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserDefSubclassProc+7c shell32!DefSubclassProc+56 shell32!CListViewHost::s_ListViewSubclassWndProc+31e comctl32_7fefbdd0000!CallNextSubclassProc+8c comctl32_7fefbdd0000!MasterSubclassProc+e7 user32!UserCallWinProcCheckWow+1ad user32!DispatchMessageWorker+3b5 user32!IsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+ 135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThreadProc+19b kernel32!BaseThreadInitThunk+d ntdll!RtlUserIsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThread+2d shlwapi!WrapperThread+2d shlwapi!WrapperThread+ !BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1dIsDialogMessageW+153 user32!DialogBox2+197 user32!InternalDialogBox+135 user32!DialogBoxIndirectParamAorW+58 user32!DialogBoxIndirectParamW+18 comdlg32!CFileOpenSave::Show+1af comdlg32!_InvokeNewFileOpenSave+db comdlg32!CSTADialog::s_DialogThreadProc+2d shlwapi!WrapperThread+2d shlwapi!WrapperThread+2d shlwapi!WrapperThread+ !BaseThreadInitThunk+d ntdll!RtlUserThreadStart+1d