|
|
1.1 ! root 1: ======================================================================== ! 2: MICROSOFT FOUNDATION CLASS LIBRARY : HELLO EXAMPLE PROGRAM ! 3: ======================================================================== ! 4: ! 5: This application is a simple Windows program to demonstrate the basics ! 6: of using the Microsoft Foundation classes. The Microsoft Foundation ! 7: Class Library Tutorial describes this application in detail, but here's ! 8: a summary of what you will find in each of the files that make up Hello. ! 9: ! 10: MAKEFILE. ! 11: HELLO.MAK ! 12: HELLO.STS ! 13: These two files make it easy to compile the application. The ! 14: MAKEFILE describes the build process for the NMAKE tool, and the ! 15: other files, HELLO.MAK and HELLO.STS, make it easy to use the ! 16: Programmer's Workbench to build HELLO. ! 17: ! 18: To use the MAKEFILE, just go to the DOS prompt, and type ! 19: nmake ! 20: to build the program. You can choose to include ! 21: debugging support by using the option: ! 22: nmake DEBUG=1 ! 23: (Make sure you use uppercase letters for this option.) ! 24: The DEBUG=0 option specifies that no support is compiled into the ! 25: code. If you do not specify a DEBUG option, the default is ! 26: DEBUG=0. ! 27: ! 28: ! 29: HELLO.H ! 30: HELLO.CPP ! 31: These two files make up the entire behavior of the application. ! 32: In the HELLO.H header file, two C++ classes are declared: CTheApp ! 33: and CMainWindow. These classes override and extend the behavior ! 34: of their base Foundation classes, CWinApp and CFrameWnd, ! 35: respectively. The source file HELLO.CPP contains the member functions ! 36: and message maps declared in the header file. ! 37: ! 38: CWinApp, a Foundation class, does all of the typical stuff that ! 39: most Microsoft Windows applications must: it initializes itself, ! 40: then it creates and runs a message loop until the application ends. ! 41: The Hello program extends this behavior by overriding the ! 42: InitInstance member function in our own class, CTheApp. This ! 43: member function is automatically called during startup of the ! 44: application. In InitInstance, we create and show our main window. ! 45: ! 46: CMainWindow is a pretty simple window class, and it follows the ! 47: typical behavior found in frame windows. It is based on CFrameWnd, ! 48: a Foundation class. Our frame window uses a message map to ! 49: associate member functions with Microsoft Windows messages. These ! 50: functions respond to the standard paint message, and a menu choice ! 51: command message. ! 52: ! 53: Since the Foundation provides all of the normal code for the ! 54: WinMain function and other initialization (in the CWinApp class), ! 55: it is only necessary to create an object of our CTheApp class to ! 56: start the program and let it run. This is found in the one global ! 57: variable in HELLO.CPP, called theApp. ! 58: ! 59: HELLO.ICO ! 60: This is an icon file, which is used by the Hello frame window. ! 61: ! 62: HELLO.DLG ! 63: This is a dialog definition file, which defines the ! 64: characteristics and layout of the modal dialog AboutBox, ! 65: which is displayed by the Hello application. This dialog file ! 66: was generated using the Windows 3.1 SDK DLGEDIT tool. ! 67: ! 68: ! 69: RESOURCE.H ! 70: This is a header file that contains Windows menu item IDs. ! 71: It was generated using the Windows 3.1 SDK DLGEDIT tool. ! 72: ! 73: HELLO.RC ! 74: This is a listing of all of the Microsoft Windows resources which ! 75: the program uses. It includes three resources: the icon found in ! 76: HELLO.ICO, a menu, and the dialog defined in HELLO.DLG. ! 77: ! 78: HELLO.DEF ! 79: This file contains parameters the linker needs to correctly ! 80: link a Microsoft Windows application, including: the name and ! 81: description of the application, and the size and type of the runtime ! 82: heap and runtime stack. The numbers in this file are typical for ! 83: small applications made with the Microsoft Foundation Class Library.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.