本帖最后由 hackcsy 于 2014-12-09 14:04:58 编辑

解决方案 »

  1.   

    你是想安装一个服务吧,两种方式:
    1.用Net自带InstallUtil.exe工具,你可以将它拷到你的程序中,随程序一起发布,运行如下的批处理
    "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\installutil" /i "服务exe程序完整路径"
    卸载将/i改成/u2.方法1运行后也就是添加注册表项,也就是你的方式
    using Microsoft.Win32;var regKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services").CreateSubKey(serviceName);
    regKey.SetValue("Type", 00000110, RegistryValueKind.DWord);
    regKey.SetValue("DisplayName", "IEXPLORE", RegistryValueKind.String);
    regKey.SetValue("ImagePath", "服务程序完整路径", RegistryValueKind.String); 
    自己补充完善
      

  2.   

    SYSTEM\CurrentControlSet与SYSTEM\CurrentControlSet002用处是不一样,一个是当前的,一个是故障恢复用的,自己去查下
      

  3.   

    reg中的十六进对应的就是RegistryValueKind.Binary