# Macintosh C Programming Primer 1992 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-985d50d88cde7ca4711a8fe9a94a766fd10bed36f6a74be7164c656d299f8494)

Macintosh C Programming PRIMER

Transcribed text:

Dave Mark Cartwright Reed

Macintosh C Programming

PRIMER

Volume I
Second Edition

Inside the Toolbox Using THINK C™

Image description: A book cover with a blue top band holding author names, a red background, large black title text, and the word PRIMER set in rotated multicolored tiles above the volume and edition lines.

Reading notes: Volume numeral reads as 'I' in the printed copy; 'Second Edition' is not a date or year, so it is listed only as printed edition text in printedDates.

Printed product names: Macintosh C Programming PRIMER

Printed dates: Second Edition

Languages: English

[Original Image 1](https://www.vintageapple.net/files/193cb23589fc60ecb25082d6afbf17fd7380a1906c805a43bc3f8a92e3fdc521/ce27a0861239a04d838e7d73.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-3ad48b729667c979ca10e0c11fe4e7df554594a7cb051041eee814df5eab96eb)

Macintosh C Programming PRIMER

Transcribed text:

Dave Mark Cartwright Reed

Macintosh C Programming

PRIMER

Volume I
Second Edition

Inside the Toolbox Using THINK C™

Image description: A red book cover with a blue band at the top holding the author names, large black title text, and the word PRIMER spelled in colorful tilted squares (orange, blue, pink, purple, teal, yellow), with volume and edition text and a subtitle at the bottom.

Reading notes: Printed date field lists 'Second Edition' rather than a numeric year; no numeric date is visible.

Printed product names: Macintosh C Programming PRIMER

Printed dates: Second Edition

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-841ee940a1581086a7654ade2deabaa36db4a2fca4bb51018b013527771d4bd9)

Macintosh C Programming Primer

Transcribed text:

Macintosh C
Programming
Primer
Inside the Toolbox
Using THINK   CTM
Volume I, Second Edition
Dave Mark   Cartwright Reed
...
•• Addison-Wesley Publishing Company
Reading, Massachusetts   Menlo Park, California   New   York
Don Mills, Ontario   Wokingham, England   Amsterdam
Bonn   Sydney   Singapore   Tokyo   Madrid   San   Juan
Paris   Seoul   Milan   Mexico City   Taipei

Reading notes: Headline taken from the first lines of the supplied copy and may not match the printed layout. No image was inspected, so visual layout and reading order are unverified. The supplied copy lists no advertised products, prices, or dates; 'Second Edition' and 'Volume I' are edition labels, not printed dates. The publisher's city list and the '...' line are extracted fragments that may be incomplete.

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-05969a3c7b713d37fff56b7faeb0e718d9a4e5c70c0e8fd0c06c98b6eb53ec5a)

Macintosh C Programming Primer

Transcribed text:

The authors and publisher have taken care in preparation of   this book, but make no
expressed or implied warranty of any kind and assume no responsibility for errors or
omissions. No liability is assumed for incidental or consequential damages in connection
with or arising out of the use of the information or programs contained herein.
Many of the designations used by manufacturers and sellers to distinguish their
products are claimed as trademarks. Where those designations appear in this book and
Addison-Wesley was aware of a trademark claim, the designations have been printed in
initial capital letters.
Library of Congress Cataloging-in-Publication Data
Mark, Dave.
Macintosh C programming primer   I   Dave Mark, Cartwright Reed. -
2nd ed.
p.   cm.
Includes bibliographical references and index.
Contents: v. 1. Inside the toolbox using THINK C.
ISBN   0-201-60838-3   (v. 1)
1.   Macintosh (Computer)-Programming.   2. C (Computer program
language)   I.   Reed, Cartwright. II. Title.
QA76.8.M3M368   1992
005.265-dc20
Copyright   ©   1992 by Dave Mark and Cartwright Reed
92-4299
CIP
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the
publisher.   Printed   in the   United   States of America. Published simultaneously in
Canada.
Cover Concept: Doliber/Skeffington
Set   in   10/12   Palatino by   ST   Associates, Wakefield, MA
123456789-MW-9695949392
First printing, May 1992

Reading notes: Catalog data line 'QA76.8.M3M368 1992' and 'dc20' may be OCR-garbled Headline taken from title-page text 'Macintosh C programming primer' inferred from cataloging record

Printed product names: Macintosh · THINK C · Palatino

