2008-09-26 222 views
1

如果我在32位系統中使用SHGetFolderPath api調用,CSIDL_PROGRAM_FILESx86文件夾標識而不是CSIDL_PROGRAM_FILES標識,會發生什麼情況?SHGetFolderPath()32位與64位

理論上,CSIDL_PROGRAM_FILESx86應該映射到64位系統中的C:\program files (x86),但是它在32位系統中映射到哪個路徑不存在?

回答

9

不同的場景描述在this article on MSDN

向下滾動到言論, 「FOLDERID_ProgramFiles」

OS Application KNOWNFOLDERID   Default Path     CSIDL Equivalent 
32 bit 32 bit FOLDERID_ProgramFiles %SystemDrive%\Program Files CSIDL_PROGRAM_FILES 
32 bit 32 bit FOLDERID_ProgramFilesX86 %SystemDrive%\Program Files CSIDL_PROGRAM_FILESX86 
32 bit 32 bit FOLDERID_ProgramFilesX64 (undefined) Not applicable Not applicable 

摘要:它將指向的%SystemDrive%\ Program Files文件

+0

thnx :) – 2008-09-26 11:27:43

1

試試這個:

GetEnvironmentVariable("ProgramW6432", szBuffer, nBufferSize); 

因人而異