Back to 9/96 How To: Power Windows
Up to Table of Contents
Ahead to 9/96 Cover Story: The New NT

9/96 How To: Programming Windows

Don't Mention the I-Word

Martin eschews the Internet and becomes a control freak again.

By Martin Heller

OVER THE PAST few months I've written about programming Web servers, Windows and the Internet, ActiveX and Java. I think it's time to take a break from talking about Internet programming, so, although it won't be easy, I promise not to mention the I-word for the rest of this column.

First, I have to try to remember what I was interested in before all the Inter-uh, Web hype started taking over our minds and TV sets. Something about databases? Graphics? Programming? Languages? Components? It seems so long ago.

I remember telling you about components, specifically that COM objects, OCXes, and OLE and ActiveX controls-or whatever they'll call them next-are the wave of the future. I have a stack of control packages, VB add-ons and DLLs in my office, and I'd like to introduce you to a few of them.

Before I do, I'd like to remind you that ActiveX controls, unlike VBX controls, were not exclusively designed for Visual Basic. You can use them equally well from any development environment that supports OLE Control Container applications. These include Visual Basic, every major C++ compiler imaginable, Delphi 2.0, Clarion 2.0, PowerBuilder 5.0, Optima++, Access, Visual FoxPro, and there's more being added to the list every day.

Veteran VB vendor Sheridan Software Systems (516-753-0985) makes a Widgets line of OLE controls in addition to its Assist line of VB add-ons. VBAssist 4.0 ($179) is still the Veg-O-Matic of VB add-ons, with more wizards, assistants and templates than I could adequately describe here. ClassAssist 4.0 ($249), another add-on, builds VB 4.0's classes into a full-blown class library facility.

Data Widgets 2.0 ($139) provides a set of data-bound controls: a grid, combo box, option-set control and drop-down control for use in a data-grid cell. A data-command control creates command buttons that perform database functions, and an enhanced data control adds functionality like bookmark storage and navigation to the stock VB data control. This product isn't the necessity for VB programmers it once was, because VB 4.0 includes most of the needed data-bound controls.

Designer Widgets 2.0 ($139) includes dockable toolbar, form customization, notebook and index-tab controls. Calendar Widgets 1.0 ($139) offers a month, day (appointment) and year view, as well as a date combo, which amounts to a drop-down month-view calendar. All the Widgets products come with a 16-bit VBX, and both 16-bit and 32-bit OLE controls.

Another veteran VB vendor, Desaware (408-377-4770), has logged in with an updated version of SpyWorks Professional ($249). This program's claim to fame is that it gives VB programmers access to Windows messages, hooks, callbacks and APIs. Although the technology is now available in OCX form, it won't interest C or C++ programmers unless they suddenly find themselves working on a VB project.

For a full-blown geographic information system, check out SylvanMaps/OCX ($495) from Sylvan Ascent (800-362-8971). Packaged as an OLE control, SylvanMaps comes on a CD-ROM filled with zipped map databases, and relies on both ODBC and OLE. Its maps are supplied as Access databases, but you can store them in any database with an ODBC driver. Filling in property pages is a large part of constructing a GIS application with SylvanMaps. The control has its own toolbar as a default user interface, and you can easily tie the control to a custom user interface because all the necessary methods and events are exposed.

To close the circle, the Sax Basic Engine 2.0 ($495, professional version) from Sax Software Corp. (800-645-3729) is a 16- and 32-bit OLE control (a 16-bit VBX is also included) that allows you to add an extensible VBA-compatible macro language to your application. It supports OLE automation and object browsing, so you can use it to talk to and control your application and other applications, including the whole Microsoft Office suite.

Not a control freak?

If you've settled on a single development environment, you don't always need to have your components delivered in the form of OLE controls. For instance, the Presentation Graphics SDK (prices vary), from Three D Graphics (310-553-3313), comes in the form of libraries and DLLs. For everyday production C programming, you just can't beat the efficiency of calling a function.

To be sure, you can get the Pinnacle-BPS Graph Control, which is an OLE control, free with Visual Basic. Why would you pay $695 (plus license fees for commercial applications) for a graphics library? You may want to ask Corel why it uses the Presentation Graphics SDK as Corel Draw's chart component, or see why Aldus uses it as Persuasion's chart component. They'll probably cite its performance, features and customization. Three D Graphics will sell you precisely the features you need. Imagine that-a vendor that gives you exactly what you need.

