Скачиваний:
80
Добавлен:
15.03.2015
Размер:
12.74 Mб
Скачать

Hacking Windows

Explorer

he Windows Explorer is one of the most used parts of Windows XP. TEvery time you go to My Computer and browse through files on

your computer, you are using Explorer. Using the icons on the desktop, right-clicking Files and Folders, copying and pasting files are all examples of using the features that the Explorer provides.

Many of the features that Windows Explorer provides can be easily customized to make Windows XP even better. This chapter will show you how you can change many of the features and how to take advantage of some of the new, lesser known features. It will start off with showing you how to customize the way you interact with files and then how you view your files. By the end of this chapter, you will have completely customized all of ways that you use Explorer to browse through and create files on your computer.

Hacking File Associations

Every time you click a file, Windows looks up what the default program to open for the file is from the registry. Then, Windows loads that application and tells the app what file to open up. This is something that we encounter almost all the time when we are using our computer. Often, when you install many programs on your computer, programs start to compete over which is going to be the default program to open up a file.

This commonly occurs when you install various music applications on your computer. I used Winamp to place CDs and MP3s on My Computer almost all the time. But when Apple released iTunes for Windows, I switched to that right away because of the cool library. Once I installed iTunes on My Computer, it took over all of my music files. Whenever I would insert a CD into my drive, iTunes would automatically load and start playing it. When I would click a MP3 file on my hard drive, the same would occur.

chapter

in this chapter

Working with File Associations

Hacking the Context Menu

Customizing Folder Appearance

Folder Views

Hidden Files

Disabling Common Tasks

118 Part I — Customizing Your System

What happened to My Computer when I installed iTunes is not always a bad thing. However, there are situations when I wanted to use Winamp to play my MP3 files. One big reason for this is that when I click an MP3 file and it plays in iTunes, it is automatically added to my library. When I am sorting through my collection of songs that I ripped from my old CDs, I don’t always want to add all of the songs to my library in iTunes because there are usually just two or three clicks on a 14-track CD. One easy solution to this problem is to change the file association back to Winamp so that when I click a file, it will be played in Winamp. Then if I like it, I can always add it to my library later within iTunes.

These next two sections will show you how to customize the default launch application for all of the different file types on your computer, as well as how your file types look.

Changing the default launch app

The information that Explorer looks up to find which program should be used to launch specific file types is stored in the System Registry under the HKEY_CLASSES_ROOT section. Using the Registry Editor, it is possible to browse to that key and then find the file type that you want to change and edit some keys, but there is a much easier way in Windows XP to accomplish the same task.

Hidden away in Folder Options within any Explorer window resides a useful utility to change the default application easily without having to worry about application IDs and file association structure. Just follow these steps to change any File Types default launch app:

1.Open up My Computer by clicking the desktop icon or on the icon in the Start panel.

2.When you have My Computer displayed on your screen, click the Tools menu bar item and select Folder Options.

3.Once the Folder Options window appears, click the File Types tab.

4.Navigate through the list of file extensions until you find the extension of the file for which you want to change the default app. Because I want to change my MP3 player default launch app, I am going to select the MP3 file extension. When you find the file extension that you want to change, select it by clicking it.

5.Click the Change button once you have your extension selected, as shown in Figure 5-1. The Open With properties window will load, asking you what program to load it with. It will show a list of common programs that you can choose from, but you are not limited to just those programs. Click the Browse button to navigate to any executable file on your computer to specify exactly what program you want to use if it is not on the list.

6.Once you have the application selected that you want to use, just click the OK button to save your changes. You are now finished with changing the launch app.

Your changes to file launch apps are activated immediately after you click OK to save your changes. Now you will no longer have to worry about applications taking control of your files.

Chapter 5 — Hacking Windows Explorer 119

FIGURE 5-1: Changing the default launch app for MP3 files.

Changing the icon of any file type

So far, you have learned how to change the icons of the desktop icons. This next section will show you how you can change the default icon that is displayed for any file type on your computer. Changing the icons is actually very easy; the most difficult part of the process is trying to figure out what icon to use. Additionally, keep in mind that you can use any of the new high resolution icons that you can download from the sites mentioned in the Changing the Desktop Icons section in Chapter 3.

To get started changing your icons, you are going to want to use the Folder Options feature you used in the last section. Follow these steps to begin:

1.Open up Folder Options again by clicking My Computer. Then when it launches, click the Tools menu bar entry and select Folder Options.

120 Part I — Customizing Your System

FIGURE 5-2: Changing the icon of a specific file type.

2.Inside Folder Options, click the File Types tab to reveal the list of all of the different file extensions on your computer.

3.Browse through the list and select the extension for which you want to change the icon.

4.Once you have the entry selected, click the Advanced button.

5.On the Edit File Type screen, click the Change Icon button, as shown in Figure 5-2.

