by Ross Mack - GUI Computing
"Ok, son, watch closely. The hand is quicker than the eye. I'm movin' this window and I'm movin' this window and this window. Keep your eyes on 'em cause they move real fast. Now, son, all you go to do to win your $5 back is tell me which one the desktop is under."
The Windows 95 shell has been with us for a little while now. And mostly we've got quite used to it. It's even the shell on Windows NT these days. The thing about the Windows 95 shell is that it is more configurable than any previous version of Windows. There are whole reams of options that can be changed about the way the shell works and there are dozens of ways to extend it. These range from the sublime to the ridiculous. For a look at some of the simple extensions you can make to your desktop have a look at the PowerToys and KernelToys packs available for free download from Microsoft. One of my personal favourites is a systray icon called "Tiny Explorer" from Wright Futures.
However, you don't need to start writing system level code in C or Delphi to start to extend your desktop to make it work more the way you want to. Windows95 puts the power to customise just enough features in the hands of the average user to make a developer's life much easier. As I have been using Windows95 I have come a cross a few things that definitely make my life easier when doing day to day development. Here are a few of them:
Compact and Repair.
Access MDB files are always associated with Access, so that when you double click on them Access will open up with the database you clicked on open. However, this can be a real pain if all you want to do is Compact or Repair that database. Because then you have to close the database, select Compact or Repair from the file menu and go searching for the database again.
The easy way around this is to go into Explorer and choose View|options from the menu, then go to the File Types tab of the options dialog box. Find the "Microsoft Access Database" entry (or "MDB File" for Access 2.0) and then click Edit to change the particulars of the File type. The next Dialog box shows you (amongst other things) a list of actions associated with the File Type (Access Databases in this instance). By default there should only be one action, "open" which launches Access passing it the name of the file.
What we want to do is add two new actions, so click the "New…" button to add the first one. The dialog then displayed asks you for a Name for the action and the Application used to perform it. In the first text box (labelled action) type "Compact" and in the second type in the path to your Access executable (MSACCESS.EXE) or use the browse button to find it. Once you have the path and filename of Access in the second text box add "/Compact" after it. Follow the same procedure to add the Repair action entering "Repair" for the name and add the "/Repair" command line parameter in stead of "/Compact". The dialog should look something like this:
Then all you need to do is save all your changes and exit. Now, when you right click on an MDB file you have the option to not only open it but to Compact it or Repair it as well. How handy is that ? Remember you should always Repair and Compact your Access databases before distribution to minimise size and this makes it easy.
There are also some other Access command line parameter you can add here if you want to have the option to make Access open your MDB exclusively (/Excl) or Read Only (/Ro) or using the settings from a specific INI file (/Ini <inifile path and filename>).
See the Microsoft Access documentation for more details on these command line parameters.
In fact if you write some of your own utilities for dealing with MDB files (either in VB or in Access) there is no reason why you can't add these to the list of available actions as well.
When you are working with VB4 or VB5 and lots of OCXs (ActixeXs) and building your own components or OLE (ActiveX) servers I find I tend to be registering and unregistering things all the time. This usually requires opening up a DOS prompt and running REGSVR32.EXE or a similar utility and passing it the path and filename of the ActiveX OCX or DLL that you want to register. All in all that results in a lot of typing and remembering paths and such and although I am usually in favour of that sometimes it just gets too boring. So, here is what you do.
Following the same steps as above open up the File Types Dialog box from Explorer and then add a new type. Here we can define a new File type called ActiveX that will help simplify some of this stuff. First of all enter "Active X" in the Description text box, then we add some actions for dealing with these beasties. Click the "New…" action button and when the action definition dialog box opens up (just like the one shown in Compact and Repair above) enter "Self Recister" as the Action name and then the path and filename of REGSVR32.EXE or an equivalent utility in the second dialog box.
You now have a Self Register command available from your right click (context) menu. To add Unregister support simply follow the same steps but add a "/U" to the REGSVR32 command line. You can now Rsgister and Unregister OCX's simply by right clicking on them. The dialog box that results should look something like the one below.
Now that we have done that for OCXs doing the same thing for ActiveX DLLs actually requires some registry hacking as the DLL extension is not available to be configured through this File Types dialog. Essentially you need to add the same registry information we just created under the ocxfile class under the dllfile class.
To see what I mean open up your registry editor and go to HKEY_CLASSES_ROOT/ocxfile/Shell. This subkey is all the information we just added via the Explorer interface and to add the same functionality for DLL files we need to add an identical subtree under HKEY_CLASSES_ROOT/dllfile.
First of all go to the HKEY_CLASSES_ROOT/dllfile subkey and add a subkey called "Shell" at the same level as the DefaultIcon subkey. Then we need to add a subkey to that called "Self_Register". That subkey's default property should be set to "Self Register". We then add a subkey under that called "command" and set it's default property to "C:\WIN\SYSTEM\REGSVR32.EXE %1" or whatever the location of your copy of REGSVR32 is, just don't forget the %1 as it specifies where the name of the DLL file goes when the command is executed.
Follow the same steps for unregister adding the "/U" command line parameter .
REG files of both subkeys are available for download if you don't want to get into the registry yourself. As with any registry stuff, use at your own risk, OK?
One of the very cool features of the Windows95 shell is the Send To command on your context menus. The best thing about this is that it is easily extensible.
All you need to do is go to the Send To directory under your Windows directory and add a shortcut. Next time you use the send to menu that shortcut will appear as a d"destination". You can use this for all sorts of stuff.
The first thing I always add to my Send To menu is a text editor. By default Notepad, but I prefer to use TextPad when available. To do this go to your send to folder and right click to bring up your context menu, then select New|Shortcut. In the Wizard that opens up enter "notepad.exe" (or the path and filename of your preferred text editor) as the command line and then click next. Then enter "Notepad" (or whatever) as the description.
Presto, you can now send all sorts of files straight to a text editor for a peek at what's inside. I find this great for HTML files, hacking VB FRM files, LOG files, SQL scripts and all manner of other lunacy.
The other method you can use to create a shortcut in the SendTo folder is to drag an item to it using the right mouse button. When you drop it a menu will appear asking you if you want to Copy, Move, Create a shortcut or Cancel. Select Create a Shortcut and there you have another item on your Send To menu. You can even do this with other folders. In fact one of the items I like to have in my Send To menu is a shortcut to my System folder so that I can easily send any OCXs, DLLs or similar objects to their rightful place. This is particularly handy when you are working in a team and other team members are producing DLLs or OCXs for your use. You can simply grab the new builds when they become available and right click on them to simply send them right to your system directory.
I also like to keep a shortcut to my Zip drive (I don't seem to use floppy disks much anymore…) and a graphics viewer in my Send To menu. Once you start adding to your Send To menu you will start to get your own ideas about what will be useful.
So, explore the Windows95 shell and have a think about gearing it up to make the way you work easier and more convenient. Some of this stuff is really simple but remarkably helpful. But, above all, remember to have fun.