小编Hyp*_*ion的帖子

检查应用程序是否安装在注册表中

现在我使用它来列出注册表中列出的32bit和64的所有应用程序.我已经看到了如何检查应用程序是否安装没有任何运气的其他示例.

string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
if (key != null)
{
    foreach (String a in key.GetSubKeyNames())
    {
        RegistryKey subkey = key.OpenSubKey(a);
        Console.WriteLine(subkey.GetValue("DisplayName"));
    }
}

registryKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
key = Registry.LocalMachine.OpenSubKey(registryKey);
if (key != null)
{
    foreach (String a in key.GetSubKeyNames())
    {
        RegistryKey subkey = key.OpenSubKey(a);
        Console.WriteLine(subkey.GetValue("DisplayName"));
    }
}
Run Code Online (Sandbox Code Playgroud)

因此,这个片段在控制台窗口中列出了所有内容,我想要做的就是从显示名称列表中找到一个程序标题,看它是否已安装.

我尝试的最后一件事是

if (subkey.Name.Contains("OpenSSL"))
    Console.Writeline("OpenSSL Found");
else
    Console.Writeline("OpenSSL Not Found");
Run Code Online (Sandbox Code Playgroud)

我试过的任何东西都是假的或假的.有没有人可以告诉我如何从列表中获取一个标题?

请不要发布众所周知的私有静态void IsApplicationInstalled(p_name)函数.它对我来说根本不起作用.

c c# windows registry

12
推荐指数
3
解决办法
2万
查看次数

PHP从while循环字符串中删除最后2个字符

我在循环语句中返回一个列表,并尝试从结果中删除最后两个字符:逗号和空格.

在我尝试使用trim,rtrim,implode和strlength之前,这是我的类函数

function ReturnPlayerList()
{
    global $sql;
    $pull = $sql->Query($GLOBALS['GET_PLAYERS']);
    while ($pullrow = mysqli_fetch_array($pull))
    {
        $name = $sql->Query($this->ReturnForumUser($pullrow['UID']));
        while ($nameRow = mysqli_fetch_array($name))
        {
            echo $nameRow['username']."(".$pullrow['char_name']."), ";
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

如何删除最终分隔符?

php

0
推荐指数
1
解决办法
549
查看次数

标签 统计

c ×1

c# ×1

php ×1

registry ×1

windows ×1