September 3, 2003
By Karen Kenworthy
IN THIS ISSUE
Wow! This is some rainstorm. The secluded Power Tools workshop has been deluged for three days. As many as 10 inches of rain have fallen, with more on the way. Except for the stray raindrops meandering down my window panes, the view through them seldom changes. Leaden skies, arm-weary trees, and the occasional harried squirrel or sodden bunny rabbit, are all I can see from here.
I'm just glad I don't have to be out in this weather. This is a good time to be a computer programmer, or a duck. :)
Speaking of windows, remember our get-together last week? We talked a lot about windows. No, not the plate glass variety. We talked about those rectangular parcels of on-screen computer real estate.
We discovered those windows do a lot more than display text and pretty pictures. Surprisingly, windows also allow one program to communicate with another. This may seem odd a first. But each time a human presses a key, moves a mouse, or clicks a mouse button, some window needs to know.
Our computer's operating system (not surprisingly called "Windows") detects our actions. It then determines which on-screen window is currently processing our input. Finally, it sends special messages, telling that window what we've been up to.
In fact, most programs while away the day, receiving messages and responding to them. Programmers call the instructions that carry out this repetitive task a "message loop". As long as new messages are waiting to be processed, the program's continues to loop. If the message "queue" (its list of unprocessed messages) ever runs dry, the program goes to sleep, waiting for more messages to arrive.
Windows (the operating system) isn't the only program that can send messages to windows (the windows). As we saw last week, any program can send a message to another program's window. That's how I implemented the new "wake up" feature in my 'Net Monitor program, fooling the 'Net Monitor into thinking a user pressed the <F24> key.
In fact, programs use windows to communicate with each another so often, they frequently create special windows just for this purpose. These windows are "hidden", never visible on our computer screens. But they exist nonetheless. [And, as we'll see in a moment, they aren't as well hidden as they used to be.]
I See Hidden Windows!
All this talk about windows got me to thinking about one of our Power Tools -- the Window Watcher. Long-time readers will remember this little program. It displays a list, showing every window currently lurking somewhere in our computer's memory. Hidden, or visible, it finds them all, and displays some interesting facts about each.
The Window Watcher's window dossier is pretty complete. It can show you the text in each window's title bar. Often, it's able to display the name of the program that created the window. It even reports whether the window is visible or hidden, its size, and often, its purpose.
Yes, Windows Watcher can teach us a lot about our computers, revealing what programs are running, and giving us clues to their secret lives. But there was one trick the older versions program didn't know -- it couldn't show us where, on our screen, each window lived.
It took a bit of detective work, and a few failed experiments (why does success always wait until our last experiment?). But I finally found a way to show the actual location of any window!
Now, when you select a window from the Window Watcher's list, it shows you several window facts, as before. But click the program's new "Locate" button, and it also draws a gray rectangle around the window, revealing its exact location on the computer screen.
If the window is visible, this makes it easy to associate the window with information the Window Watcher displays. If a window is hidden, this feature is even handier. You can now see exactly where the hidden window is lurking, and even tell its size.
Give this feature a try. You'll quickly discover that a lot of windows you thought were gone are still in your computer's memory. That's because many programs hide frequently-displayed windows when they aren't currently in view.
This trick avoids the tedious recreation of each window, just before an appearance. And that saves time, making our computers more responsive, letting windows snap into view. This technique also consumes memory. But then, programs and programmers have always traded memory for speed. In fact, that's what memory is for -- speeding up our computers.
Windows within Windows
Run the new Window Watcher, and you'll make another surprising discovery. Some windows contain other windows!
This makes sense when you realize that most each on-screen buttons, text boxes, scrollbars, and other windows gadgets are actually small, special- purpose windows. Larger, complex, windows, like the one displaying this message, often contain several of these "child" windows.
The Windows Watcher lets you easily see these parent-child relationships. The names of child windows are displayed immediately below the names of their parent. Children's names are also slightly indented, in the Window Watcher's list.
Child windows can have children of their own, too. And the Window Watcher shows these relationships too. In fact, the new version lets you explore entire multi-generational families of windows, from the first parent, to the last great-great-great-great grandchild. :)
If you'd like to learn more about your windows, download a free copy of the Window Watcher from its home page at:
And if you'd like to see how the program performs these new tricks, download the program's free Visual Basic source code too.
Better yet, get the latest version of every Power Tool, including the new Window Watcher, on a shiny CD. The disc also contains three bonus Power Tools not available anywhere else. You'll find the source code of every Power Tool, every back issue of my newsletter, and even some of my original Windows Magazine articles! The CD also comes with a special license that lets you use your Power Tools at work.
Buying a CD is also the easiest way to support the KarenWare.com web site, and this newsletter. To find out more, visit:
Yipes! What's that? A fiery orange ball is peeking over the horizon! Run for your lives!
No, wait a minute. I think that's the sun. Yes, it's turning more yellow as it rises higher in the sky. And it's emitting warmth and light. Whew! Guess the rain is finally over. Time to head outdoors ...
Until we meet again, if you see me soaking up rays, or on the 'net, be sure to wave and say "Hi!"