This problem IS fixed in VS70 and MFC70. The problem only happens when you are using VC6 and MFC4
因为VC6 and MFC4的定义没有更新,而实际的SDK已经更新了,从而导致在卸载的时候多卸载了内容。
替换的方法:
CString SimplePickFile(CWnd *pWnd, LPCTSTR pszTitle)
{
OPENFILENAME ofn;
TCHAR pszFile[MAX_PATH*2];
_tcscpy(pszFile, _T("") );
memset( &ofn, 0, sizeof(ofn) );
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = pWnd ? pWnd->m_hWnd : GetActiveWindow();
ofn.lpstrFile = pszFile;
ofn.nMaxFile = sizeof(pszFile);
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON | OFN_FILEMUSTEXIST;
ofn.lpstrFilter = _T("All Files (*.*)\0*.*\0Executables (*.exe;*.ocx;*.dll)\0*.exe;*.ocx;*.dll\0");
ofn.lpstrTitle = pszTitle ? pszTitle : _T("Please select a file");
if (GetOpenFileName( &ofn ))
return pszFile;
else
return CString();
}
===============================
谢谢大家的热情解答,问题已经解决了,主要是利用了15楼的建议,我一开始也觉得是mfc的bug,但是不知道怎样绕开,有了你的建议后,改成
CFileDialog *mm = new CFileDialog(),然后自己delete mm ;
一切OK。具体产生这个问题的原因还希望高手能够给出意见。
谢谢!!!