请,我需要在Windows7和Windows Vista中写入注册表的帮助. [英] Please, I need help with writing to registry in windows7 and windows Vista.

查看:85
本文介绍了请,我需要在Windows7和Windows Vista中写入注册表的帮助.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用XP开发32位应用程序.但是,最近我尝试在Vista中运行该应用程序,但发现Vista不允许我的应用程序写入Windows文件夹,也不允许我写入注册表.我通常会写信给HKEY_CURRENT_USER.

请执行以下操作,以便我的应用程序能够写入Windows目录,尤其是注册表.

I develop 32bit applications with XP. However, recently I attempted to run the application in Vista but discovered vista wouldn''t allow my application to write to windows folder neither would it allow me to write to registry. I usually write to HKEY_CURRENT_USER.

Please what must I do so that my application will be able to write to windows directory and especially the registry.

推荐答案

您需要设置要运行的应用程序清单具有管理员权限.假设您使用的是Visual Studio,则可以通过选择 Linker->从项目的属性"中执行此操作.清单文件,然后在 UAC执行级别选项下拉菜单中选择 requireAdministrator .
You need to set the manifest of your application to run with administrator privilege. Assuming you are using Visual Studio, you do this from the project''s Properties by selecting Linker -> Manifest File and select requireAdministrator in the UAC Execution Level options drop-down.


您的应用程序已损坏,并且您需要修复它.我知道这一点,因为我处理了完全相同的问题.由于我不知道您的应用程序能做什么,我只能建议google Windows vista/7应用程序迁移问题.但是,我会向您指出:

Your application is broken, and you need to fix it. I know this, because I dealt with exactly the same issue. Since I don''t know what your application does, all I can suggest is to google windows vista/7 application migration issues. However, I would point you toward:

HRESULT hResult = SHGetFolderPath(NULL, 
  CSIDL_PERSONAL|CSIDL_FLAG_CREATE,   // could also use CSIDL_APPDATA,
                                      // NEVER use CSIDL_COMMON_APPDATA
  NULL, 
  0, 
  szFolderPath);



如果您搜索CSIDL标志,您将了解需要做的事情.



If you search on the CSIDL flags, you''ll learn what you need to do.


这篇关于请,我需要在Windows7和Windows Vista中写入注册表的帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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