CDocument::SetPathName behaves differently in WinXp and Windows 7
When I called CDocument::SetPathN开发者_如何学Pythoname
with 'eererr.hpr' in Windows XP it updates the member variable m_strPathName
with value 'C:\Program Files\ICEHost\Projects\eererr.hpr'
When I executed the same method in Windows 7 it updated m_strPathName
with 'C:\Program Files\ICEHost\eererr.hpr'
Projects
directory is missing in this path
What is the reason for this difference in WinXp and Windows 7?
Based on what information does CDocument::SetPathName
updates m_strPathName
?
How can make the behavior same?
SetPathName()
calls GetFullPathName()
which "merges the name of the current drive and directory with a specified file name". So the difference is probably on how the current directory is obtained.
It is documented how CFileDialog selects a different initial directory on different OS (check lpstrInitialDir
in the following
link). Maybe it has to do with that.
You might need to override the AddToRecentFileList function. The Add method is now implemented differently with Win7. Check out this link
http://social.msdn.microsoft.com/Forums/en-NZ/vcgeneral/thread/3fcb5f77-3c62-4d62-b01c-89a121ea835f
精彩评论