1、安装项目上右击->View->注册表
2、在HKEY_LOCAL_MACHINE下的Software下面新建PrinterPlugin文件夹,添加完后,选中PrinterPlugin文件夹,在右边空白处右击选择New->字符串值
@[TARGETDIR] 是安装路径(绝对路径,会默认带一个前缀@符号)
PrinterConfiger.exe是文件的名
3、值的获取
RegistryKey software = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
List<string> softwareSubs = software.GetSubKeyNames().ToList();
if (softwareSubs.Where(r => r.Equals("PrinterPlugin")).Any())
{
RegistryKey printerPlugin = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\PrinterPlugin", true);
var appStartPathObj = printerPlugin.GetValue("configerpath");
if (appStartPathObj == null)
return false;
//将前面默认的@符号去掉
var appStartpath = appStartPathObj.ToString().Substring(1, appStartPathObj.ToString().Length - 1);
}