访问注册表 [英] Accessing Registry
本文介绍了访问注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个可以在计算机上显示已安装程序(或软件)列表的程序
i want a program that can displya a list of installed programs( or softwares)on a computer
推荐答案
您需要的数据在注册表中在
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall
那里的每个条目都有一个名为DisplayName的成员字符串,其中包含程序的名称.
要从程序内部访问注册表,您将需要使用以下功能:
RegOpenKeyEx [ RegQueryInfoKey [ RegEnumKeyEx [ RegEnumValue [ RegQueryValueEx [
The data you''re after is in the registry in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Every entry there has a member string called DisplayName with the name of the program.
To access the registry from within your program, you''ll want to use these functions:
RegOpenKeyEx[^] to open HKEY_LOCAL_MACHINE
RegQueryInfoKey[^] to open \SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
RegEnumKeyEx[^] to loop through all the installed programs
RegEnumValue[^] to loop through all the available data on this program
RegQueryValueEx[^] if you know in advance which value you want to read (e.g. DisplayName).
可能有很多方法可以做到,其中一些方法比其他方法更健壮.但是我相信,如果您查看注册表项"HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall",它将列出所有已安装的程序.
在该键下,有其他键的列表,这些键的名称为GUID.然后,这些键中将包含值,例如应用程序的名称,版本以及在XP中查看添加/删除程序"列表时将看到的其他数据.
达恩,萨迪斯·琼斯击败了我.
There are probably a number of ways of doing this, some more robust than others. But i believe if you look at the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", it lists all installed programs.
Under that key, there is a list of other keys whose name is a GUID. These keys then have values in them such as the app''s name, version, and other data that you will see when you view the Add/Remove Programs list in XP.
Darn, Thaddeus Jones beat me to it.
这篇关于访问注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文