Help for New Programmers - Troubleshooting Windows


1. Where does Windows look for the programs it runs on startup?

A question often asked by new programmers (or by many other computer users for that matter) is how Windows decides what programs to run when it starts. When your computer is switched on, Windows looks in several places to decide what programs are run first. Files in any of these places will be run as Windows starts up:

  1. Under Windows NT / 2000 / XP any programs run as services will be run.
  2. Windows looks in the registry under the following keys. Note that HKCU is short for HKEY_CURRENT_USER and HKLM is short for HKEY_LOCAL_MACHINE:

      HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices (possibly)

    Also there are similar keys which are run once then removed:

  3. Windows runs files in the \Windows\Start menu\Programs\Startup folder. This folder may contain links in which case the actual program being run will reside in another place.
  4. The WIN.INI file may contain programs which are run.
  5. The \AUTOEXEC.BAT file may contain programs which are run.

As an experiment, a Windows Laptop with Internet Explorer v4 was started, and Spy++ was used to list the runing processes on startup:

  systray (run from the registry)
  loadwc (run from the registry)
  winampa (run from the registry)
  imgicon (run from Startup folder)

The 4 module names followed by comments could be prevented from loading on startup by removing them from the registry and the startup folder. Removal of Systray prevented the Windows tray icons from being displayed. Removal of Winampa prevented winamp from showing up in the system tray, although it could still be started by running the EXE file. Removal of imgicon did not prevent the Iomega 100 MB Zip drive from working. Kernel32 and Explorer are key tasks which are part of Windows. Spower is power saver software for the laptop. Mprexe is the multi provider EXE file for networking.

Also, "Loadwc.exe" was used to start Internet Explorer. After installing a new ISP (Tiscali) the computer always started Internet Explorer on boot-up, then displayed a "page not found" error message because the laptop uses dial-up access and was not connected to the internet. It seems the Tiscali installation somehow modified the registry or "loadwc.exe" to start Internet Explorer on boot-up. Removing "loadwc.exe" from the registry setting "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" fixed the problem. Also, running "loadwc.exe" from the command line (it was in \Windows\System) caused Internet Explorer to start and display the same "page not found" message. Therefore it seems Tiscali used the registry key mentioned for start-up programs.

2. How do I remove programs that don't want to be uninstalled?

Programs in Windows are normally uninstalled with Start - Settings - Control panel - Add/Remove programs. This usually works, but if a program was not installed properly or it was deleted by hand, the Add/Remove programs command will not be able to remove the program and its name will remain in the list of removable programs for evermore. This can be annoying, but you can edit the list of removable programs which is stored in the registry. Write down the name(s) of the programs to remove from the Uninstall list, then start RegEdit (Start - Run - regedit). Once RegEdit is up, look for the following key:


There should be a long list of all the programs the Control Panel thinks it can uninstall. Some of them won't show up in the uninstall list, presumably because Windows likes to uninstall them on its own. Note how each program includes the name, and a command string that is executed to uninstall the program. Look through the list for the program you want to remove from the uninstall list, then delete it. This should prevent it showing up in Add/Remove programs the next time you run the control panel.

Be careful to delete the right program. If you delete the wrong one you will not be able to uninstall it from the control panel. Unfortunately RegEdit makes changes to the registry as it runs, it stores the registry in "\windows\system.dat" and a backup copy in "\windows\system.da0". Both these are hidden system files. If you deleted the wrong program one of the following should be possible:

  • Run RegEdit on the backup copy of the registry and see what the command is to uninstall the program. Then run the uninstall command by hand.
  • Reinstall the program from the original disks, which should copy all the files across and update the registry settings. Then you should be able to uninstall it in the normal way.

3. How do I stop Windows from hiding my menus?

Windows has a "feature" where it hides infrequently used menu items on the Start - Programs menu and on other menus. This is about as helpful as a car that hides the hazard warning light switch because it hasn't been used for a while. This annoying feature can be deactivated as follows:

  1. Click Start - Settings - Control Panel - Taskbar and Start menu, General, then uncheck "Use Personalized Menus".
  2. Click Start - Settings - Control Panel - Internet Options, Advanced then uncheck "Enable Personalized favorites menu".

Refer to Microsoft Knowledge Base Article Q230596 for more information.

4. How do I make Windows use the correct date/time format in an MS-DOS window?

The date and time format in Windows is set from the control panel (Start - Settings - Control Panel), then double clicking the Regional Settings icon, and choosing the correct area from the list. If you change the date / time format you may have to reboot afterwards.

However the date / time format for a DOS prompt is set differently. This will be familiar to MS-DOS users but Windows users may not know how. The DOS date / time format is set in a "config.sys" file which is stored in the root directory. This is a text file that can be edited with Edit or Notepad. Open the file and add a line at the end "COUNTRY=044" to set the format for the country you are in. 044 = UK, 061 = Australia etc. The country number is usually the same as the International Direct Dial code. Save and close the "config.sys" file, and the changed code will take effect the next time you start the DOS prompt.

