Sdílet prostřednictvím


Using SHGetSpecialFolderPath() to get the localized name of the "Program Files" folder

Someone asked this:

What is the proper way to find the localised name of the "Program Files" directory?
The SHGetSpecialFolderPath have no constant for this folder.
I currently use the registry setting:

HKLM/Pmail/Attachments/TopDir value

This works for all platforms from HPC Pro to WindowMoble 2003. I suppose this can be subject to change in the future.

There is a constant that was added in Ozone: CSIDL_PROGRAM_FILES. You may need a newer version of the SDK.

James Drage
Microsoft Windows Mobile Shell Team

Comments

  • Anonymous
    July 06, 2004
    Okay, what's Ozone?

  • Anonymous
    July 06, 2004
    Windows Mobile 2003.

    Neil

  • Anonymous
    July 07, 2004
    I have tried this on pocket pc 2000, pocket pc 2002 and windows mobile 2003.

    The only platform SHGetSpecialFolderPath works is windows mobile 2003.

    I read the API documentation for evc 3.0 without sp. The function of SHGetSpecialFolderPath is determined by the oem manufacturer.

    Could Microsoft please specify the models and makers that implements this API?

    Regards Niclas

  • Anonymous
    July 07, 2004
    SHGetSpecialFolderPath should be implemented on all devices but, as this post points out, CSIDL_PROGRAM_FILES was not added until 2003

  • Anonymous
    July 07, 2004
    Hello Robert, Please send me an email to niclas.l at remotex.se .

    I will send you code that shows an error on symbol 2800 series pocket pc 2002 devices.

    Regards /Niclas

  • Anonymous
    July 08, 2004
    Niclas,

    As was mentioned above, using CSIDL_PROGRAM_FILES only works on 2003 devices and later. It's known that it doesn't work on 2002 devices.

  • Anonymous
    July 23, 2004
    Note that the "HKLM/Pmail/Attachments/TopDir" registry key does not seem to exist on my Smartphone (2002). The "HKLM/Pmail/" registry key exists, but there is no reference to the localized Program Files directory name. :(

  • Anonymous
    September 12, 2007
    Filename = Environment.GetFolderPath(Environment.SpecialFolder.Programs)

  • Anonymous
    August 21, 2008
    Environment.GetFolderPath(Environment.SpecialFolder.Programs) returns \Windows\Start Menu\Programs rather than \Program Files