In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "case analysis of C # operation registry". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "C # operation registry case analysis".
In the following example, note:
Build function: CreateSubKey ()
Create subkey function: SetValue ()
Practice of class Program / / C # operating registry instance {static string Generateguid () / / function {return System.Guid.NewGuid (). ToString () to establish guid values;} static void Main (string [] args) {RegistryKey pregkey; string preName; / / pregkey = Registry.CurrentUser.OpenSubKey ("Control Panel\\ Desktop\\ WindowMetrics", true); pregkey = Registry.LocalMachine.OpenSubKey ("SOFTWARE\ Microsoft\\ Internet Explorer\ Extensions", true) / / retrieve subkey if (pregkey = = null) {Console.WriteLine ("the key does not exist");} / / practice else {preName = Generateguid (); Console.WriteLine (preName); Console.WriteLine ("find the key"); preName = "{" + preName + "}"; / / pregkey.SetValue ("MinAnimate", "1"); pregkey.CreateSubKey (preName) / / create a subkey pregkey = Registry.LocalMachine.OpenSubKey ("SOFTWARE\\ Microsoft\\ Internet Explorer\\ Extensions\\" + preName, true); / / pregkey.SetValue ("bbbbb", "0"); / / create a subkey, if there is one, set the value. Pregkey.SetValue ("ButtonText", "add"); / the text pregkey.SetValue ("CLSID", "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}") displayed when the mouse is over the bar; / / CLSID fixed pregkey.SetValue ("Default Visible", "yes"); / / default view, C # operating registry instance practice pregkey.SetValue ("Exec", "D:/IEbar/IEpinout.exe") / / the associated exe file pregkey.SetValue ("HotIcon", "D:/IEbar/Icon2.ico"); / / the pattern pregkey.SetValue ("Icon", "D:/IEbar/Icon1.ico") displayed when the mouse is over bar; / / the pattern displayed when the mouse is not over bar / / pregkey.SetValue ("MenuStatusBar", "Yang"); / / pregkey.SetValue ("MenuText", "I am Yang!") ;} / / C # operating registry instance practices pregkey.Close ();}}
This example has been debugged under vs2005,xp system.
Generate the exe file, run it directly, and then open ie to see the effect on the toolbar.
Note: there must be two files "D:/IEbar/Icon2.ico" and "D:/IEbar/Icon1.ico", otherwise the effect will not be seen on ie.
Thank you for your reading, the above is the content of "C # operation registry instance analysis". After the study of this article, I believe you have a deeper understanding of the problem of C # operation registry example analysis. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.