Customize the new Win2000 alternative "position bar" _windows2003

Source: Internet
Author: User
Tags chr new set
Compared to previous Windows, the WIN2K/XP user interface has been greatly improved, making it much easier for users to use 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 gives experienced users the opportunity to customize the desktop, enabling people to do their daily work more efficiently. The Open dialog box is one of the most commonly used dialog boxes, and in the win 2K/XP user interface, it adds a "position bar", and this article discusses how to customize this location bar.
  
The description of this article is mainly for win 2K, but the rationale is also applicable to XP, and the differences will be noted separately.

   First, open dialog box

You may have noticed that some software runs under WIN2K/XP, and their Open dialog box differs from WIN9X/NT 4.0. Figure one shows the standard Win2K "open" dialog box, which is displayed by clicking on the "File/Open" menu in Notepad. This dialog box adds something to the previous operating system: a vertical button bar is added to the left of the window. The Win2K SDK documentation refers to this button bar as the "position bar" (Places bar).


Figure I: Standard Win2K "open" dialog box

The role of the location bar is to allow users to use only one mouse click to reach the frequently used folders. The WIN2K/XP position bar contains up to 5 buttons, each pointing to a system folder. Click on any button and the Open dialog box immediately displays the contents of the corresponding folder.

The default location bar provides a single button for each of the following folders: History, Desktop, My Documents, my computer, My Network Neighborhood. The History folder records the most recent files and folders used by users, and the History folder is the first place to view if you want to access the most recently used files or folders. Many users also frequently use the other four folders.

The default location bar configuration contains the most commonly used folders for most users, and meets the needs of most users. However, this default configuration may not be consistent with your work habits, and you will need to customize it.


   Second, custom location bar

The folders for the location bar are not explicitly listed, either in the registry or anywhere else. Therefore, WIN2K/XP always use the standard location bar unless you manually or automatically create a new set of locations by using a program.

The location bar is a system-level resource. Once a set of positions is assigned to the location bar, all WIN2K/XP software will use this set of locations. This restriction means that you cannot specify a configuration for Notepad's location bar, and another configuration for the brush's position bar, and that all programs running under WIN2K/XP share the same set of locations-whether this set of locations is standard or custom. (The office exception, which can have a different set of locations, is discussed in detail later).

To specify a new set of folders for the location bar, the first step is to tell the system that you are not ready to use the default 5 locations. Create the Hkey_current_usersoftwaremicrosoftwindowscurrentversionpoliciescomdlg32placesbar registry subkey (generally, the Plicies subkey may already exist, However, the COMDLG32 subkey needs to be created by itself. After you create the subkey, you can see that the position bar of the Open dialog box has become blank. The Placesbar key tells Win2K you don't want to use a standard location combination, but you haven't specified your own configuration at this point.

The Placesbar subkey contains up to 5 registered entries, from Place0 to Place4. WIN2K/XP will not endorse or correctly handle Place5, Place6, or other name registration keys. The position should be specified sequentially, for example, you cannot set Place0, Place2 Miss Place1. If the location of the registry settings is messy and incomplete, the location bar displays the icon and folder name in unpredictable order.

When you add location information to a Placesbar subkey, the way you specify the folder is to provide the full pathname of the folder as a string. The type of registration data is REG_SZ (if the name of the folder is used in the environment variable, it should be REG_EXPAND_SZ).

You can specify the system folder as the location on the location bar in the registration information. System folders tend to have long paths and are not easy to remember (for example, can you immediately say the full path to My Documents?). If you want to designate My Documents or favorites as a location, you can use a numeric ID that is not specific to your system, instead of using its full pathname. Microsoft referred to this ID as csidl. Table one lists the IDs of the Win2K common system folders. For such folders, you can create a registered entry of type REG_DWORD under the Placesbar subkey and specify an ID.

Table I

Note: The ID value for table one does not apply to XP. If you are using XP, look for relevant information, or use the absolute path of the folder directly.


   Third, customization process automation

Here's a modifyplaces.vbs script, which is a program that automatically reads and writes location information. Under the Win2K command window, execute "CScript modifyplaces.vbs" or "WScript modifyplaces.vbs" to start the program, see Figure Ii. The program first asks you for the location number you want to change. 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 full pathname, and when you are done, the program will create a REG_SZ registry key. If no is selected, the program requires you to enter a system folder ID and, when completed, the program creates a REG_DWORD subkey. After you specify a location, the program allows you to continue to specify a different location.

Figure II: Customizing the location bar
' Constants

Const APP_TITLE = "Set position bar for open dialog box"

Const Reg_placesbar = "Hkcusoftwaremicrosoftwindowscurrentversionpoliciescomdlg32placesbar"

Dim Place ' location number

Dim cancontinue ' logical switch ' gets the location number to 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 is wrong, please specify the location number between 0-4!", App_title

Else

' Location number is valid, read information from 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 & "is currently set to" & _

Chr & Curpath & Chr (+) & VbCrLf & VbCrLf & _

"Click" is "Specify a common folder" & VbCrLf & _

"Click" No "to specify a system Folder" & VbCrLf & _

"Click" Cancel "Exit 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 a new folder path", App_title, Curpath)

