解决方案 »

  1.   

    将上面的两段保存为两个.reg的文件
    Process.Start("regedit", "/s " + 你的reg文件)
      

  2.   

    Process.Start("regedit", "/s " + 你的reg文件);
    不是告诉你了么
      

  3.   

    项目这块不能有外部文件调用,能帮我看看下面的转换代码有没有问题吗?
    禁用reg文件:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ACPI\Parameters]
    "AMLIMaxCTObjs"=hex:04,00,00,00
    "Attributes"=dword:00000070
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ACPI\Parameters\WakeUp]
    "FixedEventMask"=hex:20,05
    "FixedEventStatus"=hex:00,84
    "GenericEventMask"=hex:18,50,00,10
    "GenericEventStatus"=hex:10,00,ff,00 RegistryKey key = Registry.LocalMachine;
                RegistryKey parameters = key.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\ACPI\\Parameters", true);
                parameters.SetValue("AMLIMaxCTObjs", "hex:04,00,00,00");
                parameters.SetValue("Attributes", "dword:00000070");            RegistryKey wakeUp = key.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\ACPI\\Parameters\\WakeUp", true);
                wakeUp.SetValue("FixedEventMask", "hex:20,05");
                wakeUp.SetValue("FixedEventStatus", "hex:00,84");
                wakeUp.SetValue("GenericEventMask", "hex:18,50,00,10");
                wakeUp.SetValue("GenericEventStatus", "hex:10,00,ff,00");
      

  4.   

     /// <summary>
            /// 是否禁用XP上的待机功能或Win7上的睡眠功能
            /// </summary>
            /// <param name="IsDisable">是否禁用</param>
            public void IsDisableStandby(bool IsDisable)
            {
                if (IsDisable)
                {
                    //禁用
                    RegistryKey key = Registry.LocalMachine;
                    RegistryKey parameters = key.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\ACPI\\Parameters", true);
                    parameters.SetValue("AMLIMaxCTObjs", new byte[] { 0x04, 00, 00, 00 }, RegistryValueKind.Binary);
                    parameters.SetValue("Attributes", 0x00000070, RegistryValueKind.DWord);                RegistryKey wakeUp = key.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\ACPI\\Parameters\\WakeUp", true);
                    wakeUp.SetValue("FixedEventMask", new byte[] { 0x20, 0x05 }, RegistryValueKind.Binary);
                    wakeUp.SetValue("FixedEventStatus", new byte[] { 00, 0x84 }, RegistryValueKind.Binary);
                    wakeUp.SetValue("GenericEventMask", new byte[] { 0x18, 0x50, 00, 0x10 }, RegistryValueKind.Binary);
                    wakeUp.SetValue("GenericEventStatus", new byte[] { 0x10, 00, 0xFF, 00 }, RegistryValueKind.Binary);
                }
                else
                {
                    //启用
                    RegistryKey key = Registry.LocalMachine;
                    RegistryKey parameters = key.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\ACPI\\Parameters", true);
                    parameters.SetValue("AMLIMaxCTObjs", new byte[] { 0x05, 00, 00, 00 }, RegistryValueKind.Binary);
                    parameters.SetValue("Attributes", 0x00000000, RegistryValueKind.DWord);                RegistryKey wakeUp = key.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\ACPI\\Parameters\\WakeUp", true);
                    wakeUp.SetValue("FixedEventMask", new byte[] { 0x20, 0x01 }, RegistryValueKind.Binary);
                    wakeUp.SetValue("FixedEventStatus", new byte[] { 00, 0x85 }, RegistryValueKind.Binary);
                    wakeUp.SetValue("GenericEventMask", new byte[] { 00, 00, 00, 00, 00, 00, 00, 00 }, RegistryValueKind.Binary);
                    wakeUp.SetValue("GenericEventStatus", new byte[] { 00, 00, 0xc3, 0x46, 00, 00, 00, 00 }, RegistryValueKind.Binary);
                }
            }