Back to April 1996 Pullout
Up to Table of Contents
Ahead to April 1996 How-To Columns

April 1996 How To Columns

Top Optimizing Windows Applications Power Windows

Optimizing Windows

Watch Out for Falling Long Filenames

by John Woram

Click Here to see a 54.5 KB bitmap image of artwork which goes with this article, entitled:
It's a Jungle In There

IF YOU EVER find yourself searching for the best route to Recovery Street, watch out for danger signs along the way. The one I didn't even see coming was Caution: Falling Long Filenames.

As I mentioned last month, ScanDisk's /o switch in Windows 95's ScanDisk applet does an impressive job of permanently destroying all your long filenames. I ran into this interesting little "feature" while experimenting with various backup and restore procedures. Fortunately, I'd recently done a total backup using the Datasonix Pereos system, and I'd even made an emergency startup diskette.

Because my C: drive was now close to useless, I opted for the ultimate cleanup. I reformatted, booted from the emergency diskette and started down the recovery trail. The Pereos rescue diskette first recovered sufficient data from the tape backup so I could reboot the system in a limited Win95 configuration. A second pass of the tape restored the full contents of my C: drive. After another restart, my system was back in business, and the entire operation took less than an hour.

It wasn't the happiest hour I've ever spent, but considering that the pleasure of some recovery operations is right up there with root canal, I have no real complaints. And I did come away with some observations you may find useful if you're in the habit of trashing your hard drive. If you use a backup/restore utility that's not as Win95-friendly as the Datasonix system, here are a few items to keep in mind.

The default Briefcase icon may change to a folder icon during a restore operation. This may also happen in other instances, such as when you enable a new User Profile. In any case, just delete the folder and right-click on any empty Desktop space. Select New/Briefcase and you'll get a Desktop icon named New Briefcase. You can rename it Briefcase.

For some unrelated Briefcase trivia, drag the Briefcase into the Recycle Bin, and then look for it there. You'll find it's now called Briefcase Database. If you drag it back to the Desktop, it retains that name and picks up a generic document icon. Again, the fix is as just described. Microsoft says it's researching these problems, but I doubt they're anywhere near the top of the bug-fix list.

A tale of tails

Here's another opportunity to get into semi-serious configuration trouble. Last month, I showed how to add a NameNumericTail option with a binary value of 00. This value means, in effect, do not use a numeric tail (~1) for the first of multiple filenames that begin with the same eight characters-LongNameetc.DOC, for instance. In this case, the sequence of 8.3-compliant names would be LONGNAME.DOC, followed by LONGNA~1.DOC, LONGNA~2. DOC, and so on. If you hadn't added

NameNumericTail to the Registry, the sequence would begin with LONGNA~1.DOC.

Make sure this option is not present if you're about to run LFNBK /r C: to restore long filenames you previously backed up. Otherwise, many shortcuts to Windows 95 applets or applications won't run anymore. Here's an example of what can go wrong:

In the Accessories folder, WordPad's default shortcut is C: \PROGRA~1\ACCESS~1\WORDPAD.EXE. But if you've restored LFNs with NameNumericTail set to 00, the names of the indicated directories will no longer sport those ~1 tails. In other words, the actual path is now C: \PROGRAMF\ACCESSOR. Because the LFNBK utility doesn't rewrite any of the shortcuts to take such new names into account, Win95 can no longer find the WordPad file, or any other executable whose shortcut is now incorrect.

If you try to use the shortcut, you get the following message: "The item 'WORDPAD.EXE' that this shortcut refers to has been changed or moved. The nearest match, based on size, date and type, is 'C: \Program Files\Accessories\WORDPAD.EXE'. Do you want this shortcut to point to this item?" (You may see an equally misleading Network error message, depending on your configuration.)

The message may confuse you at first, because it appears Win95 found the proper file in the proper location. The problem is that when Win95 doesn't find WordPad where the shortcut says it will be, it searches elsewhere and finds it anyway. It then displays the original (and still valid) long filename path. In short (if not in shortcut), WordPad still hangs out in the usual place, but its shortcut (WordPad.lnk, in the C: \WINDOWS\START MENU\PROGRAMS\ACCESSORIES folder) still points to the nonexistent old ~1 folder names.

