Customizes the brand new Win2000 alternative "Location Bar"

Source: Internet
Author: User
Tags new set

Compared with the previous Windows, the Win2K/XP user interface has made many improvements, greatly facilitating the use of Windows. For example, "Active Desktop" is based on HTML, which is a huge change for Windows NT 4.0 users. Whether you like it or not, the new user interface provides experienced users with the opportunity to customize the desktop, enabling them to complete their daily work more efficiently. The "open" dialog box is one of the most common dialogs. in the Windows 2 K/XP user interface, it adds a "Location bar ", this article will discuss how to customize the location bar.
  
The description in this article focuses on Win 2 K, but the basic principle is also applicable to XP. The differences will be pointed out separately.

  1. Open dialog box

You may have noticed that when some software runs in Win2K/XP, their "open" dialog box is different from Win9x/NT 4.0. Figure 1 shows the standard Win2K "open" dialog box. Click "file/Open" in notepad to display this dialog box. Compared with the previous operating system, this dialog box adds a vertical button bar to the left of the window. In the Win2K SDK documentation, this button Bar is called the "Places Bar ).

Figure 1: Standard Win2K "open" dialog box

The position bar is used to allow users to click a folder that is frequently used with only one mouse. The Win2K/XP position Bar contains up to five buttons, each of which points to a system folder. Click any button and the "open" dialog box will immediately display the content of the corresponding folder.

The default location bar provides a button for each of the following folders: History, desktop, my documents, my computer, and network neighbors. The "History" folder records the most recently used files and folders. To access recently used files or folders, the "History" folder is the first place to be viewed. Many users often use four other folders.

The default location bar configuration contains the most common folders for most users, meeting the needs of most users. However, this default configuration may not meet your work habits, and you need to customize it.

  Ii. Custom location bar

No folder of the Location bar is explicitly listed in the registry or elsewhere. Therefore, unless you create a new set of locations manually or automatically using a program, Win2K/XP Always uses standard location bars.

Location bars are system-level resources. Once a group of positions is specified to the position bar, all Win2K/XP software will use this group of positions. This restriction means that you cannot specify a configuration for the position bar of the notepad, or another configuration for the position bar of the paint brush, all programs running in Win2K/XP share the same group of locations-either standard or customized. (With the exception of Office, it can have a set of different positions, which will be discussed in detail later ).

To specify a new folder for the location bar, the first step is to tell the system that you are not going to use the default five locations. Create the HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesComDlg32Placesbar registry sub-Key (generally, the Plicies sub-key may already exist, but the ComDlg32 sub-key needs to be created by yourself ). After creating the subkey, you can see that the position bar in the "open" dialog box has become blank. The Placesbar sub-key tells Win2K that you do not want to use a standard location combination, but you have not specified your own configuration.

The Placesbar subkey contains up to five registration items, ranging from Place0 to Place4. Win2K/XP does not recognize or correctly process the registration key for Place5, Place6, or other names. Positions should be specified in sequence. For example, you cannot set Place0 or Place2 to Miss Place1. If the location set in the registry is messy and incomplete, the location bar displays the icon and folder name in an unpredictable order.

When you add location information to the Placesbar sub-key, you can specify a folder to provide the complete path name of the folder in the form of a string. The registered data type is REG_SZ (if the environment variable is used in the folder name, it should be REG_EXPAND_SZ ).

You can specify the system folder in the registration information as the location on the Location Bar. System folders often have a long path, which is hard to remember (for example, can you tell me the complete path of "My Documents" immediately ?) If you want to specify "My Documents" or "favorites" as a location, you can use a digital ID that is not related to the specific system, rather than using its full path name. Microsoft calls this id csidl. Table 1 lists the IDs of common Win2K system folders. For this type of folders, you can create registration items with REG_DWORD type under the Placesbar sub-key and specify the ID.


Table 1 Note: The ID value of table 1 is not applicable to XP. If you are using XP, find the relevant information or directly use the absolute path of the folder.

  Iii. Custom Process Automation

