Easier Windows programming. (Column) (Evaluation)
by Clifton Karnes
It's true that Windows C programming is more difficult than DOS C programming, but it's not that much more difficult, and nothing makes this point more strongly than Microsoft's QuickC for Windows.
You still have to learn the Windows API and message-based way of doing business, but with QuickC for Windows, intermediate to advanced DOSprogrammers can write real Windows apps.
QC/Win offers an almost ideal environment for program development. The editor is fully MDI compatible, which means that you can handle multiple files easily. There's also a toolbar that quickly becomes indispensable. It sports buttons for compiling, building, adding breakpoints, calling the watch window, tracing, and stepping.
The editing environment is the most customizable I've ever seen. It even puts some Windows-based word processors to shame. For starters, you can choose your default font. Included is the fixed system font, which is ideal for programming. Next you have a choice of colors for the background and foreground text. If you want a deep blue background with a white foreground, for example, it's easy to set up.
Perhaps the best feature of this color control, however, is that QC/Win lets you specify colors for just about everything. You can put C keywords in one color, comments in another, errors in another, and so on. This may not sound exciting at first, but careful use of this feature will make your programs much easier to create and edit.
Microsoft is famous for its online help, and the help with QC/Win is excellent. The entire Windows API is documented, and it's easier to use than a manual. The explanations of the functions are very good, but I'd like to see more examples.
QC/Win comes with several additional modules to aid program development. Included is a dialog editor, which allows you to draw a dialog box Visual Basic style; a bitmap editor, for creating and altering icons and other bitmaps; and QuickCASE:W, an excellent interface design tool and code generator.
Now, to create a program. Getting back to the Windows-programming-is-difficult issue, you've probably heard that even a "Hello, world" program takes hundreds of lines of code. Well, that's true, because creating a window involves a lot of overhead. But there are many useful programs that don't require that you create a window.
My first QC/Win program was one of these. It's a utility that I used every day for months. You probably know that most Windows applications start with a window size that seems chosen at random. Since I like to run most of my applications maximized, I wrote a simple program that does just that. The code is just the following single line.
The command line syntax for this program is RUNMAX programname [parameters]. It simply accepts the name of the program you want to run along with any parameters, executes the program with WinExec, and specifies SW[unkeyable]SHOWMAXIMIZED, which says to run the program maximized.
It's fast and useful, and it uses little more than one line of code. In addition to the main file, QC/Win requires that each program include a definition file and a make file. The definition file contains housekeeping info for Windows. For this program both are short.
To create a make file with QC/Win, you simply use a browser to select the files your program uses. RUNMAX uses just two files: RUNMAX.C and RUNMAX.DEF.
After using this program for a while, I decided I wanted it to do more. Specifically, I wanted to be able to specify whether the program woudl run minimized, maximized, hidden or optimized (an optimized window fills the screen except for a band at the bottom to display your icons). This program, WinRunner, took a little more work, but I completed it in a couple of hours. If you subscribe to PC Disk, you'll find it on next issue's installment.
The point is this: If you know some C and you're familiar with Windows as a user, you have the background to get started with QC/Win. You won't be creating a killer database right away, but you can write neat, useful applications almost right off the bat.