You can resolve such problems one at a time by answering Yes every time Win95 finds the right destination. Be careful, though, because Win95 may not always find the right item. If it doesn't, you'll have to make the necessary corrections yourself.

Desktop icons associated with the Microsoft Network may be more difficult to fix because Win95 stores critical information in the Registry. If your MSN icon is disabled, you'll get no help by checking its properties-it just shows that cheery message about how to explore the Network free. Instead, check the properties for the related Inbox icon. An error message is your indirect clue that the entire MSN system has been done in.

To resolve problems such as these, remove that NameNumericTail line from the Registry. Then, run LFNBK twice; once to back up all the LFNs (even though there aren't any) and a second time to restore them. The restoration process should restore most, if not all, the directory names and filenames that contain a tilde. With luck, all shortcuts and other Desktop icons will be fully operational again.

If you use the System Agent utility (part of Microsoft Plus for Windows 95, a.k.a. Plus Pack) to schedule routine maintenance chores (ScanDisk, defragger and so on), you may find it doesn't function after you use the LFNBK utility. This problem occurs if System Agent can't find its data file (SAGE.DAT), which hides out in the C: \PROGRAM FILES\PLUS!\SYSTEM folder. It then creates a new but empty SAGE.DAT file in the C: \ (or root) directory and rewrites the Registry to point to this empty file.

The simplest fix is to copy the valid SAGE.DAT from its original location into the C: \ directory, thus overwriting the empty file and placing the valid one where Win95 can find it. Better yet, edit the Registry by clicking on the plus sign in front of each of the following keys and subkeys: HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Plus! Then, highlight the System Agent folder and double-click on ConfigPath in the Name column. Change the C: \SAGE.DAT in the Value data box back to the default C: \Program Files\Plus!\System\SAGE.DAT.

Now that the System Agent knows where to find the original database, you can erase that empty SAGE.DAT file in the root directory.

If things go completely wrong . . .

The Windows 95 Resource Kit warns that "LFNBK might not be able to rename files with exact matches to long-filename aliases, and the related alias is not guaranteed to be the same as before running LFNBK." Here, "alias" means the conventional 8.3 name assigned to each long filename. Although some name changes are inconsequential, others may be quite troublesome. Let's look at an example of each.

The Windows 95 CD-ROM stores multimedia files in several cabinet files, one of which is WIN95_14.CAB. If you've installed the Cabinet File Viewer, which is part of the PowerToys package (see Power Windows, December 1995), you can view the contents of this or any file without expanding it. Otherwise, take it on faith that it contains the 17 "Jungle" theme waveform files, each of which has an appropriately long filename such as Jungle Windows Start.wav. I suspect these files were created by someone at Microsoft who had been experimenting with the NameNumericTail option. Thirteen of the files have 8.3 names, such as JUNGLERE.WAV, while only four take the JUNGLE~x.WAV form, where x is 1, 2, 3 or 4.

When the files are installed during a conventional Win95 setup, JUNGLERE.WAV and the others without numeric tails retain the same 8.3 names they had in the .CAB file, as you would expect. However, the four that end in ~1, ~2, ~3 and ~4 become ~5, ~4, ~1 and ~3. (Why? Who knows?) If you then run LFNBK to remove and then restore LFNs, Win95 will rename all 17 Jungle files JUNGLE~1.WAV through JUNGL~17.WAV. Confusing, but no big deal because who (besides me) worries about these things anyway?

Sometimes, though, the renaming is not so benign. If LFNBK runs into trouble, it may create one or more files named _LFNBKT_ (note underscores and no extension). It's worth doing a search to see if you have any files with that name. If you do, the file may be a duplicate of another file with a valid name. You can check by looking for another file of the same size and date in the same directory. If you find one (or more), open a DOS box and type the following command:

fc /b _LFNBKT_ filename.ext where filename.ext is the name of the other file of the same size. The command does a byte-by-byte comparison; if it finds no differences, you can erase the _LFNBKT_ file.

Potentially more troublesome is an _LFNBKT_ file in a folder such as C: \MSOFFICE\OFFICE\MSN, where you may find a small collection of apparently valid files, all the same size. Alas, Microsoft's continuing infatuation with its own name gets in the way. Each LFN begins with "Microsoft" followed by the name of an Office application. That means each 8.3 name is MICROS~x, which conveys no useful information about the identity of the file.

It might not matter though, because the long filename is there, too. But if one of the 8.3 names is MICROSOF.MCC, there may be trouble. If this file was ever named MICROS~1.MCC, Win95 may have renumbered all the other files during the LFNBK restore operation. If so, there's a strong possibility the file whose LFN indicates it's associated with one application may, in fact, be associated with another.

The specific files cited here are used by Microsoft Office 95 applications to dial into various help forums on the Microsoft Network. To see a list of what's available, open the Help menu in any application and select the Microsoft Network option. Highlight any forum listed and click on the Connect button to access that forum. If you wind up in the wrong forum, you'll know there's trouble. It would take considerable hacking to resolve problems such as this, and it is probably easier to simply uninstall the Plus Pack and then reinstall it.

This sounds confusing for a good reason-it's confusing. For a quickie demo, create three files named LongNamex.DOC, where x is 1, 2 and 3. Put the files on a diskette and, with NameNumericTail set at 00, run LFNBK to back up and then restore the LFNs. (Make sure you do this on a diskette so you don't cause havoc on your hard drive.) When you're done, you'll find three files named LONGNAME.DOC, LONGNA~1. DOC and LONGNA~2.DOC. Note, however, that the ~x no longer matches the number used in the LFN. In other words, LONGNA~1.DOC is actually LongName2. DOC, and so on. This becomes a problem if you use a word processor or other application that's not aware of long filenames.