The following describes a modifyPlaces. vbs script, which is a program that automatically reads and writes location information. In the Win2K command window, Run "CScript modifyPlaces. vbs" or "WScript modifyPlaces. vbs" to start the program. See figure 2. The program first asks the location number you want to modify. If you enter a number between 0 and 4, the program continues, click "yes" to specify the folder with the path, and click "no" to specify the folder with the ID number. After clicking "yes", the program requires you to enter a complete path name. After the completion, the program will create a REG_SZ registration key. If "no" is selected, the program requires that you enter a System Folder ID. After that, the program creates a REG_DWORD subkey. After a location is specified, the program allows you to specify another location.


Figure 2: Custom location bar
'Constant

Const APP_TITLE = "set the position bar in the" open "dialog box"

Const REG_PLACESBAR = "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesComDlg32Placesbar"

Dim place 'location No.

Dim canContinue 'logical tog' to obtain the location number to be set

CanContinue = True

While canContinue

Place = InputBox ("input position number (0 to 4)", APP_TITLE, 0)

'Click the "cancel" button...

If place = "Then

WScript. Quit

End If

If place> 4 Then

MsgBox "Location Number error. Please specify the location number between 0 and 4! ", 16, APP_TITLE

Else

'The location number is valid and the information is read from the registry.

ChangePlace place

End If

Wend

'Modify the specified location

Sub ChangePlace (place)

Dim shell, curPath, buf, rc, newPath, theType

Set shell = CreateObject ("WScript. Shell ")

On Error Resume Next

CurPath = shell. RegRead (REG_PLACESBAR & "Place" & place)

On Error Goto 0

'Default Value

If curPath = "Then curPath =" Default Value"

Buf ="

Buf = buf & "location" & place & "currently set "&_

Chr (34) & curPath & Chr (34) & vbCrLf &_

"Click" yes "to specify a common folder" & vbCrLf &_

"Click" no "to specify a system folder" & vbCrLf &_

"Click" cancel "to exit the program"

Rc = MsgBox (buf, 3, APP_TITLE)

'Yes = 6, NO = 7, CANCEL = 2

If rc = vbCancel Then Exit Sub

'Modify location

Select Case rc

Case vbYes

NewPath = InputBox ("Enter the new folder path", APP_TITLE, curPath)

If newPath = "Then Exit Sub

TheType = "REG_SZ"

Case vbNo

Buf ="

Buf = buf & "select a new folder." & vbCrLf &_

"5-My Documents" & vbCrLf &_

"6-Favorites" & vbCrLf &_

"17-my computer" & vbCrLf &_

"18-network neighbors" & vbCrLf &_

"36-Windows System directory" & vbCrLf &_

"34-history"

NewPath = InputBox (buf, APP_TITLE, curPath)

If newPath = "Then Exit Sub

TheType = "REG_DWORD"

End Select

Shell. RegWrite REG_PLACESBAR & "Place" & place, newPath, theType

End Sub

It should be admitted that modifyPlaces. vbs does not have many error control mechanisms, and its user interface is also very rough. If you want a professional program, you 'd better convert it into VB code. Figure 3 shows the "open" dialog box after "c: est" and "my computer" are specified as the two positions on the position bar.


Figure 3: Custom "open" dialog box
The following is the setdefaplacplaces. vbs script. This program deletes the Placesbar sub-key and restores the default position bar settings. As mentioned above, unless we have created the Placesbar sub-key, it does not exist. If the Placesbar sub-key cannot be found in Win2K/XP, the position bar uses the standard configuration by default.

Table 2

  Iv. Office location bar

The previous registry modification only affects those programs that use the Win2K/XP public dialog code library. The Office use dialog box comes from a custom code library. Therefore, modifying the position bar in the Win2K/XP "open" dialog box does not affect the position bar in Word or Excel.

However, Office 2000 also provides a way to customize its location bar. The registration key is HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonOpen FindPlaces. For Office XP, the registration Key Path is HKEY_CURRENT_USERSoftwareMicrosoftOffice.

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.