Use C # To operate the Registry to create a Quick Start Program

Source: Internet
Author: User

In general, we are used to moving the mouse and double-clicking to open our application. However, I did not find that some applications can be opened by dropping the mouse in another way, but it is not necessarily more troublesome than the mouse.
WinRAR: compression software. Open the run bar (or win + r) and enter WinRAR directly to open it. Why?

First of all, we need to know that in the registry, all items with an item value memory can be opened in this fast start mode.
In HKEY_LOCAL_MACHINE/sofaware/Microsoft/Windows/CurrentVersion/APP paths, let's take a look at the key value under it.
Can be opened in this way.

If we want our custom application to be opened in this way, we need to modify the registry and create the corresponding item value under it.

To operate the registry, we need to introduce the Microsoft. Win32 namespace, which provides only two types:
The class of the event caused by the operating system and the class of the Operation registry.

 

The main code is as follows:

 

 // The Registry class provides the registrykey object of the Window registry root entry, and provides a static method for accessing the next item/value pair <br/> // registrykey is a Windows Registry top-level node </P> <p> registrykey regkey = registry. localmachine. opensubkey (@ "software/Microsoft/Windows/CurrentVersion/APP paths", true); </P> <p> // use createsubkey () of registykey () method to create a new subitem <br/> registrykey regchildkey = regkey. createsubkey ("name"); </P> <p> // setvalue () method to set the value in the name/value pair in the registry <br/> regchildkey. setvalue ("", "path", registryvluekind. string );

 

After the registry is successfully created, open the run column and enter the name of the registry key you have created to run it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.