As a final note, if you're about to run LFNBK to save long filenames prior to backup, make sure you close all applications and toolbars. The toolbar itself is an application, and its configuration may not survive a backup/restore operation. The Microsoft Office 95 toolbar gets restored with all the Office buttons on the toolbar even if you previously deleted some of them. Again, this is no great disaster, but you can save yourself the minor hassle of reconfiguring the toolbar if you remember to close it before running LFNBK.

Better yet, get a full Windows 95-aware backup utility, and leave all these problems for someone else.

A Backup Postscript

At the start of this column I mentioned the Datasonix Pereos system, which does a sensational job of backing up and restoring Windows 95 with a minimum of grief. But if you want to back up only a very few files, or perhaps a single file that's too big to fit on a single diskette, don't overlook Windows 95's own backup applet. Use it to back up a monster file to two or more diskettes, for instance, or to transport that file between two computers that aren't networked. The utility wants to restore the file to its original directory, so that directory structure should exist on the target machine. After that, you can move the file elsewhere, if necessary.

Senior Contributing Editor John Woram is the author of Windows Configuration Handbook (Random House, 1993). Contact John in the "Optimizing Windows" topic of the WINDOWS Magazine areas on America Online and CompuServe. To find his E-Mail ID Click Here

Top Optimizing Windows Applications Power Windows


A Mind-Expanding Trip Through Data Map

Like your brain, your applications have
powerful functions you haven't even used yet.

By Jim Boyce

Click Here to see a 68.8 KB bitmap image of artwork which goes with this article, entitled:
Chart Your Course

THE SCIENTISTS WHO lurk in laboratories and probe the mysteries of the human brain claim we use only a small percentage of our brainpower. Could that be why so many of us use only a fraction of the features in our software programs? Or is it just that we don't have the time-or inclination-to slog through the manual or click through the help files? In any case, it's time to stop skimming the surface and dive inside those apps to make the most of their capabilities.

This month, WINDOWS Magazine begins a new column that will help you put your applications to work. I'll show you how to start using the 80 percent of your applications' features that lie dormant in the dim recesses of your hard disk. Mail merge? No sweat. Need a macro to calculate and generate your expense report? Piece of cake. We'll cover everything from soup to nuts, and whether you're a novice or a power user, you'll find something in the coming months to make your applications cook.

We'll kick off this new column with one of the most widely used suites, Microsoft Office for Windows 95. It contains so many new features it was tough to pick one for this month's column. So, I set my personal selection filter to Cool, and out popped Data Maps. You can work with data maps in any Office application, but for this example we'll focus on Excel.

Data maps are just what their name implies-geographic maps with associated data that you provide through a database link or spreadsheet. Say you need to update your division manager on sales throughout the U.S. Instead of showing a boring range of cells with state names and sales totals, you'd like to present a U.S. map with each state shaded according to its total sales. Then you'd like to tack on a bar chart for each state that shows gross sales versus net. The hitch: You've got to have the presentation ready in an hour. A data map is the only thing that's going to pull your fat out of the fire.

