Windows DevCenter    
 Published on Windows DevCenter (
 See this if you're having trouble printing code examples

O'Reilly Book Excerpts: Windows XP Hacks, 2nd Edition

Hacking Windows XP

by Preston Gralla

Control User Logins by Hacking the Registry

ModerateHack 7

Make better use of the XP login screen.

If your system contains more than one user account, or if you've set up XP to require logins, you'll have to log in to XP before you can begin to use it. But you needn't stay with the default XP login rules; you can use a single Registry key to customize how you log in. For example, you can display custom text before login, and you can remind anyone with an account on the PC to change their password a certain number of days prior to the password's expiration.

Related Reading

Windows XP Hacks
Tips & Tools for Customizing and Optimizing Your OS
By Preston Gralla

To control logon options, run the Registry Editor [Hack #83] and go to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion Winlogon subkey, which contains a variety of logon settings (as well as some settings not having to do directly with logons). Following are the most important values you can edit to customize logons.


This setting lets you control how the system logon dialog box is used. If this String value is present and set to 1, all users will have to enter both their username and password to log on. If the value is 0, the name of the last user to log on will be displayed in the system logon dialog box.


This String value contains the name of the last user who logged on. It will be displayed only if the DontDisplayLastUserName value is not present or is set to 0.


This String value, used in concert with the LegalNoticeText value, displays a dialog box prior to logon that contains any text you want to display. (The text doesn't have to be a legal notice, but this value is often used for that purpose.) The box has a title and text. The LegalNoticeCaption value will be the dialog box's title.


This String value, used in concert with LegalNoticeCaption, contains the text that you want to be displayed inside a dialog box displayed prior to logon.


This DWORD value lets you display a warning message to users a certain number of days before their passwords are set to expire. It lets you determine how many days ahead of time the warning should be issued. To edit the value, click the decimal button and enter the number of days.


This String value enables or disables a button on the XP logon dialog box that lets the system shut down. A value of 1 enables the button (so that it is shown); a value of 0 disables the button (so that it is not shown).


This String value really doesn't have to do with logons, but it's one you should know about. It determines the shell—the user interface—that will be used by XP. The default is Explorer.exe, but it can be another shell as well—for example, the Program Manager from older Windows versions. Type in the name of the program; for example, Progman.exe for the Program Manager, or Taskman.exe for the Task Manager.


This DWORD value doesn't have to do with logons either, but it's another good one to know. It sets whether to automatically restart the Windows shell if the shell crashes. A value of 1 automatically restarts the shell. A value of 0 tells XP not to restart the shell, forcing you to log off and then back on again to restart it.

Now that your system's startup and shutdown are under control, let's move on to the user interface.

Give Internet Explorer a Face-Lift

ModerateHack 32

Don't like the way Internet Explorer looks? A better-looking browser is just a Registry edit away.

Everything about Internet Explorer screams, "Dull, dull, dull!" From its generic-looking logo to the plain background for its toolbars, you just better hope the content you're visiting is enough to keep you awake. But you don't need to be stuck with its plain-Jane looks; these Registry hacks will let you change it however you'd like.

Change the Internet Explorer Logo

Internet Explorer has both a static and an animated logo. The static logo displays when the browser is inactive, and the animated logo displays when the browser is locating a site, connecting, and actively downloading pages or images from the Web. Because you have the choice of displaying large or small icons on the Internet Explorer toolbar (to switch back and forth between the two, choose View → Toolbars → Customize → Icon Options → Large/Small icons), there are two sizes of both the static and animated logos.

Before you begin, you'll need to create new logos to replace the existing ones. You'll have to create two sets of icons in .bmp format: one set for the smaller logo and another set for the larger logo. Each set will have a static logo and an animated logo. The static logos should be 22 22 pixels for the smaller size and 38 38 pixels for the larger size. The animated logos have to be animated bitmaps, each of which should have a total of 10 frames. So, the smaller animated bitmap should be 22 pixels wide by 220 pixels high, and the larger animated bitmap should be 38 pixels wide by 380 pixels high.

Create the static bitmaps with any graphics program, including the version of Paint that comes with XP. You can also use special icon-creation programs to create your icons, such as Microangelo ( See [Hack #19] for more details. (Make sure when using Microangelo to choose Tools → New Image format, which will let you create the icons with the proper pixel dimensions, as explained in the previous paragraph.)

To create the animated bitmaps, you'll need special tools. Microangelo does a great job of creating them, and that's your best bet. If you prefer, though, you can create the 10 separate frames for the animated bitmaps in a graphics program such as Paint and then stitch the 10 separate frames together using the Animated Bitmap Creator (, a free command-line program.

To change Internet Explorer's static logos to your new ones, run the Registry Editor [Hack #83] and go to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main

Create two string values named SmallBitmap and BigBitmap and give them each the value of their filename and location, including the full path—for example, C:\Windows\IEbiglogo.bmp and C:\Windows\IEsmalllogo.bmp. As you might guess, the SmallBitmap value points to the smaller logo, and the BigBitmap value points to the larger logo.

To use your new animated logos, go to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Toolbar

Create two string values named SmBrandBitmap and BrandBitmap and give them each the value of their filename and location—for example, C:\Windows\IEbiganimatelogo.bmp and C:\Windows\IEsmallanimatelogo.bmp. Once again, as you might guess, SmBrandBitmap is for the smaller animated logo and BrandBitmap is for the larger logo.

Exit the Registry and close Internet Explorer. When you next start up Internet Explorer, it should display your new logos. To revert to the default logos, simply delete the values you've created.

Add a Background to the Internet Explorer Toolbar

The Internet Explorer toolbar that sits at the top of Internet Explorer is about as dull as it gets—a plain, solid background, like the rest of Internet Explorer. But it doesn't have to be that way. You can add any background you want.

First, create the background or use an existing one. The background should be in .bmp format. Create it using a graphics program such as Paint Shop Pro (available from or Microangelo. See [Hack #19] for more details.

You'll also find a variety of .bmp files in the C:\Windows folder, so check them out to see if you like any. You might try FeatherTexture.bmp, which you can see in use as an Internet Explorer toolbar background in Figure 4-1. Whatever you choose, though, make sure it's light enough to show black text and it's not so busy that you can't read the menu text that will be on top of it. If you create or use a file that's too small, Internet Explorer will tile it for you. However, don't use a bitmap smaller than 10 10 pixels, because all the work Internet Explorer has to do to tile images that small will slow down your web browsing.

Figure 4-1
Figure 4-1. Internet Explorer with FeatherTexture.bmp as its toolbar background

Once you have a bitmap, run the Registry Editor and go to:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Toolbar

Create a new string value named BackBitmapIE5 and give it the value of the filename and location of the background you're going to use, such as C:\Windows\FeatherTexture.bmp. Exit the Registry and close Internet Explorer. When you next start up Internet Explorer, it will display the background on the toolbar. To take away the background, simply delete the BackBitmapIE5 key.

TIP: You can change the background of the Internet Explorer toolbar without having to edit the Registry; you can use Tweak UI [Hack #8]. Run Tweak UI, click Internet Explorer, and click the box next to "Use custom background for Internet Explorer toolbar." Then, click the Change button and choose the file you want to use as the background. You'll see a sample of how the toolbar will look, so change the file until you find one you want to use. When you find it, click OK, close Internet Explorer, and restart it. The new toolbar will be there.

Change the Text of Internet Explorer's Titlebar

Internet Explorer's titlebar displays the text "Microsoft Internet Explorer," along with the title of the page you're currently visiting. However, you can change the "Microsoft Internet Explorer" text to any text you want. Run the Registry Editor and go to:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

Add a new string value named Window Title and give it a value of whatever text you want displayed in the titlebar. Exit the Registry and close Internet Explorer if it's open. The next time you open Internet Explorer, the titlebar will have your new text.

If you want your titlebar to have no text in it, aside from the title of the page you're currently visiting, create the Window Title string value but leave the Value field empty.

Build Your Own Firefox Search Engine

ExpertHack 44

Firefox's built-in search box lets you search Google from wherever you are. You don't have to settle for that built-in searching, though, because you can build your own Firefox search engine plug-in to search through any site from the Google search box.

Take a look at the upper-right corner of your Firefox browser [Hack #43] . You'll see a nifty search box called the Search Bar that lets you search Google by typing in a search term. Better yet, you don't have to settle for searching just Google that way. You can search through other sites as well by installing a specific search engine add-in for that site to the Search Bar. So, instead of using Google to search the Internet, for example, you can use Ask Jeeves ( or A9 (

And you're not limited to search sites. You can also search through an individual site. So, for example, you can search through (, eBay (, (, or the health site WebMD ( from that box as well. All you need to do is find and add the right search engine plug-in.

To do so, click the down arrow next to the G in the search box, and choose Add Engines. You'll be sent to, which is a directory of hundreds of search engines you can use in Firefox. Browse or search until you find one you want; then click its link. You'll get a dialog box like that shown in Figure 4-38, asking whether you want to add it to the Search Bar. Click OK, and it'll be added.

Figure 4-38
Figure 4-38. Confirming the addition of a new search engine to the Firefox Search Bar

To choose which search engine to use in the Search Bar, click the down arrow next to the G in the Search Bar and choose your search engine from the list. Then, type in a search term, and you'll search using that engine. The engine will stay there as your default until you choose another one.

All that's well and good. But why settle for a search engine that's already been written? It's not that hard to write a plug-in of your own.

To get started, open a new file in a text editor such as Notepad. Give it the name of the site for which you're building a search engine, and give it the extension .src. In our instance, we're going to build a search engine for searching the federal government's White House site, so we'll call it White House.src. Save it in the folder C:\Program Files\Microsoft Firefox\searchplugins\.

The first line of the plug-in should be the search tag <search, and the next line should indicate which version of Netscape the plug-in was written for. Now, I know Firefox isn't Netscape, but both are based on common code, called Mozilla, and for reasons not quite understandable, you need to include the most current version number of Netscape. At the time of this writing, it's 7.1, so that's the version we'll put here. Enter the text version="7.1" underneath the search tag so that the first two lines of your file look like this:


Next, name your plug-in by using this syntax:

name="My Plugin"

But replace My Plugin with the name of the plug-in you're writing. In our instance, we're calling it White House.

Now, describe your plug-in by using this syntax:

description="My Plugin - My First Search Plugin"

Our plug-in now looks like this:

name="White House"

Now you have to tell the plug-in what action to take when you type in a search term and press Enter. What you're doing here is telling it how to search the site. To get this information, go to the site for which you want to build a search engine. Do a search, and look at the first part of the resulting URL, the portion before the first question mark (?). That's what will tell what action your search engine should take. For the site, that first part of the URL before the ? is

Here's the syntax:


So, in our instance, the line looks like this:


Now you need to put in the name of the search form. This will be the name of the site you're on, written with the following syntax:


Again, in our instance, this is:


Underneath that, put the following code:


This tells the plug-in to use the GET method of searching, which is the only method supported, so there's no choice here. After that line, close off the search tag with a closing tag:


So, here's what our plug-in looks like so far:

name="White House"

Now you need to add a line that tells the site's webmasters and site administrators someone is searching the site using the plug-in. So, put in this line:

<input name="sourceid" value="Mozilla-search">

Next, you need to tell your plug-in what syntax to use when searching for the text you'll type into the Search Bar. This varies from site to site. Again, take a look at the URL that results after you search the site. Look for whatever falls between the first ampersand (&) and your search term. For the site, it is qt.

Here's the syntax for this line:

<input name="query" user="">

So, in our instance, the line looks like this:

<input name="qt" user="">

Now you need to close off the entire search section with a closing </search> tag:


Here's what our final file looks like:

name="White House"
    <input name="sourceid" value="Mozilla-search">
<input name="qt" user="">

That's it; you're done. Close Firefox and restart it. Click the down arrow at the Search Bar, and your search engine plug-in will show up. Select it, type in your search term, press Enter, and you'll search the site.

Hacking the Hack

When you right-click the down arrow on the Search Bar, you'll see that many plug-ins have a small icon next to them. Yours doesn't, however. That's because you haven't created an icon for it. Create a 16 16 pixel icon, give it the same name as your plug-in, and save it as either a .jpg or .png graphics file. Then, put it in the C:\Program Files\Microsoft Firefox\searchplugins folder. So, in our instance, we create one called White House.jpg.

For information about how to create icons, see [Hack #19] . You can also find ready-made icons in the right size, although not the right format, right on the Web. When you visit many web sites, you'll see in your web browser a small icon to the left of the http://; that same icon might show up next to the http:// on your Favorites list because the sites use something called a favicon which the browser displays.

You can find the favicon for the site, save it to your PC, convert it to .jpg or .png format, and use it for your search engine plug-in. To find the favicon for a site, go to, where website is the Favorite you want an icon for. For example, go to for the O'Reilly icon. Keep in mind, though, that not all web sites have favicons, so you won't be able to do this for every site.

If you're using Firefox to get the icon, a dialog box will open, asking what to do with the file. Save it to your hard disk. If you're using Internet Explorer, you'll open the icon itself in your browser. Right-click it, choose Save Picture As..., and save it on your hard disk.

It'll be in .ico format, so you need to convert it to .jpg or .png. An excellent program for doing this is IrfanView, available from For details about how to do the conversion, see [Hack #99] . When you store the file, make sure it's in C:\Program Files\Microsoft Firefox\searchplugins.

See Also

Preston Gralla is the author of Windows Vista in a Nutshell, the Windows Vista Pocket Reference, and is the editor of He is also the author of Internet Annoyances, PC Pest Control, Windows XP Power Hound, and Windows XP Hacks, Second Edition, and co-author of Windows XP Cookbook. He has written more than 30 other books.

View catalog information for Windows XP Hacks, 2nd Edition

Return to the Windows DevCenter.

Copyright © 2009 O'Reilly Media, Inc.