6.The Change Icon screen will be displayed. Here, you will be shown various system icons from which you can choose. If you do not find any that you like, just click the Browse button and select an icon that you downloaded on your computer.

7.Once you find the perfect icon, click OK to select the new icon.

8.Then click OK once more to save your changes.

You don’t have to reboot after you make your changes, because you will see your changes immediately after you click OK to save them.

Hacking the Context Menu

What is the context menu? This is the menu that pops up when you right-click a file on your computer. Over the years, these menus have become more and more useful. However, with the

Chapter 5 — Hacking Windows Explorer 121

extra entries in the context menu, they often become cluttered with options and features that you just don’t need. These next few sections will show you how to get your menus back under control as well as how to take advantage of the new features to make your own context menu entries.

We will start off by removing items from the context menus and will then move on to adding and customizing the components of the menus.

Removing items from the context menu

Over time, your context menus can become cluttered with program entries from old programs that you may not use any more. Sometimes, you may experience programs that take over all of your context menus. Compression apps such as Winzip or Picozip always end up adding program entries to all of the context menus. I have Picozip installed on My Computer and every time I right-click any file or folder, I see five entries from Picozip giving me different compression options. This can be a convenient feature, but if you don’t compress and extract ZIP files very often, then you might not need the added convenience. Instead you could remove these entries from your context menu, which will give your system a cleaner interface as well as a small performance boost if you have a lot of extra entries in your context menu.

Before editing your registry, you would be wise to create a system restore point by using system restore. Doing so will provide an easy method to revert to your original configuration before you made any changes just in case you accidentally delete or modify something that hurts your computer.

Actually removing these programs from your context menus can be a little tricky, because they are spread in different places in the registry. Also, the easy-to-use context menu editor that you used in the last section to change the icon and default launch app for certain file types is not robust enough to allow you to remove entries from programs that take over all context menus such as Picozip. The only way to remove these types of entries is to edit the registry directly. If you want to remove an entry on a context menu that does not appear on every context menu and just appears on one or a few other file types, then you can still use the easy-to-use editor. Because of that, I have provided you two different sets of steps depending on what you want to do. When you are ready, follow these steps for the corresponding type of entry to remove it for good.

Removing entries that appear in all context menus

This set of steps will show you how to remove entries in the context menu that appear in all menus for all file types that were put there by programs such as Picozip.

1.Start up the Registry Editor by clicking the Start button and selecting Run. Then type regedit in the box and click OK.

2.When the Registry Editor appears, expand the HKEY_CLASSES_ROOT folder. You will now see a list of every file type that is set up on your computer.

3.If the entry that you want to remove from the context menu appears in all context menus, such as the preceding Picozip example, you will have to expand the * folder.

122 Part I — Customizing Your System

4.Now that you have the correct folder expanded, expand the Shellex and ContextMenu Handlers folders. Your registry path should look like HKEY_CLASSES_ROOT\*\ shellex\ContextMenuHandlers.

5.Look through the list until you find the entry that you want to remove. Right-click the folder of the entry and select Delete. You will find that identifying some of the programs is easy. For example, Picozip is labeled Picozip. However, you may run into some items that are listed using their application ID number or a vague name. If that is the case, copy (Ctrl C) the application ID, which is formatted like this—{XXXXXXXX-XXXX- XXXX-XXXX-XXXXXXXXXXXX}—to the clipboard. You may have to expand the folder to see the ID. Then, once you have the ID copied to the clipboard, press Ctrl F to bring up the Search box in regedit and paste the ID in the box. Next, just click Find and you should be able to find some other references to that same ID in your registry that also might give you some clues to what it is. If that does not work, try doing a search on Google to see if that turns up anything.

6.Once you are finished removing all of the entries from your context menus, just close Registry Editor and you are finished. Your changes will be in effect immediately.

Removing entries that appear only under certain file types

If you want to remove an entry on a context menu that appears on just one file type or a few different file types, this section will show you how to easily remove it by using the context editor in Folder Options.

1.Open up My Computer by clicking the icon on the desktop or by clicking the Start Menu.

2.Once My Computer appears on the screen, click the Tools menu and select Folder Options and click the File Types tab.

3.Scroll through the list of file types and select the extension that you would like to modify.

4.Click the Advanced button to bring up the Edit File Type window, where you will see a list of all of the different entries that will show up in the context menu, as shown in Figure 5-3.

5.Select the item that you want to remove and click Remove.

6.Click OK and you are finished.

If you ever want to revert to your original context menus, you can just restore your computer to an earlier checkpoint. Or, if you didn’t create a system restore checkpoint, you can just reinstall the app and that should take care of it.

Adding your own items to the context menu

