6.14 File Listings

The code shown in listings 1-3 is available in your distribution disks as PHBOOK.DEF, PHBOOK.RC, and RESOURCE.H.

Listing 1

; phbook.def: Defines the module parameters for the application.

;

; This is part of the Microsoft Foundation Classes C++ Library.

; Copyright (C) 1991 Microsoft Corporation

; All rights reserved.

;

; This source code is only intended as a supplement to the

; Microsoft Foundation Class Reference and Microsoft

; QuickHelp documentation provided with the library.

; See these sources for detailed information regarding the

; Microsoft Foundation Classes product.

NAME PhBook

DESCRIPTION 'Phone Book Database'

EXETYPE WINDOWS

STUB 'WINSTUB.EXE'

CODE PRELOAD FIXED DISCARDABLE

DATA PRELOAD FIXED MULTIPLE

HEAPSIZE 8096

STACKSIZE 8096

Listing 2

/* PhBook.rc : Defines the resources for the application.

//

// This is a part of the Microsoft Foundation Classes C++ Library.

// Copyright (C) 1991 Microsoft Corporation

// All rights reserved.

//

// This source code is only intended as a supplement to the

// Microsoft Foundation Classes Reference and Microsoft

// QuickHelp documentation provided with the library.

// See these sources for detailed information regarding the

// Microsoft Foundation Classes product.

*/

#include <windows.h>

#include "resource.h"

#include <afxres.h>

AFX_IDI_STD_FRAME ICON phbook.ico

MainMenu MENU

{

POPUP "&File"

{

MENUITEM "&New", IDC_NEW

MENUITEM "&Open...", IDC_OPEN

MENUITEM "&Save", IDC_SAVE, GRAYED

MENUITEM "Save &As...", IDC_SAVEAS, GRAYED

MENUITEM "&Close", IDC_CLOSE, GRAYED

MENUITEM "&Print...", IDC_PRINT, GRAYED

MENUITEM "E&xit", IDC_EXIT

}

POPUP "&Person"

{

MENUITEM "&Add...", IDC_ADD, GRAYED

MENUITEM "&Delete", IDC_DELETE, GRAYED

MENUITEM "&Find...", IDC_FIND, GRAYED

MENUITEM "F&ind All", IDC_FINDALL, GRAYED

MENUITEM "&Edit...", IDC_EDIT, GRAYED

}

POPUP "&Help"

{

MENUITEM "&Using Phone Book\tF1", IDC_HELP

MENUITEM "&About Phone Book...", IDC_ABOUT

}

}

MainAccelTable ACCELERATORS

{

VK_F1, IDC_HELP, VIRTKEY

VK_DELETE, IDC_DELETE, VIRTKEY

VK_RETURN, IDC_EDIT, VIRTKEY

VK_UP, VK_UP, VIRTKEY

VK_DOWN, VK_DOWN, VIRTKEY

}

rcinclude phbook.dlg

Listing 3

; resource.h: Defines the resource constants for the application.

#define IDM_NEW 101

#define IDM_OPEN 102

#define IDM_SAVE 103

#define IDM_SAVEAS 104

#define IDM_CLOSE 105

#define IDM_PRINT 106

#define IDM_EXIT 107

#define IDM_ADD 108

#define IDM_DELETE 109

#define IDM_FIND 110

#define IDM_FINDALL 111

#define IDM_EDIT 112

#define IDM_HELP 113

#define IDM_ABOUT 100

#define IDC_DATA 115

#define IDC_STATICLASTNAME 300

#define IDC_LASTNAME 250

#define IDC_STATICFIRSTTNAME 301

#define IDC_FIRSTNAME 251

#define IDC_STATICPHONE 302

#define IDC_PHONE 252

#define IDC_STATICMOD 303

#define IDC_MOD 253