Garbage collection for C and C++

As you may remember, in last month's column I explained that one of the advantages Java has over C++ is garbage collection-that is, automatic reclamation of dynamically allocated memory. In Java, you have no need to explicitly free an object. When an object goes out of scope or no longer has any active references, it becomes fair prey for the garbage-collection background thread.

Memory leaks are a constant problem in C and C++ programs. Diagnostic programs like BoundsChecker help you find the problems, but even so, C programmers often spend weeks chasing memory allocation bugs late in the development cycle.

The latest memory management library to cross my desk is Great Circle ($345 to $495) from Geodesic Systems (312-728-7196). Great Circle offers two basic interfaces to its garbage-collecting memory manager-a transparent mode and a set of smart pointer classes. In transparent mode you link your program with Great Circle's versions of malloc() and new(). Great Circle will then automatically reclaim objects that have gone out of scope or no longer have any active references. You can still free memory manually, but you don't need to.

Great Circle is limited in that it doesn't work in multithreaded programs, and it doesn't support dynamically linked MFC libraries.

Learn the Ropes

Click Here to see a 43.0 KB bitmap image of artwork which goes with this article, entitled:
A Little Goes A Long Way

As most of you know, I once wrote Windows programming books and have since taught Windows programming courses. Writing those books (Advanced Windows Programming and Advanced Win32 Programming, both published by John Wiley & Sons) was a lot of work, and their shelf life was disappointing. Although neither book was obsolete the day it was published, both were obsolete in some respect within six months of publication.

Updating the books would have been a Sisyphean task, which I avoided in favor of writing this column. I like bringing you the latest information each month. But I regret never having converted the books from ones that teach SDK-level Windows programming to books that teach MFC programming.

Fortunately, others have taken up the lance. David Holzgang's Teach Yourself...Visual C++ (MIS Press, $29.95) covers VC++ Version 4.0. Holzgang assumes you already know C++, or at least C, and walks you step-by-step through the development of a relatively simple MFC application, starting from installation of VC++. Holzgang's book is aimed at beginners, but anyone who is ready to program in MFC is probably not a beginner. Holzgang doesn't cover the more advanced parts of MFC that tend to grow every three months.

Mike Blaszczak's The Revolutionary Guide to MFC 4 Programming with Visual C++ (Wrox Press, $49.95 includes CD-ROM) does cover MFC's advanced parts. Whereas Holzgang's book is one to work through sequentially, Blaszczak's is meant for leisurely browsing and dipping into as needed. It is current for VC++ Version 4.1 and will be updated on CD-ROM as close as possible to Microsoft's release of new VC++ versions. Blaszczak's inside position as an MFC developer makes delivering such updates a real possibility-although I wonder when he sleeps.

Enter The Twilight Zone

Speaking of garbage, I recently had an interesting experience with some financial software. File this under "Don't let it happen to you!"

I've resisted using financial and accounting software, both in my business and at home, based on bitter experience. I run a lot of beta software and systems, so my computers are sometimes subject to sudden setbacks, usually on the order of losing the partitions on a hard disk. I keep my records on paper, and I have an accountant who's willing to plow through my check registers and scraps in shoeboxes.

However, when my brokerage house offered me free online banking, how could I possibly refuse? I installed Quicken 5.0 on my most stable machine, a portable running standard Windows 95. I quickly established communications with the brokerage house and happily downloaded my checking information.

This is the part where The Twilight Zone music pipes in. I took the machine home. Quicken suddenly insisted something on my machine was broken and refused to run. I took the machine back to the office and reconnected it to the network, with no joy. I contacted Intuit technical support on America Online and went 'round in circles with them for weeks. I uninstalled Quicken. I reinstalled Quicken. I deleted specific files. I started Quicken with special switches. I updated DLLs. Nothing helped.

I finally gave up, took Quicken off the machine completely and went back to my paper check registers. If I can't make this stuff work, what do ordinary users do? What does it take to make consumer programs robust in the field? If you have answers, I'd like to hear them.

Contact Senior Contributing Editor Martin Heller at his Web page at, via e-mail at

Back to 9/96 How To: Power Windows
Up to Table of Contents
Ahead to 9/96 Cover Story: The New NT