using (RegistryKey key = RegistryLocalMachineOpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))
{
if (key != null)//判断对象存在
{
foreach (string keyName in keyGetSubKeyNames())//遍历子项名称的字符串数组
{
using (RegistryKey key2 = keyOpenSubKey(keyName, false))//遍历子项节点
{
if (key2 != null)
{
string softwareName = key2GetValue("DisplayName", "")ToString();//获取软件名
string installLocation = key2GetValue("InstallLocation", "")ToString();//获取安装路径
if (!stringIsNullOrEmpty(installLocation))
{
//将信息添加到ListView控件中
ListViewItem item = new ListViewItem(softwareName);
itemSubItemsAdd(installLocation);
listView1ItemsAdd(item);
}
}
}
}
}
}
}
Public Function GetTypeFilePath(ByVal mType As String)
mType = mTypeTrim
If mTypeSubstring(0, 1) <> "" Then mType = "" & mType
Dim Key As MicrosoftWin32RegistryKey = MicrosoftWin32RegistryClassesRootOpenSubKey(mType)
Dim Result As String = ""
If Not Key Is Nothing Then
Dim SubKeyValue As Object
Dim Value As String
SubKeyValue = KeyGetValue("")
If Not SubKeyValue Is Nothing Then
Value = SubKeyValueToString
Dim SubKey As MicrosoftWin32RegistryKey, ResultKey As MicrosoftWin32RegistryKey
SubKey = MicrosoftWin32RegistryClassesRootOpenSubKey(Value)
If Not SubKey Is Nothing Then
ResultKey = SubKeyOpenSubKey("shell\open\command\", False)
If Not ResultKey Is Nothing Then
Result = ResultKeyGetValue("")ToString
End If
End If
End If
End If
Return Result
End Function
RegistryKey loc = RegistryLocalMachine;
RegistryKey reg = locOpenSubKey("SoftWare")OpenSubKey("Microsoft")
OpenSubKey("CurrentVersion")OpenSubKey("Installer")OpenSubKey("Folders", true);
string str_value = regGetValue(@"C:\Program Files\Tencent\QQ\")ToString(); //读取注册表
MessageBoxShow(str_value);
locClose();
以上就是关于C#中如何获取资源管理器里面的文件全部的内容,包括:C#中如何获取资源管理器里面的文件、vb.net,知道一个文件的扩展名,如何获得该类型文件的默认打开程序。、怎样用C#获取到蓝色部分的值,这是在注册表中.等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)