Pergunta

O que acontece se eu usar SHGetFolderPath api chamada em um sistema de 32 bits com CSIDL_PROGRAM_FILESx86 id pasta em vez do id CSIDL_PROGRAM_FILES?

Teoricamente CSIDL_PROGRAM_FILESx86 deve mapear para C:\program files (x86) em um sistema de 64 bits, mas o que isso mapear para em um sistema de 32 bits, onde este caminho não existe?

Foi útil?

Solução

Os diferentes cenários são descritos no este artigo no MSDN .

Role para observações, "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

Resumo: Ele irá apontar para% SystemDrive% \ Arquivos de Programas

Outras dicas

Tente isto:

GetEnvironmentVariable("ProgramW6432", szBuffer, nBufferSize);

YMMV

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top