Windows 7:无法将文件保存到 Program Files?那么该写在哪里呢?

发布于 2024-09-30 23:16:59 字数 148 浏览 0 评论 0原文

问题与标题相关: Windows 7:无法将文件保存到 Program Files?那么该写在哪里呢?

我知道有一个AppData,但我不知道如何正确获取该目录?有API可以获取吗?

此 API 也获取 Windows XP 的 AppData 吗?

The question is related to the Title:
Windows 7: Can't save files to Program Files? So where to write?

I know that there is a AppData, but I don't know how to obtain the directory correclty? Is there an API to get it?

Do this API get the AppData for Windows XP too?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想挽留 2024-10-07 23:16:59

ShGetFolderPath(...,CSIDL_APPDATA,...,...,...);

是的,这也适用于 XP。您永远不应该在应用程序中使用硬编码路径。

http://msdn.microsoft.com/en-us/库/bb762181(VS.85).aspx

更新:
正如 Steve Townsend 指出的那样,从 Vista 开始,该 API 已被弃用。如果您的目标操作系统 > 您应该使用 SHGetKnownFolderPath XP。

ShGetFolderPath (..., CSIDL_APPDATA, ..., ..., ...);

Yes this works on XP too. You should never use hard coded paths in applications.

http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx

Update:
As Steve Townsend pointed out, this API is deprecated starting with Vista. You should use SHGetKnownFolderPath if you target an OS > XP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文