我有用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
user32!DialogBoxIndirectParamW + 18
comdlg32!CFileOpenSave :: Show + 1af
comdlg32!_InvokeNewFileOpenSave + db
comdlg32!CSTADialog :: s_DialogThreadProc + 2d
shlwapi!WrapperThreadProc + 19b
kernel32!BaseThreadInitThunk + d
ntdll!RtlUserThreadStart + 1d
最佳答案
如果我从上下文菜单中禁用了NVIDIA CPL上下文菜单扩展,此问题将得到解决。然而,由于相同的代码确实适用于其他应用程序,它仍然是一个谜。
关于c++ - Win7中的对话框崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19043936/