Office's Data Map feature is a subset of MapInfo Corp.'s MapInfo desktop mapping software. Data Map includes a set of predefined, customizable maps for a variety of countries and regions. Although not intuitive at first, inserting and populating a data map is easy.

First, define the data you want included on the map. In this example, assume you already have an Excel spreadsheet that contains a list of states, with gross and net sales figures for each, gross sales in the first column and net in the second. Highlight the range of cells to place on the map, including the state names and sales figures. Include both the gross and net. Also include the column names if you want them used as map labels. Omit blank rows from your selection either by deleting the blank rows or holding down the Ctrl key while you select around the blank rows. If you don't, Data Map can't recognize your geographic cells and select a map for you.

After you've selected the data, choose Insert/Map. Excel replaces the pointer with a cross and prompts you to draw a frame for the map. Click and drag a frame on the spreadsheet. Excel then parses your selected data, looking for geographic data to use as a key to search for the appropriate map.

Once you make your selection, Data Map begins importing data from the selected range, displays the map and applies the first column to the map. Because you stored gross sales in the first column, Data Map shades the map based on gross sales. The Data Map Control dialog box to the right enables you to customize the map.

By default, Data Map applies value shading to the map, shading each area according to the value of its associated cell. To change the shade from its default, double-click on the Shading icon in the content box. Excel displays a Value Shading Options dialog box in which you specify the number of value ranges, range spread, color and other options.

Add a little color

If you prefer to apply a different color to each area based on its value, use category shading instead of value shading. Just drag the Category Shading icon on top of the Value Shading icon in the content box. Areas with the same value receive the same color. If you have more than 16 areas, some will receive duplicate colors because Data Map supports only 16 colors. You might need to change an area's color assignment so areas with close, but not identical, values have the same or similar color. To do this, double-click on the Category Shading icon in the content box. You'll find a color drop-down and list of categories, enabling you to specify a color for each category.

To substitute net data for gross, just drag the Net icon into the content box and drop it on the Gross icon. To remove a data column or other data object from the map, drag its object out of the content box.

Adding pie or bar charts to your map is also easy. First, drag the Pie or Bar Chart icon into the content box. Then, select and drag columns from the list of available data columns at the top of the dialog box and drop them beside the Chart icon. Drag as many columns as you want included in the chart. Data Map automatically redraws the map to include the appropriate chart type in each area. In our example, you might drag the gross sales and net sales columns to the Chart icon, creating a chart on each state that shows the relationship of gross sales to net.

When you're satisfied with the map's appearance, close the Data Map Control dialog box. Now you can edit the map the way you would any other embedded OLE object. To edit specific objects on the map, double-click on the map. Excel changes its menus and toolbar to display the Data Map menu options and toolbar. Change the name of your map by double-clicking on the label and entering the new text. Or drag it from one point to another to relocate it. You can do the same with map legends. To modify map legends, double-click on them to display their property dialog boxes, change the text or other properties, then select OK.

After you've experimented with data maps, you'll probably find yourself wanting more maps, options and data. For more information on MapInfo's add-ons, double-click on a map object to display the Data Map menu, then choose Help/Data Map Help Topics and check the Introduction topic for information on the add-ons. You can also check the MapInfo forum on Microsoft Network, or contact MapInfo directly (800-488-3552, 518-285-7110).

Contributing Editor Jim Boyce is the lead author of Special Edition: Using Windows 95 Communications (Que, 1996). Contact Jim in the "Applications" topic of WINDOWS Magazine's areas on America Online and CompuServe. To find his E-Mail ID Click Here

Top Optimizing Windows Applications Power Windows

Power Windows

Hardware Upgrades Then and Now

Upgrading your hardware requires patience,
perseverance, a little know-how and a lot of Band-Aids.

By Karen Kenworthy

Click Here to see a 79.8 KB bitmap image of artwork which goes with this article, entitled:
Out With the Old

I'M PRETTY HANDY with a screwdriver, at least around a computer case. Over the years I've built and upgraded more computers than I care to remember. Sure, I skinned a few knuckles and broke a few nails. And I learned most things the hard way-through trial and error (lots of error!). But eventually it all became routine.

