日期:2014-05-18  浏览次数:21022 次

vs2005 安装部署的问题
用VS2005制作安装程序,在用户界面中加了一个复选按钮界面,其中有一个Checkbox,   "□登入   Windows   後,   自動執行   EIP   Notifier "如果用户勾选怎写注册表信息,不选就不写。在安装的过程中如何判断勾选还是没有勾选呢?写注册表代码如下:

  public   override   void   Install(IDictionary   stateSaver)
                {
                        int   i   =   0;
                        string   stLocation;
                        RegistryKey   parentkey;
                                           
                        parentkey   =   Microsoft.Win32.Registry.CurrentUser.OpenSubKey( "SoftWare ").OpenSubKey( "Microsoft ").OpenSubKey( "Windows ").OpenSubKey( "CurrentVersion ").OpenSubKey( "Run ",   true);

                        Assembly   asm   =   Assembly.GetExecutingAssembly();
                        stLocation   =   asm.Location;//得到安装路径。
                        if   (stLocation.Length   >   0)
                                i   =   stLocation.LastIndexOf( "\\ ");
                        if   (i!=0)
                                stLocation   =   stLocation.Substring(0,stLocation.LastIndexOf( "\\ "));

//   怎么得到是否勾选了写注册表。
                        parentkey.SetValue( "EIPNotify ",   stLocation   +   "\\EIPNotify.exe ");//写注册表。
                                               
                        base.Install(stateSaver);
                }

------解决方案--------------------
呵呵,还真没有用过预置的。

看下先。。。。