注册表中的应用程序名 [英] application name in registry

查看:161
本文介绍了注册表中的应用程序名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好日子专家,我只是想问一下安装后是否可以使用应用程序名称保存在注册表中?我有一个代码,可以在注册表中保存一些信息。

这里是我的代码:

 

appName =HRMS - 默认应用名称

SaveSetting(appName,数据库名称,文本,txtdbName.Text)

SaveSetting(appName,Instance Name,text,txtInstanceName.Text)

SaveSetting(appName,Server Name,text,txtServerName.Text)

SaveSetting(appName,User ID,text,txtUserId.Text)

SaveSetting(appName,Password,text,txtPassword.Text)

SaveSetting(appName,IP Address,text,txtIPAddress.Text)

解决方案

很有可能(您可以轻松找到注册表类在.NET FCL中),但注册表的污染是一个非常糟糕的主意。您应该更好地将应用程序信息存储在专用于此目的的磁盘区域中,每个用户帐户,用于所有用户。从.NET FCL,你应该找到合适的特殊文件夹。请看我过去的答案:

哪个更好:使用registery来存储设置或使用Settings类 [ ^ ]。



另请参阅我对此问题的回答:如何查找我的程序目录 [ ^ ]。



-SA


good day experts, i just want to ask if it is possible to use the application name to save in registry after installation? i have a code which save some info in registry.
here is my code:

appName = "HRMS" --default app name
SaveSetting(appName, "Database Name", "text", txtdbName.Text)
SaveSetting(appName, "Instance Name", "text", txtInstanceName.Text)
SaveSetting(appName, "Server Name", "text", txtServerName.Text)
SaveSetting(appName, "User ID", "text", txtUserId.Text)
SaveSetting(appName, "Password", "text", txtPassword.Text)
SaveSetting(appName, "IP Address", "text", txtIPAddress.Text)

解决方案

It is quite possible (you can easily find registry classes in .NET FCL), but contamination of the registry is quite a bad idea. You should better store the application information in the area on the disk specially dedicated for this purpose, per user account, of for all users. From .NET FCL, you should find appropriate "special folder". Please see my past answer:
which is better : use of registery in order to store setting or use of Settings class[^].

See also my answer to this question: How to find my programs directory[^].

—SA


这篇关于注册表中的应用程序名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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