Until Windows 95 came along. Cases, cards and motherboards haven't changed much over the years, but Win95 drivers and software upgrades are a brand-new adventure. For me, that means new tricks to learn and new mistakes to make.

Upgrading hardware with Windows 3.1x is tricky and time-consuming, but at least we know our way around. Win95 turns us into novices again.

For example, Win95 doesn't include a DOS-based program for changing video drivers. You usually need to install video drivers within Windows itself. Not a good solution, because Win95 needs a suitable video driver in order to run.

Fortunately, there's a simple answer. Just before you install your new video adapter, start Win95 and remove the old video driver by right-clicking on the My Computer icon and selecting Properties. You'll then see a System Properties dialog. Click once on the Device Manager tab to see your complete hardware configuration. Click once on a component's name, then click on the Remove button and the drivers for that device will disappear.

Now, shut down Windows, turn off your computer and swap video cards. Once you install and connect your new card to the monitor, turn on your computer. If you're lucky (and most people are), Win95 will detect the new video card and install new drivers for it. Win95 will probably ask for your original installation diskettes or CD-ROM. If the drivers that come with Win95 don't support your video board, you'll need diskettes with the video board vendor's drivers.

Upgrading your hard disk under Win95 is remarkably similar to upgrading it under DOS or Windows 3.1x, because Win95 relies on many of the same command-line utilities, such as FDISK and FORMAT, to prepare a hard disk for use. Win95 also uses your CMOS settings when controlling IDE and EIDE drives.

Unfortunately, moving data from one hard disk to another is trickier under Win95. As of this writing, Win95 backup and restore programs aren't as stable and reliable as one would wish. And the trick of using XCOPY to quickly copy your old hard disk's contents to the new drive has problems, too; Win95 includes two versions of XCOPY, and neither works the way it should.

The 16-bit version of XCOPY (XCOPY.EXE, in the \WINDOWS\COMMAND directory) runs only when you boot directly to a Win95 command prompt or restart your computer in MS-DOS mode. If you run XCOPY from within a Win95 DOS box, you'll be running XCOPY32.EXE, an enhanced, 32-bit version.

Neither XCOPY nor XCOPY32 copies hidden and system files correctly. XCOPY simply ignores all such files. Being a 16-bit program, XCOPY also ignores long filenames. If you specify its /H parameter, XCOPY32 is supposed to copy both hidden and system files. But thanks to a bug, it ignores files with the system attribute set. Win95 contains many system files and directories, so if you use either version of XCOPY to move a Windows installation from one hard disk to another you'll lose a lot of vital files.

Stop thinking DOS

