TEACH YOURSELF WINDOWS PROGRAMMING IN 21 DAYS

The SOURCE CODE to a SAMS BOOK by Charlie Calvert

On-Line Address:
CIS: 76711,533
If that fails, try: 71601,1224

Mailing Address:
Charlie Calvert
POB 66115
Scotts Valley, CA 95067

NEW MATERIAL

	Two example programs have been added to the code since
the first edition. One is called FONTEASY. It gives a minimal
example of how to create a screenfont. The second is called 
PRNTFONT, and it shows how to print from windows, and in
particular, how to print using a specific font. In addition,
a whole new set of code under the controls directory has been
added to further elucidate the material in chapters 10-13. Please
see the Windows WRITE files CONTROLS.WRI and PRINTAPP.WRI for 
explanations of the new code.


WELCOME

	The source code included in these files represent an
introduction to Windows API programming using C/C++. Each of the 
programs included in this package is meant to illustrate important 
Windows programming concepts. Taken as a whole, they serve as a 
thorough introduction to the entire topic. These files are not 
meant to stand on their own, but are meant to be worked through 
while reading Teach Yourself Windows Programming in 21 Days.
	
	For best results, create a subdirectory called W21CODE
on your C drive, or anywhere on your harddrive that has room
for at least a meg worth of source code. For instance, if you
want to create this subdirectory on the C drive, then you could
type:

	md C:\W21CODE

	After creating the subdirectory, copy the files from the
disk to that subdirectory using the File Manager or the DOS XCOPY 
command. For instance, if you have placed the diskette in the A 
drive and have created a W21code subdirectory on the C drive, 
then type:

	XCOPY A:\*.* C:\W21CODE /s/e

If you want to copy from the B directory to a subdirctory called
W21CODE on the D drive, then type:

	XCOPY B:\*.* D:\W21CODE /s/e

	When you are done, the W21CODE directory will contain 
the source files for Learn Windows Programming in 21 Days by 
Charles Calvert. They will compile cleanly with either Borland 
C++ 3.1 and 4.0 or Microsoft Visual C++ Version 1.0. To compile 
these files, switch to the subdirectory containing a program you 
want to run and type GO if you are a Borland user, or DO if you 
are a Microsoft user.

	Each subdirectory in this zip file contains two batch
files, one called GO.BAT and the other called DO.BAT. All of 
the programs can be compiled by running these batch files. 
Both of these batch files do nothing more than run a makefile 
appropriate to either Borland's or Microsoft's compiler.

	The makefiles have the name of the project plus the 
MAK extension (Borland), or else they have the name of the 
project, plus an "M", plus the MAK extension (Microsoft). 
For instance:

    WINDOW1.MAK   // Borland makefile
    WINDOW1M.MAK  // Microsoft makefile

	The Microsoft makefiles should compile exactly as is,
but in the Borland makefiles you may need to change the path 
to the INCLUDE and LIB files. For instance, I always assume
that the Borland include files are in C:\BC\INCLUDE. If you
keep them somewhere else, then you will have to modify that
portion of the Borland makefile. For instance, if your copy
of Borland C++ is installed on the D drive in the BORLANDC
subdirectory, then change this portion of the makefile

    INCPATH = C:\BC\INCLUDE
    LIBPATH = C:\BC\LIB

so that it looks like this:

    INCPATH = D:\BORLANDC\INCLUDE
    LIBPATH = D:\BORLANDC\LIB

	To simplify this task, I have included a program called
CHALL.EXE which was designed to iterate through all the subdirectories
beneath ..\W21CODE and change each of the Borland MAKEFILES. CHALL
takes two parameters, the first being the string you want to 
change, and the second being the new string you want to create.
For instance, entering 

    CHALL C:\BC D:\BORLANDC 

will automatically make the changes shown above in the discussion of
how to edit you makefiles.

	All of the included programs except HARMONY can also
be compiled immediately from inside the Microsoft or Borland
IDEs. The makefiles for the Microsoft development environment
all end in the letters MSVC. The Borland project files, of course,
all have the PRJ extension:

    WIN1MSVC.MAK  // Microsoft Visual Environment project file
    WINDOW1.PRJ	  // Borland IDE project file

	Because HARMONY depends on two DLLs, it is best to build it
at the DOS prompt via the included makefiles. They will automatically
compile the entire project, including the DLLs.

	Some subdirectories may include a file called README.TXT.
This file contains either important notes about the project, or
else comments regarding any last minute changes to the source.

	For a listing of the included programs, see the file called
PROGRAMS.TXT or PROGRAMS.WRI.

	The WinMain from all of the files in the book have had 
a small change made to them in order to avoid a compiler warning 
under Borland C 4.0. Specifically, the lines:

  if (!(MainWindow = Create(hInst, nCmdShow)))
    return FALSE;  

have been changed to:

  MainWindow = Create(hInst, nCmdShow);
  if (!MainWindow)
    return FALSE;  

Though one line longer in length, the changed code is probably
easier to read than the code in the book.

