Chapter 6

Taking Control of Windows

Visual Basic brings Windows programming to the masses by hiding and redefining the details. Most Visual Basic programmers are content to accept this new, simplified model because forms, controls, and events are easier to program than windows, dialog boxes, and messages. Why put up with the hassle of programming bare-bones Windows?

Well, some of us are just masochists. And even if you don’t need to prove anything, Visual Basic provides plenty of good reasons to learn Windows inside and out. It seems that every Visual Basic program ever written needs just one feature that the designers of the language didn’t anticipate. Furthermore, none of those missing features overlap. The Visual Basic bug database is crammed with great ideas, feature requests, and design improvements marked “Postponed.” Many of those ideas are mine.

But I’m not waiting for my favorite features to appear in some future version of Visual Basic. I want them now, even if I have to cheat. Unfortunately, the solutions to my problems probably aren’t the solutions to your problems. Chances are this chapter won’t tell you directly how to implement that one little feature that’s been driving you batty for the past few weeks. But perhaps I can help you figure it out on your own by telling you everything you never really wanted to know about processes, modules, instances, classes, messages, resources, and, of course, windows.