The trick to moving data from one hard disk to another quickly is to stop thinking DOS and start thinking Win95. Instead of using XCOPY, use Win95's graphical interface and its My Computer icon. Double-click on the icon, then double-click on the icon representing the source drive. Highlight the entire source disk's contents (or choose Select All from the drive window's Edit menu), then drag the whole group to the icon representing the destination hard disk. That's it. Win95 will make a clone of the source disk, complete with long filenames, and system and hidden files.

If you're upgrading your disk or SCSI controller, use a trick similar to the one you used to upgrade a video card. First, remove the disk controller's drivers from Device Manager's list just before you shut down Win95. After you turn off your computer, swap your new disk controller for the old one. Finally, reboot your computer to a DOS command prompt (press F4 when the message Starting Windows 95 appears), install any DOS-level drivers your new controller may need and restart Win 95.

The DOS-level drivers (or BIOS, if installing a new IDE or EIDE controller) enable Win95 to read your disk the next time it starts. In most cases, you'll need the DOS-level drivers only this one time. With a little luck, Win95 will detect your new controller and install the appropriate 32-bit protected-mode drivers. As before, it will probably ask for your original Win95 diskettes or CD-ROM, or a diskette containing third-party drivers.

The first time I tried to upgrade a video adapter under Win95, I neglected to remove the old video driver before I swapped cards. Fortunately, Windows 95 was smarter than I was. The next time it started, it noticed I'd changed video hardware behind its back and automatically disabled the old video drivers. In their place, it used the vanilla VGA drivers that should work with any video card, thus allowing Win95 to run long enough to install my new drivers. When I next booted my machine, my new drivers were in place.

If you ever make the same mistake, I hope you're as lucky as I was. If you're not, Win95 may not boot, or may boot with an unreadable display. In such a case, force Win95 to start in its Safe Mode by pressing F8 when the message Starting Windows 95 appears.

When in Safe Mode, Windows uses the standard VGA video driver. It also relies on your BIOS or DOS-level drivers for your hard disk and CD-ROM drive, so be sure to load any needed drivers via your Win95 CONFIG.SYS and AUTOEXEC.BAT files. While running in Safe Mode, access Device Manager, remove any drivers you no longer need and restart Windows in normal mode.

When restarted, Win95 should detect your new hardware and install new drivers. If your luck has run out and autodetection fails, start Windows in Safe Mode again and use Control Panel's Add New Hardware applet to install your new drivers manually.

Win95 has one more nifty feature that gives you control over which drivers it loads. Hardware Profiles allows you to define two or more sets of Windows drivers and choose between them when Windows starts. This feature was designed for folks with dockable portables, desktops with removable drives and other transient hardware, and certain rare debugging procedures.

To create a new hardware profile, you must first clone your original configuration. Then customize the new configuration by adding and removing drivers. To see how this works, let's revisit the System Properties dialog (right-click on My Computer, then select Properties from its context menu). This time, click on the Hardware Profiles tab.

To create a new profile, click once on the name of an existing profile, then click on the Copy button. You'll be prompted for a profile name. The new profile will now exist, but you'll still be running under the old profile.

To customize your new profile, restart Windows. You'll soon see a message that reads "Windows cannot determine what configuration your computer is in. Select one of the following: " followed by a menu of your available Hardware Profiles. Choose the profile you wish to change, and Windows will boot with that driver set. Once Win95 loads, use Device Manager and Control Panel's Add New Hardware applet to remove or add any drivers.

If you're still using Windows 3.1x, one upgrade that shouldn't give you much trouble is a hard disk because Windows 3.1x relies heavily on 16-bit disk drivers and DOS when reading and writing a disk. In most cases, getting a hard disk to work under Windows 3.1x means getting it to run under DOS. After that, operation under Windows is automatic.

Adding a new hard disk that will live alongside the original is the easiest upgrade. Just perform the appropriate physical installation steps (change CMOS settings, set jumpers, attach cables and so on) according to the provided documentation. Once the disk is ready for partitioning, use FDISK to create one or more partitions, then FORMAT to create a file system within each partition.

Drive letters are the only flies in the ointment. If you aren't careful, one of the new disk's drive letters will be D: , and any letters on the old disk (other than C: ) will shift up by one letter. This can wreak havoc with configuration files, Program Manager icons that launch programs and more, because the paths of all files previously on drives D: and above will change. Fortunately, this problem is easy to avoid. Just create an Extended partition, not a Primary partition, when you run FDISK to partition the new disk. That causes all the new letters assigned to follow the letters that are assigned to the original.

If you're replacing the original disk with the new one, perform a full backup before you change your hardware. This way you can copy your data to the new disk by installing DOS and Windows (if your backup/restore software is Windows-based), then restoring the backup you just made.

Although this method works, it's a bit time-consuming, depending on your backup medium. In some cases, it's faster to employ my favorite hard disk upgrade trick: Install both disks simultaneously, even if you eventually intend to remove the old one. This allows you to use DOS's XCOPY. Once the copy finishes, remove the old disk, re-jumper the new one (if necessary) and you're ready to go (once you use FDISK to mark the new drive Active). When you use this trick, copy the DOS system files to the new hard disk using DOS's SYS command. Then execute XCOPY with the /S parameter, which causes it to copy the contents of all subdirectories. Here are the two DOS commands I use:

XCOPY C: \ D: \ /S

I have no commands to repair skinned knuckles. You'll just have to keep a box of Band-Aids within easy reach.

Contributing Editor Karen Kenworthy is the author of Visual Basic for Applications, Revealed! (Prima Publishing, 1994) and the manager of WINDOWS Magazine's forums on America Online and CompuServe. Contact Karen in the "Power Windows" topic of these areas. To find her E-Mail ID Click Here

Back to April 1996 Pullout
Up to Table of Contents
Ahead to April 1996 How-To Columns