Now that you have removed all of the extra clutter from your context menus, why not add some useful entries to your menus? You can add a lot of interesting things to your context menus that can enhance your experience with your computer. My favorite item to add to the context menus is a “Send Attached to Message” entry. This entry in my context menu grew out of a need to find a better way to e-mail files. I send a lot of messages every day, often just

Chapter 5 — Hacking Windows Explorer 123

FIGURE 5-3: Edit File Type window displaying a list of all of the entries in a text document’s context menu.

for the purpose of sending a file. I thought to myself, wouldn’t it be simple if I could just right-click a file and select some option that would automatically open up Microsoft Outlook, create a new message, and attach the file? That would streamline the whole process by knocking out a few steps.

Adding an entry to a context menu is very simple. The most difficult part of solving my little puzzle was figuring out how to launch Outlook so it would automatically create a message and attach the desired file to it. After a few minutes on Google researching, I came across OutlookTips.net, which is a great resource for just the information that I was looking for. According to www.outlook-tips.net/howto/commandlines.htm, I just had to launch Outlook with the /a switch and the name of the file. Once I had this information, I had all of the pieces of the puzzle and was ready to start putting it together. Perform the following steps to learn how to add your own item to any File Types context menu:

1.First, open up a copy of My Computer by clicking the icon on the desktop or Start panel.

2.Click the Tools menu bar item and select Folder Options.

3.Then, click the File Types tab to expose all of the different file types on your computer.

4.Because I usually send Word documents, I scrolled down the list of file types and selected the .doc file extension. Pick any other file extension for which you would like to add an entry.

124 Part I — Customizing Your System

5.Then, once you have the entry selected, click the Advanced button to bring up the Edit File type window.

6.Click the New button to add an entry.

7.In the Action box, type in the name that you want to appear on the menu. I typed in

Send Attached to Message.

8.Then, in the Application Used to Perform Action box, you will want to specify the application and any switches that you want to use for this new entry. Click the Browse button to easily browse to an executable. I navigated until I found OUTLOOK.EXE inside the

OFFICE11 folder.

9.When you click OK, the path to the executable will fill the box. Now you will want to add any application flags at the end of the line. To tell Outlook to create a new message and attach a file to it, I had to add /a- after the path, followed by %L. The %L is a system variable that holds the name of the file that you are right-clicking. When I was finished, my box looked like the following (including the quotes): “C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE” /a “%L”.

10.When you are finished editing your new entry, click OK to save it.

You are now finished adding an entry to a specific File Types context menu. If you followed all of the previous steps to add the Send Attached to Message entry, every time you right-click a Word document, you will now see the new entry, as shown in Figure 5-4. If you want to add

FIGURE 5-4: What the context menu will look like after the Send Attached to Message is attached.

Chapter 5 — Hacking Windows Explorer 125

the same entry on other file types, just repeat the previous directions by selecting a different file type in step 4.

You can do even more things with the context menus. If I wanted to, I could use the different switches that I found on the Outlook Tips Web site (www.outlook-tips.net) to make my entry send the file to a specific person instead of leaving the To field blank in Outlook. Once you know the %L variable, you can send the name of the file to any program, given that you know the correct switches with which to launch the program.

I have included a registry file that you can import to easily set up your context menu with the Outlook Send To hack that will display the shortcut on all context menus for Microsoft Word documents. Outlook_sendto.reg is located in the Chapter 5 folder of the companion CD-ROM.

Modifying the Send To menu

The Send To menu is one of the features of my context menus that I use the most. The ability to right-click any file and have a shortcut of it sent to the desktop is invaluable. All of the other features are very useful as well. How would you like to make it even more useful? It is very easy to add your own items to the Send To menu, such as folders that you can send files to. Do you have a folder that you store all of your music in? How about a folder that you store all of your digital photos in? Just follow these quick steps to add anything that you want to your Send To context menu entry.

1.Open up My Computer and browse to the C drive, or whatever drive you have Windows installed to.

2.Then browse through Documents and Settings, your user name, and the Send To folders.

If you do not see any of the folders that are required in this section, you may have hidden files turned on. Because these folders are hidden by default, you will have to tell Windows to show all files. To do this, refer to the section on working with hidden files towards the end of this chapter.

3.When you are looking at C:\Documents and Settings\Username\SendTo, you will see all of the files that appear in the Send To menu. If you want to add an entry to the menu, just copy a shortcut to this folder.

4.Let’s say that you want to add your Digital Photos folder to your Send To menu. Just navigate to your Digital Photos folder and right-click it and select Send To desktop. Then just cut and paste the shortcut that was created from your desktop into the Send To folder.

5.If you ever want to remove some items from the Send To menu, just delete them from the Send To folder.

It is that simple. You are now finished with customizing your Send To menu. Now you will be able to fine-tune all of the different features of your context menus so that you can get the most out of your Windows XP experience.