If NewPath = "Then Exit Sub

Thetype = "REG_SZ"

Case Vbno

BUF = "

BUF = buf & "Select a new folder." & VbCrLf & VbCrLf & _

"5-My Documents" & VbCrLf & _

"6-Collection" & VbCrLf & _

"17-My Computer" & VbCrLf & _

"18-Network Neighborhood" & VbCrLf & _

"36-windows system Catalog" & 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


Admittedly, Modifyplaces.vbs does not have too many error control mechanisms, and its user interface is very rough. If you want a professional program, it's best to convert it into VB code. Figure Three shows the Open dialog box with "C:est" and "My Computer" specified as two positions on the position bar.

Figure three: The Custom Open dialog box
Here is the Setdefaultplaces.vbs script, which deletes the Placesbar subkey and restores the default location bar settings. As mentioned earlier, it does not exist unless we create a Placesbar subkey. If WIN2K/XP cannot find the Placesbar subkey, the location bar defaults to the standard configuration.

Table II

four, office location bar

affect only those programs that use the WIN2K/XP Common dialog code base. The dialog boxes used by office come from a custom code base. Therefore, modifying the location bar of the Win2k/xp Open dialog box does not have any effect on the location bar of Word and Excel.

However, Office 2000 also provides a way to customize its location bar, and the associated registry key is Hkey_current_usersoftwaremicrosoftoffice9.0commonopen Findplaces For Office XP, the registry key path is Hkey_current_usersoftwaremicrosoftoffice.0commonopen findplacesuserdefinedplaces.

However, if you just want to customize the location bar, you can not pass the registry key. Microsoft provides a handy tool for modifying the location bar, which you can install to the Tools menu of Office 2000 software. This tool can be downloaded from the support.microsoft.com/support/kb/articles/q260/1/90.asp, download the full VB source code with the plugin and instructions on how to use the tool. After the

downloads the Places.exe file, double-click to unpack the compressed package. Then, click on the Win2k/xp "Start/Run" menu, enter "regsvr32 < path >places.dll" and confirm the registration Places.dll. If you open the program for Office 2000, turn it off before you turn it on. A "Set Places" menu item appears on the Tools menu of the Office software, which you can use to set the positions on the position bar. Unlike the Win2K Standard dialog box, the location bar for Office 2000 software supports small icons. When you use small icons, the number of folders on the location bar no longer has a maximum of 5 restrictions. No matter which Office 2000 software modifies the location bar, the results are valid for all Office 2000 software. The

Location Bar is a great tool, but its advantages can be fully developed only if it is listed in exactly the same location as your favorite folder. With the knowledge of this article, you should also be able to customize the WIN2K/XP and office location bar at your own whim.

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.