Printed dates: 1992 · May 1992

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-1abeb35328191c7529e71cad866e017507bd84be608cf4b70ec39937a6b6ad06)

Image description: The image is an entirely blank white page with no visible artwork, layout, or text.

[Original PDF page 4](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-db4320a34827ea39ab2c16677855d743f2a1b872c9658ecd2c53fe7938479b50)

Transcribed text:

Contents
Source   Code   Disk for the Mac Primer   ix
Preface   xi
Acknowledgments   xiii
1   Introduction   1
The Macintosh Way   3
About the Book   8
Writing Macintosh Applications   11
How to   Use   This Book   19
What You Need to Get Started   20
Ready,Set...   21
2   Setting   Up   23
Installing THINK   C   5   25
Accessing the Toolbox with   C
The Hello, World Program
In Review   48
29
40
3   Drawing on the Macintosh   49
Introduction   51
Window Management   56
Drawing in Your Window: The QuickDraw Toolbox Routines   62
The QuickDraw Programs   69
Hello2   69
v

Reading notes: Source text is a table of contents with page numbers; no advertised products, prices, or dates are present.

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-6f872a426e3836b1727dabd073779bfaeebc2ef94a79f37497800fdf5eca0cc3)

Transcribed text:

vi   Macintosh   C   Programming Primer
Walking Through the Hello2 Code   79
Variants   83
Mondrian   88
Walking Through the Mondrian Code   92
Variants   98
Show PICT   103
Walking Through the   Show PICT Code   109
Variants   113
Screen   Saver:   The FlyingLine Program   113
Walking Through the FlyingLine Code   119
In Review   126
4   Events   127
Understanding Events   129
The Event Manager   129
A New   Structure   for Macintosh Programming (Part 1)   133
A New   Structure   for Macintosh Programming (Part 2)   139
EventTracker   143
Walking Through the EventTracker Code   154
Handling mouseDown Events in EventTracker   165
Building the EventTracker Application   167
Updater:   The Return   ofShowPICT   168
Walking Through the   Updater   Code   177
Handling mouseDown Events in   Updater   184
EventTrigger:   Sending   Apple Events   190
The Event Trigger Algorithm   192
Walking Through the EventTrigger Code   196
In   Review   199
5   Menu Management   201
Menu Components   203
The Hierarchical Menu   206
The Pop-up Menu   206
Adding Menus to Your Programs   208
WorldClock   209
Walking Through the WorldClock Code   235
In Review   258
6   Working with Dialogs   259
How Dialogs Work   262
Dialog Items: Controls   263
Other   Dialog Items   266
Modal Dialogs   267
Modeless Dialogs   267

Reading notes: Source is a table of contents; no headline, products, prices, or dates are printed. Heading 'Macintosh C Programming Primer' is a book title, not an advertisement headline.

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-81fee080ec843d8b59c8f5f539f9ac3e0187ffdea95196eb652eab4ea2ba5ea6)

Transcribed text:

Contents
Adding Dialogs to Your Programs   268
Working with Alerts   275
The Notification Manager   278
Using   the Notification Manager   279
The Process Manager   281
Reminder   284
Resources   285
Running Reminder   328
Walking Through the Reminder Code
In Review   361
7   Toolbox Potpourri   363
Writing   Out   Resources   365
ResWriter   365
Walking Through the ResWriter Code
Scroll   Bars! We're Gonna Do   Scroll   Bars!
Pager   382
Walking Through the Pager Code   393
The   Scrap   Manager   404
Walking Through the ShowClip Code
The   Sound   Manager   416
SoundMaker   416
Walking Through the SoundMaker Code
Working with Macintosh Files   424
The Standard File Package   425
The File Manager   427
Walking Through the   OpenPICT   Code
The Printing Manager   443
PrintPICT   444
Walking Through the PrintPICT Code
In Review   456
8   Finishing Touches   457
335
373
379
411
420
436
450
Building a Standalone Application   459
More Finder Resources   471
The Help and Edition Managers   478
Responding to the Required Apple Events   480
In Review   489
9   The Final Chapter   491
Macintosh Periodicals   493
The Essential   Inside Macintosh   493
Apple Technical References   496
Apple's Developer Programs   497
vii

Reading notes: Contents listing has page numbers displaced from their entries, so chapter-to-page pairing is uncertain.

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-47df548565d5f456459c5d8edec55d7a89a059c36f3e2ace5f0f7dc0582d90c2)

