请教一个问题,
我想通过菜单调用一个exe文件,先通过对话框设置它的地址,
请问
怎么把这个地址写入注册表
再将其读到程序里去呢?

解决方案 »

  1.   

    2L的代码不错,应该能满足LZ的需要了
      

  2.   

    using Microsoft.Win32;  //引入命名空间string path=@"C:\test.exe";    //你的exe文件路径
    写入注册表
    Registry.SetValue("HKEY_CURRENT_USER\\SubPath", "Path", path);读取
    object objPath = Registry.GetValue("HKEY_CURRENT_USER\\SubPath", "Path", null);
                if (objDailySend != null)  //存在路径值则读取
                {
                    string path = objPath.ToString();
                }
      

  3.   

    crosoft.Win32; //引入命名空间string path=@"C:\test.exe"; //你的exe文件路径
    写入注册表
    Registry.SetValue("HKEY_CURRENT_USER\\SubPath", "Path", path);读取
    object objPath = Registry.GetValue("HKEY_CURRENT_USER\\SubPath", "Path", null);
      if (objDailySend != null) //存在路径值则读取
      {
      string path = objPath.ToString();
      }
      

  4.   

    RegistryKey reg= Registry.LocalMachine;
    RegistryKey key= reg.OpenSubKey("",true); 
    key.SetValue("", ""); private string GetRegistData(string name)  
    {  
       RegistryKey lm= Registry.LocalMachine;  
       RegistryKey software = lm.OpenSubKey("SOFTWARE",true);  
       RegistryKey k= software.OpenSubKey("",true);  
       string registData = k.GetValue(name).ToString();  
       return registData;