Given the important role of folders in Windows, not only in their ability to store our personal data, but in the way they're used to organize the files that comprise the operating system, it should not be surprising that there are lots of cool things you can do with them. The next few solutions should illustrate the flexibility of Windows XP, and the lengths one can go to accomplish just about anything.
There may come a time when you may get a little sick of the generic icons used for drives and folders in My Computer and Explorer (personally, I'm not a big fan of the liberal use of yellow in the Windows XP interface). Now, you've probably figured out that you can create a shortcut to any drive or folder, choose a pretty icon, and place it on the desktop or in some other convenient location. Unfortunately, the icon you choose doesn't propagate to the target object. Here's how to make the change a little more universal.
Using the functionality built in to Windows' CD auto-insert notification feature functionality that allows Windows to determine the name and icon of a CD as soon as it's inserted in the reader (see Section 4.4.4 later in this chapter) there's a simple way to customize the icons of all your drives:
Open a plain-text editor, such as Notepad.
Type the following:
[autorun] icon=filename, number
where filename is the name of the file containing the icon, and number is the index of the icon to use (leave number blank or specify 0 [zero] to use the first icon in the file, 1 for the second, and so on).
Save the file in the root directory of the hard disk, floppy, or removable drive you wish to customize, naming it Autorun.inf.
This change will take effect the next time the My Computer view is refreshed: with Explorer or the My Computer window open, press the F5 key to refresh the display and read the new icons (Figure 4-13).
The icon for any individual folder can be customized to suit your taste:
Open a plain-text editor, such as Notepad.
Type the following:
[.ShellClassInfo] IconFile=filename IconIndex=number
where filename is the name of the file containing the icon, and number is the index of the icon to use; leave the IconIndex line out or specify 0 (zero) to use the first icon in the file, 1 for the second, and so on. Note the dot (.) in [.ShellClassInfo].
Save the file directly in the folder you wish to customize, naming it desktop.ini.
Open a command-prompt window (cmd.exe), and type the following at the prompt:
attrib +s foldername
where foldername is the full path of the folder containing the desktop.ini file (i.e., c:\docs). This command turns on the System attribute for the folder (not the desktop.ini file), something you can't do in Explorer.
Note that turning on the System attribute for a folder will have no adverse effect on your system, your data, or any other applications.
Close the Command Prompt window when you're done. You'll have to close and reopen the Explorer or single-folder window to see the change (pressing F5 won't do it).
If you're customizing a drive icon for a removable drive (i.e., Zip, CDR, floppies), you may need to refresh the My Computer or Explorer window every time the media is inserted by pressing the F5 key, because Windows can only detect the insertion of CDs and DVDs, and then only when the auto insert notification feature is enabled.
To turn the display of certain drive icons on or off in the My Computer window, open Drives in the My Computer category in TweakUI (see Appendix A).
The more global and far-reaching a change is, the more likely it is to be difficult or impossible to accomplish without some serious tinkering in the Registry. An example are the icons used by some of the seemingly hard-coded objects in Windows, such as the icons used for ordinary, generic folders.
Open the Registry Editor (discussed in Chapter 3).
Expand the branches to HKEY_CLASSES_ROOT\Folder\DefaultIcon (you can also customize drive icons by going to HKEY_CLASSES_ROOT\Drive\DefaultIcon).
Double-click the (Default) value in the right pane. This value contains the full path[11] and filename of the file containing the icon, followed by a comma, and then a number specifying the index of the icon to use (0 being the first icon, 1 being the second, and so on). The file you use can be an icon file (*.ico), a bitmap (*.bmp), a .dll file, an application executable (*.exe), or any other valid icon file.
[11] You can omit the full path if the file you wish to use is in the system path, as described in Chapter 6.
The default for folders is %SystemRoot%\System32\shell32.dll,3, and the default for drives is %SystemRoot%\System32\shell32.dll,8.
When you're done, close the Registry Editor. You may have to log out and then log back in for this change to take effect.
There's a bug in Windows Explorer that may prevent your custom icon from being used in certain circumstances. The icon will appear whenever you view folders on the desktop or in single-folder windows, but if you open an Explorer window directly (explorer.exe), the old yellow icons will still appear. The way around this is to right-click a folder icon and select Explore, which will display a true Explorer window (with the tree), using your custom icon.
Open the Registry Editor discussed in Chapter 3.
Expand the branches to: HKEY_CLASSES_ROOT\CLSID\{class id }\DefaultIcon, where {class id } is the Class ID of the object you wish to change. To find the class id of an object, do a search in the HKEY_CLASSES_ROOT\CLSID\ branch for the formal name of the object (e.g., Recycle Bin).
Double-click the (Default) value in the right pane. The icon is specified here the same way it is for folders and drives (see the previous solution).
This change should take effect the next time you refresh the folder containing the object you've just customized. For example, press the F5 key while the desktop is active to refresh any desktop icons.
For most people, all that will be necessary to change the icon for an application is to change the icon for the application's shortcut, usually found in the Start Menu or on the desktop. Just right-click the desired shortcut, click Properties, choose the Shortcut tab, and click Change Icon. But there is actually a way to change the icon resource embedded in any .exe or .dll file, using the following procedure:
Download and install Microangelo (http://www.impactsoftware.com).
Start the Microangelo Librarian, and open the file you wish to change. All of the file's icons are shown in the window here. Just double-click an icon to edit it (the one shown in Explorer is typically the first one shown here).
When you're done in the editor, just select Update Librarian from the File menu, and select File Save in the Librarian window to write the changes to disk.
Note that another way to change the icon used for a system object is to edit the icon directly in the shell32.dll file (found in \Windows\System32). However, since this file is in use while Windows is running, you'll need to edit a copy of the file, and then replace the original with the modified copy using the System Recovery Console, described in Chapter 10.
Windows Shortcuts are tiny files that link to applications, documents, drives, folders, and some system objects. They're convenient in that they usually behave the same as the objects to which they're linked when you double-click them or drag-drop other objects on them. If you drag a file into a folder's shortcut, for example, it's the same as dragging the file into the folder.
The inherent problem with Window Shortcuts is that they are files, and as such, have the same limitations as files. They are sorted in Explorer with the rest of the files; shortcuts to folders are not grouped with folders as you might expect. Furthermore, shortcuts to folders cannot be specified in a path. For example, if you create a shortcut to the folder d:\Yokels\Cletus and place that shortcut in c:\Brandine, then you can't reference objects stored in Cletus by typing c:\Brandine\Cletus.
Enter Folder Shortcuts, an undocumented feature in Windows XP.[12] Folder Shortcuts behave exactly like folders because they are folders. With a little tweaking, any empty folder can be turned into a Folder Shortcut, a mirror of any other drive or folder on your system, on your network, or even on the Internet!
[12] Folder Shortcuts are also supported in Windows 2000 and Windows Me, but not in earlier versions.
|
Folder Shortcuts, once in place, are practically indistinguishable from the folders to which they link. If, revisiting the example earlier, you create a Folder Shortcut to d:\Yokels\Cletus and place it in c:\Brandine, then it will appear as though there's a folder called Cletus located in c:\Brandine ; in other words, c:\Brandine\Cletus will be a valid path. (For those of you familiar with Unix, Folder Shortcuts are very similar to symbolic links.)
Why would you want to do this? Among other things, a Folder Shortcut can be used to trick Windows or an application into thinking that a folder contained on a different drive or computer is actually somewhere else. For example, you could replace your My Documents folder with a Folder Shortcut pointing to a folder on your network, allowing you to access the same group of files on any number of computers, as easily as on the computer on which the files are actually stored. Or, say you're using an older application that only permits its data files to be stored in a specific location. Using a Folder Shortcut, you can trick the application into storing them elsewhere.
Use the following solutions to create and manage folder shortcuts.
Here's how to make a Folder Shortcut to an existing folder on your hard disk or on your local network (See Section 7.2.7 for details on the network version):
Choose an existing folder in Explorer it can be located on any drive, including your network. Create a standard Windows Shortcut to that folder on your desktop, and name the new shortcut target. (The shortcut filename will actually be target.lnk, although the .lnk filename extension won't be visible in Explorer.)
The easiest way is to drag-drop the folder icon using your right mouse button, and then select Create Shortcut(s) Here from the menu that appears. See Section 2.2.2 for more information on this process.
Next, make a new folder on your desktop; the name actually doesn't matter, but for the sake of argument, I choose to call my example folder, Dingus.
To help protect a Folder Shortcut from accidental deletion, make the folder read-only: right-click the folder icon for Dingus, and select Properties. Turn on the Read-only option, and click OK.
Drag-drop the target shortcut you made in Step 1 into the newly-created folder.
Open a plain-text editor, such as Notepad, and type the following four lines:
[.ShellClassInfo] CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D} Flags=2 ConfirmFileOp=0
Save this into the new folder, and call it desktop.ini.
Hint: notice that the text above contains no specific information about Dingus or our target folder. This means that you only need to type this once; thereafter, you can use the same desktop.ini file again and again.
Open a Command Prompt window (cmd.exe), and type cd followed by a space at the prompt. Drag-drop the Dingus folder onto the Command Prompt window, and the full path of the folder will be typed for you. It'll probably look something like this:
cd c:\Documents and Settings\{username}\Desktop\dingus
Then, just press Enter this changes the active directory to the new Dingus folder. See Appendix C for more information on the cd command.
Next, type:
attrib +h +s desktop.ini
which will turn on the Hidden and System attributes for the desktop.ini file, a task not possible from within Explorer. See Appendix C for more information on the attrib command.
Type exit and then press Enter when you're done here.
If the new folder is open, close it now. The next time you open the folder, you'll see the contents of the target folder, rather than the two files, desktop.ini and target.
The new Folder Shortcut can now be copied or moved anywhere you like. For the sake of safety, you should take certain steps to mark this new folder as a Folder Shortcut. Although it will be described as a "Folder Shortcut" in Explorer's Type column, as well as in the folder's Properties dialog box, it will be otherwise indistinguishable from a standard folder. In addition to naming it something like Shortcut to Dingus, you can also customize the icon for the new Folder Shortcut in the same way as for a standard folder. If you don't choose an icon, the Folder Shortcut will assume the icon of the folder to which it's linked.
I strongly recommend using an empty folder to transform into a Folder Shortcut. If there are any objects stored in said folder (such as Dingus, earlier), they will become inaccessible in Windows when the folder becomes a Folder Shortcut; they will otherwise only be visible from the command prompt, or after you dismantle the Folder Shortcut, as explained later. There should be no adverse effect on the said contents, however.
If you find the need to create Folder Shortcuts more easily, see Section 9.16.6 for a Windows Script Host (WSH) script that automates this process.
A Folder Shortcut can also be used to mirror an FTP site, effectively allowing you to transfer files across the Internet using Explorer. See Section 7.2.7 for details.
It's important to realize that once you create a Folder Shortcut, you can't remove it using traditional methods. If you try to delete a Folder Shortcut by dragging it into the Recycle Bin, for example, Windows will actually delete all the contents of the target folder! To remove a Folder Shortcut, you must first dismantle it. Because the command prompt doesn't recognize Folder Shortcuts, we can use it to delete the two files we created earlier:
Open a Command Prompt window (cmd.exe), and change the active directory to the Folder Shortcut (not the target folder). See Step 5 in the previous solution on how to do this with the cd command.
Type:
attrib -h -s desktop.ini
which will turn off the Hidden and System attributes for the desktop.ini file, a task not possible from within Explorer. Note that this is similar to the use of the attrib command in Step 6 in the previous solution, except that we're using minus signs (-) to turn off the attributes instead of plus signs (+).
Next, type the following two commands:
del desktop.ini del target.lnk
Type exit when you're done. See Appendix B for more details on the CD, ATTRIB, and DEL commands used here.
If the new folder is open, close it now. The next time you open the folder, it should be empty, and can be safely deleted.
The Places Bar is the gray bar along the left edge of the File Open and File-Save dialog boxes used by most applications in Windows XP. Like many of the dialog boxes and dialog box elements in applications, these file dialogs are a function provided by Windows, and are used for the following reasons:
Application developers don't have to reinvent the wheel with their own file dialogs.
Users get a common experience and don't have to learn a new interface for each application.
Microsoft can add new features to file dialogs (like the Places Bar), which are immediately and automatically propagated to all applications that use the feature properly.
The Places Bar has a maximum of five buttons, each of which points to a different folder on your system. By default, these places are Desktop, My Documents, Favorites, My Computer, and Recycle Bin. If you don't see the Places Bar on your system, the feature may simply be disabled (as described in the following Solution 1) or the particular application you're using uses non-standard or obsolete versions of the file dialogs.
There are three solutions that allow you to customize the Places Bar; the first works for most applications, but not Microsoft Office. Solutions 2 and 3 apply only to Microsoft Office XP and Office 2000, respectively. To customize all instances of the Places Bar, you may have to use all three solutions on your system. Note that Creative Element Power Tools (available at http://www.creativelement.com/powertools) allows you to customize the places bar for all applications simultaneously, including Office.
Start TweakUI (see Appendix A), and then open the Common Dialogs category.
Select Custom places bar, and then choose the desired system folders from each of the lists. Your selections will appear in the Places Bar in the same order as you choose them here. You can also type the full path of any existing local or network folder here; the folder's actual name and icon will appear on the corresponding button.
You can also choose either Show default places or Hide places bar at this point, both of which should be self-explanatory.
Click OK when you're done. You'll have to close and re-open any currently-open applications for the change to take effect.
The following works in Office XP, and requires no Registry editing. However, it's somewhat limited; for more control, and for Office 2000, use Solution 3, later.
Open any Office application, and go to File Open.
To add a new place to the Places Bar, navigate to the parent folder of the folder you wish to add (not the folder itself), and highlight it in the window.
Click Tools (in the upper right) and select Add to "My Places."
To rearrange places, right-click any existing place icon in the Places Bar, and select Move Up or Move Down.
You can delete any custom places my right-clicking their icons on the bar and selecting Remove, but you won't be able to remove the standard Places Bar entries without editing the Registry, as described in Solution 3.
Close any open Microsoft Office applications.
Open the Registry Editor discussed in Chapter 3.
If you have Office 2002 (also known as Office XP or Office 10), expand the branches to:
HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Common\Open Find\Places
If you have Office 2000 (also known as Office 9.0), expand the branches to:
HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\Open Find\Places
Either way, you should see two subkeys here: StandardPlaces and UserDefinedPlaces.
First, you'll have to disable the existing items; otherwise, your custom items won't be shown. This is done by adding a new value, not by deleting existing data. Don't worry if you want to keep one or more of the defaults; it's easier in the long run to disable them all here and then recreate the five you want to keep.
One by one, highlight each key under the StandardPlaces key (e.g., Desktop, Recent), and select New and then DWORD Value from the Edit menu. Name the new value Show, and leave the value of 0 unchanged. Make sure the values you add are DWORD values; otherwise, this won't work.
Next, highlight the UserDefinedPlaces key, and add five new keys. Name them Place1, Place2, Place3, Place4, and Place5. You can add more if you like (see Step 7).
In each of these new keys, you'll want to create the following values, filling in the appropriate information in each value:
This contains the caption that will appear under this place (example: Desktop).
This contains the full folder path for the place (example: c:\windows\desktop).
This allows you to choose how your places are sorted. Enter 0 for the first place, 1 for the second, 2 for the third, and so on. The key names typed in the previous step (Place1, Place2, etc.) do not determine the sort order.
Even if you add more entries here, only the first five will be shown. To allow more than five buttons on the Places Bar, go back to HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Common\Open Find\Places (replace the 10.0 here with 9.0 if you're using Office 2000). Select New and then DWORD Value from the Edit menu. Name the new value ItemSize, and leave the value of 0 unchanged (regardless of the number of items you want to appear). Now, any additional keys you add using the above procedure will also appear in the file dialog.
After you've entered all the new places, open any Office application to try it out. This may require some trial and error to get it right.
One of the things that make this difficult is that Office tends to indiscriminately add new keys and values, which can clutter up what you're working on. If you've done it right, however, the seemingly random keys and values that appear will have no effect on what actually appears in the dialog boxes.
When you're done, you'll want to make a Registry patch to back up your settings, just in case a subsequent Office update overwrites them. See Section 3.2.1 for more information.
AutoPlay (also called Autorun) is a feature intended to make using CDs and other removable media easier for inexperienced Windows users, but more experienced users may end up simply being irritated by it. AutoPlay is responsible for starting an audio CD, data CD, or DVD the moment it is inserted into your drive. If you wish to insert a disk for browsing or any other purpose than playing it, you'll be forced to wait for Windows to load the AutoPlay application before you can close it and continue with your work.
What's worse is that even after all this has happened, the AutoPlay process starts over again if you double-click on the CD icon in your My Computer window contrary, of course, to the normal folder window that one would expect to see. (You can get around this on a disk-by-disk basis by right-clicking on the disk icon and selecting Open or by using Explorer and navigating to the disk in the folder tree.)
The AutoPlay feature works by polling the CD or DVD drive every few seconds to see if a disk has been inserted. If Windows detects a disk that wasn't there a few seconds ago, it reads the label of the disk and looks for a file called Autorun.inf in the disk's root directory. Autorun.inf usually contains two pieces of information: a reference to an icon file (for display, along with the disk label, in My Computer and Explorer) and a reference to an AutoPlay application.[13] If an AutoPlay application is specified, Windows proceeds to run the program, which is usually a large, brightly colored window with links to the application's setup program, documentation, and the manufacturer's web site and, hopefully, an Exit button. Otherwise, any of several predefined "player" applications may be launched, depending on the type of content detected on the disk. In addition to CDs and DVDs, the AutoPlay system also supports some removable media drives, such as digital camera memory card readers.
[13] See Section 4.4.1 earlier in this chapter for another solution that uses the Autorun.inf file.
There are several different solutions available to control this feature in Windows, all of which perfectly illustrate the advantage of tweaking Windows to get around all its annoyances.
If you hold down the Shift key when inserting the disk, the AutoPlay feature is bypassed (although it's not exactly graceful trying to insert a CD while holding down keys on the keyboard).
Depending on the speed of your drive, you may have to hold Shift for only a few seconds, or longer if it's slow. This feature can be especially aggravating if you hold Shift while inserting a disk, as well as for 5-6 seconds thereafter, only to have the AutoPlay application start when you let go of the Shift key.
This next solution allows you to choose what happens when Windows detects a newly-inserted disk, based on the type of content the media contains. Note that this feature has bugs in it, and Windows doesn't always pay attention to your selection made here.
Right-click the drive icon for your CD drive, CD recorder, or DVD drive, select Properties, and choose the AutoPlay tab.
At the top of the dialog is a list of content types, allowing you to choose an AutoPlay action depending on the type of files on an inserted disk. Among the available content types are the following:
Music files (e.g., mp3, wma)
Pictures (e.g., jpg, gif, tif, bmp)
Video files (e.g., avi, mpg, asf)
Mixed content (used when no Autorun.inf file is found, and either no media files are found, or more than one type of media files are detected)
Music CD
Blank CDR (appears only for CD recorders)
DVD (appears only for DVD players)
You may have noticed that "Data CDs" are absent from this list, meaning that this window won't allow you to modify AutoPlay behavior for CDs or DVDs containing an Autorun.inf file. Unfortunately, there's no way to modify or add to this list.
Select an entry in the content type list, and then select an appropriate action to take. Each action is linked to an application, similarly to File Type actions (discussed earlier in this chapter). Unlike the content types, though, the actions can be customized, and the procedure to do so is explained in the next solution.
Click OK when you're done; the change will take effect the next time a disk inserted in the drive. Note that you'll have to repeat this for each of your removable media drives: CD, DVD, and memory card readers, included.
This next procedure adds more customizability to the AutoPlay feature, including a quicker way to disable AutoPlay than the previous solution, as well as a way to customize the list of actions in the AutoPlay tab of the drive properties dialog. It also allows you to disable AutoPlay completely for a given drive (or drive type), including data CDs (something not possible with the previous solution).
Open TweakUI (see Appendix A), expand the My Computer category, and then expand AutoPlay. There are three subcategories here: Drives, Types, and Handlers.
Select Drives to selectively disable AutoPlay for individual drives. Any unchecked drive will not AutoPlay inserted media, regardless of content.
Select Types to more globally disable AutoPlay for CD and DVD drives and removable drives.
Lastly, the Handlers category allows you to customize the actions shown in the AutoPlay tab of the drive properties dialog, as described in the previous solution.
TweakUI won't let you delete any of the predefined actions, but it will change the content types for which each is available. For example, you can choose whether or not the Copy pictures to a folder on my computer action is shown when you select Video files in the AutoPlay tab of the drive properties dialog.
|
Click Create here to add a new action, which can subsequently be selected for any removable media drive, and nearly any content type. Figure 4-14 shows the Autoplay Handler dialog.
The first two fields are decorative; the text you type for <description> and <program name> are merely the captions to be displayed next to the action. Click Change Program to choose an application executable (.exe file).
Lastly, the Args field, filled by default with "%L", allows you to specify one or more command-line parameters. Whatever you type here should be supported by the application you've selected (more details may be available in the application's documentation).
Similar to %1, discussed in the File Types section found earlier in this chapter, %L represents the full path of the drive that was activated by the AutoPlay feature. The quotes are simply included for good measure, intended to compensate for any spaces in the path name. For example, if you chose Windows Explorer (explorer.exe) as the program, and change Args to:
/n, /e, "%L"
then Windows will execute the following command when, say, a CD is inserted in drive g:
\Windows\explorer.exe /n, /e, "g:"
Click OK and close TweakUI when you're done. To take advantage of any newly created AutoPlay actions, see Solution 2.
If you disable the AutoPlay feature for data CDs, the AutoPlay application on any given CD will, as you'd expect, not run automatically. Fortunately, it's easy to run the setup application or any other application on the CD manually. To do this, right-click on the drive icon in Explorer, and select AutoPlay. Alternatively, you can open the root directory of the CD drive in Explorer on most data CDs that contain software, you'll see something like Setup.exe or Autorun.exe. Double-click the file to run it. Sometimes, however, the AutoPlay application file is not obvious, in which case, you can open the Autorun.inf file and look at the line that begins with open=. If you don't see an Autorun.inf file in the root directory of the CD, it doesn't support the AutoPlay feature, and wouldn't have started on its own even if AutoPlay was still enabled.
If you want a quick and dirty way to disable all AutoPlay functionality for CD drives, as well as the system that polls the CD drive every few seconds (as described at the beginning of this section), use the following solution.
Open the Registry Editor discussed in Chapter 3.
Expand the branches to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom.
Double-click the Autorun value and type 0 for its value. If it's not there, create it by selecting Edit New DWORD Value, and typing Autorun for the name of the new value.
Close the Registry Editor when you're finished. You'll have to log out and then log back in for this change to take effect.
Note that with this solution, Windows will no longer be notified when you insert a new CD. To make sure the correct icon and title for the current CD are displayed in My Computer and Explorer, press F5 to refresh the window.