Writing values to the registry with C#

后端 未结 2 1509
伪装坚强ぢ
伪装坚强ぢ 2021-01-22 09:27

I\'m in the process of creating a C# application which will monitor changes made to the registry and write them back to the registry next time the user logs on.

So far I

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-22 10:05

    So you have a string that you need to convert to binary and write to the registry? Does this work?

    string valueString = "this is my test string";
    byte[] value = System.Text.Encoding.ASCII.GetBytes(valueString);
    Microsoft.Win32.Registry.SetValue(keyName, valueName, valueString, Microsoft.Win32.RegistryValueKind.Binary);
    

提交回复
热议问题