The Learning Curve

Yes, as you've undoubtedly determined from this chapter, Windows programming is certainly different from programming for a conventional environment like MS-DOS. Nobody will claim that Windows programming is easy.

When I first started learning Windows programming, I decided to do what I had always done when learning a new operating system or a new language—to write a simple ”hex dump“ program to display the contents of a file. In the conventional MS-DOS environment, such a program involves command-line processing, rudimentary file I/O, and screen output formatting. However, my Windows hex-dump program turned into a monster. It required that I learn about menus, dialog boxes, scroll bars, and the like. As a first Windows program, it was definitely a mistake, demanding that I absorb too much all at once.

Yet when this program was finished, it was quite unlike any hex-dump program I had written. Rather than obtain the filename from a command line, WINDUMP (as I called it) presented a list box showing all the files in the current directory. Rather than write its output to the screen in a simple teletype fashion, WINDUMP had scroll bars so I could move to any part of the file. As an extra bonus, I could even run two copies of WINDUMP to compare two files side by side. In short, WINDUMP was the first hex-dump program I wrote that I was actually proud of.

What you have to ask yourself is this: Do I want my programs to use a more modern and productive user interface, one that includes menus, dialog boxes, scroll bars, and graphics? If you answer yes, then the question becomes: Do I want to write all this menu, dialog box, scroll bar, and graphics code myself? Or would I rather take advantage of all the code already inside Windows for this? In other words, is it easier to learn how to use 550 function calls or to write them yourself? Is it easier to orient your programming mind to the message-driven architecture of Windows or struggle with using several different sources of user input in a traditional model?

If you're going to write your own user interface logic, you had better close this book and get to work right away. Meanwhile, the rest of us are going to learn how to display and scroll text in a window.