开发者

Editing Registry [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 year开发者_如何学Pythons ago.

How can I edit registry settings which would take place immediatly without a restart/log off using c# ?

Thank you!


You can edit the registry by using Registry or RegistryKey classes.

That changes the values in the registry immediately. But when the actual change takes place depends on what exactly that change is. And some of them aren't possible without restarting the computer or logging off and on the current user.


Your mistake is that you're using the registry. You should use the appropriate APIs to change settings instead of using the registry directly.

For most windows settings SystemParametersInfo is used to change the settings. Passing SPIF_SENDCHANGE the last parameters makes the change take effect immediately. And to make the change permanent you need to combine it with SPIF_UPDATEINIFILE.

I don't know if this supports the settings you want to change, since you didn't specify what you want to do. It might be possible to change some settings directly in the registry and then use SystemParametersInfo to notify the applications, that use this setting, of this change. But this sounds like API abuse and should only be done if you find no better alternative.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