问题如上,还有如果实现了上述功能,我希望系统自动启动时加载本程序时窗口最小化,而平常双击打开时以平常窗口打开,如何实现!谢谢各位高手指导方向.

解决方案 »

  1.   

    用Registry:
    RegistryKey  regWrite= Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\YourKey);regWrite.SetValue("Your.exe");
      

  2.   

    少写了一个 "RegistryKey  regWrite= Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\YourKey");regWrite.SetValue("Your.exe");
      

  3.   

    自动运行如楼上修改注册表
    load时最小化this.WindowState = FormWindowState.Minimized;
      

  4.   

    又写错了,正确为:
    RegistryKey  regWrite= Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");regWrite.SetValue("YourKey","Your.exe");
      

  5.   

    通过修改注册表,将Exe文件加入到自动运行列表中。HCU或HLM中均有(KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run或HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run)。
    而第二个问题,你使用NotifyIcon组件,使用其在任务栏即行。
      

  6.   

    RegistryKey regWrite = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
    regWrite.SetValue("aa","aa.exe");我添加成功了,但删除时却出错,提示键不存在,代码如下:
    Registry.LocalMachine.DeleteSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\aa");
      

  7.   

    如何判断是否已经有了该键?
    Registry.LocalMachine.GetValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\aa") 值总是为null
      

  8.   

    删除时却出错,提示键不存在,代码如下:
    Registry.LocalMachine.DeleteSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\aa");如何判断是否已经有了该键?
    Registry.LocalMachine.GetValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\aa") 值总是为null
      

  9.   

    RegistryKey regWrite = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
    regWrite.SetValue("aa","aa.exe");
    if(Registry.LocalMachine.GetValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\aa")==null)
    {
        该值不存在
    }
    else
    {
        regWrite.DeleteValue("aa",true);
    }