I. Basic knowledge of the registration form1)
structure
Value items (name, type, data), items, keys, and so on
REG_SZ string
REG_BINARY binary
REG_DWORD Double Word
2)
composition
1. HKEY_CLASSES_ROOT defines all file type identifiers and basic operation identifiers in the system
The primary key contains the file name extension and information associated with the application
Sub-keys under the primary key determine how to display the class file and its icon in the explorer and the desktop
Not a separate branch, but just a map of the hkey_local_machine\software\classes
2. HKEY_CURRENT_USER the current user's configuration information, including environment variables, desktop settings, network
Connection, software operation information, etc.
3. HKEY_LOCAL_MACHINE Native-related system information, including hardware information, driver information, memory
Data, bus data, etc.
The information is not relevant to a particular user and can be used by all users.
4. Hkey_user Information for all users
This sub-key saved the user's desktop settings, background bitmap, application shortcuts, fonts and other information. This information can be set by tools such as the Control Panel. The application also does not directly access the primary key, but is accessed through the HKEY_CURRENT_USER primary key.
5. Hkey_current_config information about the configuration when the local computer is started. such as environmental information,
Desktop theme, background color, etc.
is also just a mapping in the hkey_local_machine\config structure.
3)
C # Operations Registry
<span style= "FONT-SIZE:14PX;" >microsoft.win32.registrykey RK = Microsoft.Win32.Registry.CurrentUser.OpenSubKey ("Software\\\\mapwingisconfig ", false); Microsoft.Win32.RegistryKey RK = Microsoft.Win32.Registry.CurrentUser.CreateSubKey ("Software\\\\mapwingisconfig") ;</span>
Ii. use of the registration forml
Add new file types in Explorer right/new and Desktop context menu/new.
The example uses code to represent:
// Set right button
RegistryKeykey1 =Registry. Classesroot.createsubkey (". ACC");
Key1. SetValue ("","ACC");
RegistryKeykey2 = key1. CreateSubKey ("shellnew");
Key2. SetValue ("Nullfile", "" ");
Key1. Close ();
Key2. Close ();
// set the associated suffix name
Key1 = Registry. Classesroot.createsubkey ("ACC");
Key1. SetValue ("","Accfile");
Key2 = Key1. CreateSubKey ("DefaultIcon");
Key2. SetValue ("","C:\\acc.ico"); //c:\\windows\\notepad.exe,1
Key2. Close ();
Key2 = Key1. CreateSubKey ("Shell\\open\\command");
Key2. SetValue ("","C:\\windows\\notepad.exe");
TIP: The sub-key shellnew of ACC represents the creation of a right-click New menu, and shellnew the value below Nullfile represents an empty file.
Hkey_classes_root\.zip\shellnew value
What does FileName D:\Program files\haozip\zipnew.data stand for?
c:\\windows\\notepad.exe,1 indicates that the EXE is not applicable icon, use the system default icon , a small icon with the default opener will be displayed if not set
c:\\windows\\notepad.exe,0 represents the use and EXE the same icon.
Summary Right-click New Setup Step:
1. In HKEY_CLASSES_ROOT, create a new subkey suffix named ". ACC".
2. Set the default value of. ACC "Accfile" This value can be casual, but preferably ACC or accfile or something.
3. Create a new. ACC subkey shellnew, and create a new string value Nullfile\filename Note that the two names must be
Must be set, but the value set with no setting does not affect, as needed.
4. Create a new Accfile subkey and set the default value "ACC file" This value must be set to indicate the name of the newly created ACC file
Said. Right now the new menu is complete.
5. However, in order for the newly created file to have icons and associated programs, you need to set DefaultIcon and shell\open\command\
The new ACC file is then associated with the program.
l
Manage files with the specified extension to the specified program
The example uses manual settings:
First, the meanings of the value entries in these keys (in. txt, for example) are described.
The following three values are set in the general suffix sub-key
1. (default): The most important value in the association, determines who the current suffix of the file to whom and how to deal with, what you see here is "txtfile" .txt The key is just the equivalent of an index, there is no actual processing instructions in the key, and the actual processing is given to another key, the name of the key is here " (default) " given.
2. ContentType " here specifies what type this file content is, this value can accept many parameters, the list of this parameter can be msdn find ContentType see. The significance of this value is that when the system is going to process the contents of the file, the program associated with the suffix will determine how to open and present the contents of the file according to this value.
3.PerceivedType : This value is also a type of token. What's his use? For example, if the content of this value is video . We open some video players, many players first open it is likely to search the computer hard disk, find the files can be played and show in the " playlist " , and this search process is based on this value.
the following jumps to the key that is responsible for the real processing and opening of the work, for our example ,. txt, handle the key txtfile, find the key, and expand all , you can see something like this:
Select the top-level txtfile look at the content displayed on the right side of the screen:
1.(default): Here is a description of the file type, everyone right-click on the file icon, select Properties, in the properties of the file type box can see this value.
2.EditFlags: Identify the read/write permissions for this file, such as read-only or read-write ... And so on, this can also be modified in the file attributes.
3.FriendlyTypeName: This value is the friendly name of the application. This value is actually a description of the processing key corresponding to the application, we open the file attributes to find, can also find the figure of this value. Remember, however, that this value is not a determining function. The decision action is in the subkey.
Back to txtfile in the key hierarchy chart :.
1.DefaultIconsets the icon for this type of file. You can specify directlyicoYou can also usenotepad.exe,0that usesEXEthe icon. , 0represents the use andEXEthe same icon,, 1indicates not to useEXEicon instead of the system default icon. If you do not set any values, a small icon for the default generation program is displayed.
2. shell There will usually be open , print , edit et cetera ...
Open The default generation of the suffix file, after the program is added %1 indicates that the program is enabled by default when double-clicked. Edit indicates when the file was edited and when print was printed.
Summary File association Manual implementation steps:
1.HKEY_CLASSES_ROOT the new subkey ". ABC", set the default value Abcfile
2.hkey_classes_root new Subkey "Abcfile", this default value is not set.
3. Under Abcfile, create a new subkey, DefaultIcon, and Shell\open\command. Set default icons and default
Procedures.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
C # Registry Operations summary