first, the basic knowledge of the Register1)
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 includes the file name extension and the information associated with the application
The subkey under the primary key determines how the class file and its icons are displayed in the explorer and the desktop
is not a separate branch, but merely a mapping of the hkey_local_machine\software\classes
2. HKEY_CURRENT_USER the current user's configuration information. Contains environment variables, desktop settings, network
Connection, software execution 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 does not directly access the primary key, but instead visits it via 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.
It is only a mapping in the hkey_local_machine\config structure.
3)
C # operation manual list
<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 RegisterL
in the Explorer right/new and desktop right-click menu/New, add your own file type.
The demo sample 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. The value Nullfile below shellnew 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 the icon. Using the system default icon , if not set will show the default open program small icon
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. However, the value setting and not setting have no effect, depending on the need.
4. Create a new Accfile subkey and set the default value of "ACC file" This value must be set. Used to indicate the name of the newly created ACC file
Said. Right now the new menu is finished.
5. However, in order for the newly created file to have icons and associated programs. 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 Demo sample uses manual settings:
First, the meanings of the value entries in these keys (in. txt, for example) are described.
The General suffix subkey is set in this example for the following three values
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">
1.(default): One of the most important values in the association. Determines who and what to do with the current suffix file. What you see here is "txtfile". In fact, this . txt key is just the equivalent of an index. There are no actual processing instructions in the key, and the actual processing is given a key. The name of the key is the "(default)" given here.
2. ContentType: This specifies what kind of content this file is. This value can accept very many of the parameters, and the list of the parameters can be found in MSDN ContentType .
The significance of this value is when the system wants to process the contents of the file. The program associated with this suffix will determine how to open and present the contents of the file based on this value.
3.PerceivedType : This value is also a type of token. What's his use? Give me a sample example. Suppose the content of this value is video .
We opened some video players, many players first opened very likely to search the computer hard disk, looking for files that can play and show now " playlist " . And this search process is based on this value.
The following jumps to the key that is responsible for the actual processing and opening of the work, for our example . txt. Handle the key txtfile, locate the key, and all expand to see such things as the following:
Select the top-level txtfile look at the content displayed on the right side of the screen:
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">
1.(default): Here is a description of the file type, everyone right-click on the file icon. You can see this value in the File type box in the properties when you select the attribute.
2.EditFlags: Identify the file read and write permissions, such as read-only, or read-write ... And so on, this can be changed in the file attributes.
3.FriendlyTypeName: This value is the friendly name of the application. This value is actually a description of the corresponding application of the processing key, you open the file attributes to find, you can find the figure of this value. Just keep in mind 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. Ability to specify directlyicocan 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 value, you will see a small icon for the default generation program.
2. the shell below will generally have open. print,edit , etc...
。
Open The default generation procedure for this suffix file. Adding%1 after the program indicates that the program is enabled by default on double-click. 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.
C # Checklist Operations Summary