Windows 3: A Developer's Guide Source Code Diskettes ============================================================================== The three diskettes included with this book contain the source code for all of the sample applications presented. Each directory name identifies the name of the sample application. The extension of each directory indicates the chapter in the book that described the program. Below is a list of the directories contained on the diskettes: Dsk SubDirectory Chp Description --- ------------ --- ---------------------------------------------------- 1 VOYEUR.01 1 Voyeur application. Demonstrates window attribute information. 1 PMREST.02 2 Program Manager Restore application. Demonstrates window subclassing. 1 NOALPHA.02 2 NoAlpha Edit Control application. Demonstrates window superclassing. 1 DLGTECH.03 3 Dialog Box Techniques application. Demonstrates how to change the tab order of child controls, add controls to a dialog box after it has been created, expand a dialog box, how to use a ModalLess dialog box, how to create modal and modeless dialog box templates at run-time. 2 METER.04 4 Meter custom child control DLL. Demonstrates how to create a custom child control and use it with the Windows SDK Dialog Editor. This control is used by the CUSTCNTL.EXE program (Chapter 4) and the SETUP.EXE application (Chapter 8). 2 SPIN.04 4 Spin custom child control DLL. Demonstrates how to create a custom child control and use it with the Windows SDK Dialog Editor. This control is used by the CUSTCNTL.EXE program (Chapter 4) 2 CUSTCNTL.04 4 Custom child control application. Demonstrates the usage of the METER and SPIN controls also presented in this chapter. 2 PRINT.05 5 Printer setup application. Demonstrates how to display a printer's settings dialog box and how to print from your application using the user's selected settings. 2 SCRNBLNK.06 6 Screen blanking Utility. Demonstrates how to use window hooks to by sensing when the user has been idle for a given period of time and blanking the computer's screen. 2 ECHO.06 6 User input recording and playback facility. Demonstrates how to create an application similar to the RECORDER.EXE program supplied with the runtime version of Windows. This program also shows how to trap the 'F1' key in a dialog box so that the Windows Help Engine may be invoked. 3 MDI.07 7 MDI techniques application. Demonstrates how to close maximized MDI Child windows, ignore mouse messages when activating an MDI Child window, implement a status bar and a ribbon, display menu option help in the status bar, create your own custom MDI Child window tiling algorithm, close an MDI application by filtering WM_QUERYENDSESSION and WM_ENDSESSION messages to the MDI Child windows. 3 SETUP.08 8 Commercial application installation program. Demonstrates how to install your own application on the user's hard drive. Application also demonstrates how to initiate a dynamic data exchange conversation with the Windows Program Manager application. This program is used to install all of the source code for this book on your hard drive. In addition, the METER custom child control from Chapter 4 is used to notify the user of the installation's progress. File Information List: * * * * * * * Diskette #1 (Setup, Chapters 1 through 3) * * * * * * * * * * * Path Name Description ------------------------- --------------------------------------------------- \SETUP.EXE Program to install source code. \SETUP.INF Information file used by SETUP.EXE. \METER.DLL Dynamic-link library used by SETUP.EXE. \README.TXT This text file. \MAKEALL.BAT Makes all of the sample applications. \MAKEDD.BAT Creates the three distribution diskettes. \COPYDIR.BAT Called by the MAKEDD.BAT file. \NOWINDWS.H Header file included by all source modules. \VOYEUR.01\MAKEFILE Makefile for Voyeur application. \VOYEUR.01\VOYEUR.C Application source module. \VOYEUR.01\VOYEUR.DEF Voyeur app definitions file. \VOYEUR.01\VOYEUR.DLG Dialog box templates. \VOYEUR.01\VOYEUR.EXE Voyeur application. \VOYEUR.01\VOYEUR.H Application header file. \VOYEUR.01\VOYEUR.ICO Application icon. \VOYEUR.01\VOYEUR.RC Application resource file. \VOYEUR.01\DIALOG.H Dialog box template defines. \VOYEUR.01\EYES.CUR Voyeur eyes cursor for window peering. \PMREST.02\MAKEFILE Makefile for Program Manager Restore application. \PMREST.02\PMREST.C Application source module. \PMREST.02\PMREST.DEF PMRest app definitions file. \PMREST.02\PMREST.DLG Dialog box templates. \PMREST.02\PMREST.EXE PMRest application. \PMREST.02\PMREST.H Application header module. \PMREST.02\PMREST.ICO Application icon. \PMREST.02\PMREST.RC Application resource file. \PMREST.02\DIALOG.H Dialog box template defines. \NOALPHA.03\MAKEFILE Makefile for NoAlpha application. \NOALPHA.03\NOALPHA.C Application source module. \NOALPHA.03\NOALPHA.DEF NoAlpha app definitions file. \NOALPHA.03\NOALPHA.DLG Dialog box templates. \NOALPHA.03\NOALPHA.EXE NoAlpha application. \NOALPHA.03\NOALPHA.H Application header module. \NOALPHA.03\NOALPHA.ICO Application icon. \NOALPHA.03\NOALPHA.RC Application resource file. \NOALPHA.03\DIALOG.H Dialog box template defines. \NOALPHA.03\SUPERCLS.C Window superclassing source module. \NOALPHA.03\SUPERCLS.H Window superclassing header module. \DLGTECH.03\MAKEFILE Makefile for Dialog Techniques application. \DLGTECH.03\DLGTECH.C Application source module. \DLGTECH.03\DLGTECH.DEF DlgTech app definitions file. \DLGTECH.03\DLGTECH.DLG Dialog box templates. \DLGTECH.03\DLGTECH.EXE DlgTech application. \DLGTECH.03\DLGTECH.H Application header module. \DLGTECH.03\DLGTECH.ICO Application icon. \DLGTECH.03\DLGTECH.RC Application resource file. \DLGTECH.03\DIALOG.H Dialog box template defines. \DLGTECH.03\DLG-DYNA.C Dynamic dialog box source module. \DLGTECH.03\DLG-DYNA.H Dynamic dialog box header module. \DLGTECH.03\DLG-MDLS.C ModalLess dialog box source module. \DLGTECH.03\DLG-MDLS.H ModalLess dialog box header module. \DLGTECH.03\DLG-OPTS.C Options dialog box source module. \DLGTECH.03\DLG-OPTS.H Options dialog box header module. * * * * * * * * * Diskette #2 (Chapters 4 through 6) * * * * * * * * * * * * * Path Name Description ------------------------- --------------------------------------------------- \METER.04\MAKEFILE Makefile for METER custom control DLL. \METER.04\METER.C DLL source module. \METER.04\METER.DEF Meter DLL definitions file. \METER.04\METER.DLG Dialog box templates. \METER.04\METER.DLL Meter custom child control DLL. \METER.04\METER.H DLL header module. \METER.04\METER.RC DLL resource file. \METER.04\DIALOG.H Dialog box template defines. \METER.04\METERDLG.C Meter & Dialog Editor source module. \METER.04\CNTL-DE.C Custom Control & Dialog Editor source module. \METER.04\CNTL-DE.H Custom Control & Dialog Editor header module. \SPIN.04\MAKEFILE Makefile for SPIN custom control DLL. \SPIN.04\SPIN.C DLL source module. \SPIN.04\SPIN.DEF Spin DLL definitions file. \SPIN.04\SPIN.DLG Dialog box templates. \SPIN.04\SPIN.DLL Spin custom child control DLL. \SPIN.04\SPIN.H DLL header module. \SPIN.04\SPIN.RC DLL resource file. \SPIN.04\SPINDLG.C Spin & Dialog Editor source module. \SPIN.04\CNTL-DE.C Custom Control & Dialog Editor source module. \SPIN.04\CNTL-DE.H Custom Control & Dialog Editor header module. \SPIN.04\DIALOG.H Dialog box template defines. \CUSTCNTL.04\MAKEFILE Makefile for custom control demo application. \CUSTCNTL.04\CUSTCNTL.C Application source module. \CUSTCNTL.04\CUSTCNTL.DEF Custom Control app definitions file. \CUSTCNTL.04\CUSTCNTL.DLG Dialog box templates. \CUSTCNTL.04\CUSTCNTL.EXE CustCntl application. \CUSTCNTL.04\CUSTCNTL.H Application header module. \CUSTCNTL.04\CUSTCNTL.ICO Application icon. \CUSTCNTL.04\CUSTCNTL.RC Application resource file. \CUSTCNTL.04\DIALOG.H Dialog box template defines. \CUSTCNTL.04\METER.DLL Meter custom child control DLL. \CUSTCNTL.04\SPIN.DLL Spin custom child control DLL. \PRINT.05\MAKEFILE Makefile for Printer Setup application. \PRINT.05\PRINT.C Application source module. \PRINT.05\PRINT.DEF Print definitions file. \PRINT.05\PRINT.DLG Dialog box templates. \PRINT.05\PRINT.EXE Print application. \PRINT.05\PRINT.H Application header module. \PRINT.05\PRINT.ICO Application icon. \PRINT.05\PRINT.RC Application resource file. \PRINT.05\DIALOG.H Dialog box template defines. \PRINT.05\PRINTSTP.C Printer Setup dialog box source module. \PRINT.05\PRINTSTP.H Printer Setup dialog box header module. \SCRNBLNK.06\MAKEFILE Makefile for Screen blanking application. \SCRNBLNK.06\SCRNBLNK.C Application source module. \SCRNBLNK.06\SCRNBLNK.DEF ScrnBlnk app definitions file. \SCRNBLNK.06\SCRNBLNK.DLG Dialog box templates. \SCRNBLNK.06\SCRNBLNK.EXE ScrnBlnk application. \SCRNBLNK.06\SCRNBLNK.H Application header module. \SCRNBLNK.06\SCRNBLNK.ICO Application icon. \SCRNBLNK.06\SCRNBLNK.RC Application resource file. \SCRNBLNK.06\DIALOG.H Dialog box template defines. \SCRNBLNK.06\SB-DLL.C DLL source module. \SCRNBLNK.06\SB-DLL.DEF SB-DLL DLL definitions file. \SCRNBLNK.06\SB-DLL.DLG Dialog box templates. \SCRNBLNK.06\SB-DLL.DLL SB-DLL DLL. \SCRNBLNK.06\SB-DLL.H DLL header module. \SCRNBLNK.06\SB-DLL.LIB Library file for SB-DLL.DLL. \SCRNBLNK.06\SB-DLL.MKF Makefile for Screen blanking DLL. \SCRNBLNK.06\SB-DLL.RC DLL resource file. \ECHO.06\MAKEFILE Makefile for Echo application. \ECHO.06\ECHO.C Application source module. \ECHO.06\ECHO.DEF Echo app definitions file. \ECHO.06\ECHO.DLG Dialog box templates. \ECHO.06\ECHO.EXE Echo application. \ECHO.06\ECHO.H Application header module. \ECHO.06\ECHO.ICO Application icon. \ECHO.06\ECHO.RC Application resource file. \ECHO.06\DIALOG.H Dialog box template defines. \ECHO.06\RECORDER.C DLL source module. \ECHO.06\RECORDER.DEF Recorder DLL definitions file. \ECHO.06\RECORDER.DLL RECORDER DLL. \ECHO.06\RECORDER.H DLL header module. \ECHO.06\RECORDER.LIB Library file for RECORDER.DLL. \ECHO.06\RECORDER.MKF Makefile for RECORDER DLL. * * * * * * * * * Diskette #3 (Chapters 7 through 8) * * * * * * * * * * * * * Path Name Description ------------------------- --------------------------------------------------- \MDI.07\MAKEFILE Makefile for MDI application. \MDI.07\MDI.C Application source module. \MDI.07\MDI.DEF MDI app definitions file. \MDI.07\MDI.DLG Dialog box templates. \MDI.07\MDI.EXE MDI application. \MDI.07\MDI.H Application header module. \MDI.07\MDI.ICO Application icon. \MDI.07\MDI.RC Application resource file. \MDI.07\FRAME.C Frame window source module. \MDI.07\DIALOG.H Dialog box template defines. \MDI.07\CHART.C Chart MDI child window source module. \MDI.07\CHART.ICO Chart MDI Child icon. \MDI.07\SHEET.C Sheet MDI child window source module. \MDI.07\SHEET.ICO Sheet MDI Child icon. \SETUP.08\MAKEFILE Makefile for Setup application. \SETUP.08\SETUP.C Application source module. \SETUP.08\SETUP.DEF Setup app definitions file. \SETUP.08\SETUP.DLG Dialog box templates. \SETUP.08\SETUP.EXE Setup application. \SETUP.08\SETUP.H Application header module. \SETUP.08\SETUP.ICO Application icon. \SETUP.08\SETUP.INF Setup information file. \SETUP.08\SETUP.RC Application resource file. \SETUP.08\SETUPDLG.C Dialog box source module. \SETUP.08\SETUPINF.C SETUP.INF file handling source module. \SETUP.08\SETUPINF.H SETUP.INF file handling header module. \SETUP.08\SETUPPM.C Program Manager DDE conversation source module. \SETUP.08\DIALOG.H Dialog box template defines. \SETUP.08\DISK.ICO Switch disk dialog box icon. The source files are in standard ASCII format, and have been compiled and tested using version 6.0(a) of the Microsoft C Compiler and the tools supplied with Version 3.0 of the Windows SDK. Source code notes: 1) All of the variable names are prefixed by one of the standard prefixes explained on page xxii of the Microsoft Window Programmer's Reference Volume 1. However, I use the 'b' prefix to represent bytes instead of BOOLean values and the 'f' prefix to represent BOOLean values instead of bit flag values. This is the same notation recommended for OS/2 Presentation Manager programming. 2) All global variables are prefixed with a single underscore character. This helps to make understanding a function easier because any variable not preceded by an underscore is either a parameter to the function or an 'auto' or 'static' local variable. 3) When a function is declared, a space appears immediately before the opening parenthesis. For example: int FunctionName (int nX, int nY) { } ^ space character However, when calls to this function are made, the space is not used. For example: nZ = FunctionName(nX, nY); ^ no space character The reason for doing this is so that you can locate a function declaration in a source module very easily. By requesting that your program editor search for: "FunctionName " (notice the trailing space), the editor will find the function itself instead of calls to this function.