Win32函数获取C:\ ProgramData的路径 [英] Win32 function to get path to C:\ProgramData

查看:656
本文介绍了Win32函数获取C:\ ProgramData的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要安装一些可以在运行时由应用程序编辑的文件. Install shield提供了一个别名[CommonAppDataFolder],它将在Vista和Windows 7上解析为c:\ programData,并且也将在Windows XP上运行.是否有一个win32函数会返回相似的路径?

My app needs to install some files that can be edited by the application at run time. Install shield provides an alias [CommonAppDataFolder] that will resolve to c:\programData on Vista and Windows 7 and will also work on Windows XP. Is there a win32 function that will return a similar path?

也许我需要根据操作系统调用不同的功能?

Maybe I need to call different functions depending on the operating system?

推荐答案

SHGetFolderPath/SHGetSpecialFolderPath get you that, with CSIDL_COMMON_APPDATA argument.

在此处(底部)查看代码片段:如何编写存储用户和应用程序的Windows XP应用程序使用Visual C ++ 将数据放在正确的位置.

See code snippet here (at the bottom): How to write a Windows XP Application that stores user and application data in the correct location by using Visual C++ .

  • Windows XP:C:\ Documents and Settings \ All Users \ Application Data
  • Windows Vista:C:\ ProgramData
  • Windows 7:C:\ ProgramData

另请参阅: CSIDL .

这篇关于Win32函数获取C:\ ProgramData的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