C#判断某个软件是否已安装实现代码分享
程序员文章站
2022-06-14 17:26:14
private void button1_click(object sender, eventargs e)
{
if (checkadoberea...
private void button1_click(object sender, eventargs e) { if (checkadobereader() == true) { messagebox.show("有安裝 adobe reader "); } else { messagebox.show("沒有安裝 adobe reader "); } } /// <summary> /// 確認是否有安裝 adobe reader /// </summary> /// <returns>true: 有安裝, false:沒有安裝</returns> private bool checkadobereader() { microsoft.win32.registrykey uninstallnode = microsoft.win32.registry.localmachine.opensubkey(@"software/microsoft/windows/currentversion/uninstall"); foreach (string subkeyname in uninstallnode.getsubkeynames()) { microsoft.win32.registrykey subkey = uninstallnode.opensubkey(subkeyname); object displayname = subkey.getvalue("displayname"); if (displayname != null) { if (displayname.tostring().contains("adobe reader")) { return true; // messagebox.show(displayname.tostring()); } } } return false; }
上一篇: 比较全的一个C#操作word文档示例
下一篇: vector-空间增长