This will not work for a DOS prompt under Windows ME, since Microsoft have followed the engineering principle "if it ain't broke, let's change it". Windows ME no longer parses "config.sys" or "autoexec.bat". Instead the keyboard settings for a DOS prompt are changed using the MSCONFIG utility. Type Start - Run - Msconfig to start the program, and click on the International tab. Change the settings as follows:

  • Language. This can be left at "Current Language Settings". If you change it, MSCONFIG may change the file names to include full paths, which is not wanted.
  • MS-DOS Code Page. Leave at 850 for Western keyboards and character sets.
  • Country Code. This is the dialing code and should be 044 for the UK etc.
  • Country Data File Name. This is the country driver file, and should be "country.sys". If you change the Language, Windows may put a path in here which is not wanted. See KB article Q272719.
  • Display Data File Name. This should be "ega.cpi". Again this should not include a path.
  • Keyboard Data File Name. This should be "keyboard.sys". Again this should not include a path.
  • Keyboard Type, Keyboard Layout. Leave these blank.
  • Language ID. This is equivalent to the "keyb.sys" driver in earlier versions of Windows and should match the actual keyboard layout. If you are using a non-US keyboard with national currency symbols, accented characters etc, the Language ID should be the two letter country code in lower case. Eg "uk" for the Uk etc.

After confirming the entries, press OK and get ready to reboot. If it doesn't work, check the driver files don't include paths, check the country code has a leading zero if required (eg 044 for UK) and check the two-letter language ID.

5. Microsoft Word Annoyances

Microsoft have "improved" Word so that whenever you type a web address it highlights it using a special hyper-link font. The idea is you can click on the link and go to the site. Unfortunately the link is highlighted using a different font, which is annoying when you're writing documents that discuss web sites. Also Word is a word processor not a browser, and it's annoying having internet connection dialogs appearing just because you click on a web address in a word processed document. To turn off this auto-conversion:

  1. Use the Insert - Autotext - Autotext menu choice.
  2. Click the "Auto-format as you type" tab.
  3. Uncheck "Internet and network paths with hyperlinks".
  4. You may also want to unckeck "straight quotes with smart quotes".
  5. Click OK when done.

Also in Word, sometimes you want to insert pictures that aren't locked to the page, but can be edited and left or right or center aligned. To do this:

  1. Use the Insert - Object menu choice.
  2. Click the "Create New" tab.
  3. Choose "Microsoft Word picture" from the scrolling list.
  4. Uncheck "Float over text". This makes it possible to align the picture.
  5. Uncheck "Display as icon", in order the picture is fully visible.
  6. Click OK, which takes you into the Word picture editor.
  7. The picture editor lets you draw lines, blobs, group and ungroup elements, add 3D effects, and import bitmaps.
  8. After editing the picture, you may want to adjust the boundaries to expand or shrink the edges to match what you've drawn. Use the "Reset Picture Boundary" button to reset the boundaries. The button resides on the "Edit picture" toolbar. If the toolbar is not visible, use View - Toolbars - Edit Picture to make the toolbar visible. This is only possible while the picture editor is active.
  9. After editing the picture, close the picture editor by clicking the "Close Picture" button, which is on the "Edit Picture" toolbar. The picture editor and its toolbar will disappear.
  10. Back in the main document, the picture can be cut and pasted or aligned in the same way as a normal paragraph. Also it can be re-edited by double clicking it.

6. How does CD-ROM Autorun work?

CD-ROMs have an auto-run feature, whereby a program or file on the CD-ROM can start automatically when the CD is inserted. The auto-run action is defined by the autorun.inf file on the CD. If auto-run is a nuisance, it can be deactivated in several ways:

  • Hold down the Shift key while the CD is inserted. You may have to keep the key held down for 10 seconds or so, while the CD spins up to speed.
  • Another method only works under Windows NT / 2000 / XP and is described in KB article Q155217. Set the autorun value in the registry key HKEY_LOCAL_MACHINE\ System\ CurrentControlSet\ Services\ CDRom\ to zero to disable auto-run. Setting Setting autorun to 1 will enable it. The computer needs to be rebooted afterwards.
  • There is a different method that works with Windows 95. Go to Start - Settings - Control Panel - System - Device manager, open the CD-ROM branch, and double click the offending CD-ROM drive. This should bring up a tabbed properties dialog for the CD-ROM. Click the Settings tab, and uncheck "Auto-insert notification". Click OK twice to close the dialogs, then close the control panel. You may need to reboot the computer. Refer to KB articles Q126025 and Q141059 for more details.

It is possible to test auto-run without creating a new CD-ROM. Under Windows 95 and Windows NT / 2000 / XP there is a registry value HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Policies\ Explorer\ NoDriveTypeAutoRun containing hexadecimal binary data (a DWORD). The DWORD is one or more flag bits that disable auto-run on the specified drive. Here are the flags and their values:

  DRIVE_UNKNOWN             0
  DRIVE_NO_ROOT_DIR         1
  DRIVE_REMOVABLE           2
  DRIVE_FIXED               3
  DRIVE_REMOTE              4
  DRIVE_CDROM               5
  DRIVE_RAMDISK             6
  (reserved for future use) 7

The default value is 0x95 (0x90 | 0x5) that means DRIVE_UNKNOWN, DRIVE_REMOVEABLE, DRIVE_REMOTE and "reserved" don't use auto-run. The other drives (DRIVE_NO_ROOT_DIR, DRIVE_FIXED, DRIVE_CD_ROM and DRIVE_RAMDISK) will use auto-run. The auto-run choice is shown when you right-click the autorun.inf file. Refer to KB article Q136214 for more details.