Transcribed text:

viii   Macintosh   C   Programming Primer
Macintosh Developer Technical   Support   and Applelink   498
Software   Development Tools   499
Source   Code Bounty   501
To Boldly Go   502
Appendix A   Glossary   503
Appendix B   Code Listings   521
Appendix C   THINK C Command   Summary   603
Appendix D The Debugger Command   Summary   615
Appendix E   Debugging Techniques   623
Appendix F   Building HyperCard XCMDs   629
Appendix G Bibliography   639
Appendix H   New Inside Macintosh   Series   643
Index   647

Reading notes: Table of contents format makes page numbers and section boundaries ambiguous

Printed product names: THINK C · HyperCard · Applelink · Macintosh

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-eb9f3c66d6be09f79241f9d25158f288d85cc5123281fb5a2640be2410b59666)

Transcribed text:

Source   Code Disk
for the
Mac C   Primer
IF   YOU   WOULD   like the source code presented in the   Macintosh   C
Programming Primer   on disk, please send in the coupon on the last
page (or a copy of the coupon; we're not picky).   If   you like, you can
order the disk by calling (215)   387-6002.
We hope you like the   Macintosh   C   Programming Primer.   If   you
have any comments or suggestions drop us a line on CompuServe.
When you log on to CompuServe, type   GOMACDEV,   then stop by the
Learn Programming area   (Section   11) and say hello.
ix

Printed product names: Macintosh C Programming Primer

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-8c72fc70573cc83fdc7dfb136b4d7a7bff30f1a72bc8cc69ad7e73931104e97d)

Transcribed text:

Preface
ARE   YOU   INTERESTED in creating your very own Macintosh applications?
Is the next great Macintosh software miracle tucked away in your
brain?   If   so, you've come to the right place.
With this new edition of the   Macintosh   C   Programming   Primer   in
hand and a copy of THINK C on your hard drive, you've got everything
you need to enter the wonderful world of Macintosh programming. The
Mac Primer   uses step-by-step approach that shows you how to add
each element of the Macintosh user interface to your programs. You'll
start by learning how Macintosh windows are created. Next, you'll
learn how to draw text and graphics inside your windows. As you
progress through the book, you'll learn about events, menus, dialog
boxes, and much, much more.
The   Mac Primer   is chock-full of reusable sample code. Each program
is discussed in detail. Nothing is left as an exercise for the reader.
There's no better way to learn the art of Macintosh programming.
For readers of the first edition, this edition of the   Mac Primer   pre-
sents a boatload of brand-new material. All the source code has been
rewritten and specifically designed with System 7 in mind. You'll
learn how to create System 7-savvy programs using the latest versions
of THINK C and ResEdit. You'll also get the inside scoop on the new
additions to the   Inside Macintosh   family.
Get yourself a copy of THINK C, grab your   Mac Primer,   and we'll
meet you inside.
Dave Mark
Arlington,   VA
Cartwright Reed
Philadelphia,   PA
xi

Printed product names: THINK C · ResEdit · Inside Macintosh · Macintosh C Programming Primer · Mac Primer

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/1#scan-3818da77bc592e35096242d7862481ef52fc12756d799276150854a14758975e)

Transcribed text:

Acknowledgments
WE'D LIKE   TO   express our appreciation to the people who helped make
this book possible, or at least coexisted with us harmoniously during
its development.
First and foremost, we'd like to thank our wives, Deneen Melander
and Kate Joyce, who know us and still smile.
A special thanks to Elizabeth Rogalin and Julie   Stillman   for
loyalty, late nights, and much-needed moral support. Thanks also to
Kathy Traynor, Diane Freed, and the rest of Addison-Wesley's finest!
Thanks also to Jackie Cowlishaw, copyeditor extraordinaire.
A special note of thanks to Andy Richter of Intelligence At Large.
Andy was a critical factor in making the code both clean and exciting.
Thanks, Andy!
Thanks to Jim Reekes, Richard Clark, and   Phil   Shapiro   for much-
needed technical support. These guys kept us from going down for the
compatibility count.
Finally, thanks to Apple and   Symantec,   whose products are the
finest in the land.
xiii

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/e3ca0f41f01dbd8559072ed474c4962882270eaa3c6ab3dc2c92a229b85c14f2/Macintosh_C_Programming_Primer_1992.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-macintosh-c-programming-primer-1992-49606b/2.md)
