Professional Palm OS® Programming Professional Palm OS® Programming Lonnon R. Foster and Glenn Bachmann Professional Palm OS® Programming Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN-13: 978-0-7645-7373-6 ISBN-10: 0-7645-7373-X Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/QU/QU/QV/IN 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, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA01923, (978) 750-8400, fax (978) 750-4744. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317)572-3447, fax (317) 572-4355, E-Mail: [email protected]. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REP- RESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACYOR COMPLETENESS OF THE CON- TENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION, WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CRE- ATED OR EXTENDED BY SALES OR PROMOTIONALMATERIALS. THE ADVICE AND STRATEGIES CON- TAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALLBE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS ACITATION AND/OR APOTENTIALSOURCE OF FUR- THER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFOR- MATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAYHAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services or to obtain technical support, please contact ourCus- tomer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Cataloging-in-Publication Data Foster, Lonnon R., 1972- Professional Palm OS programming / Lonnon R. Foster & Glenn Bachmann. p. cm. Includes index. ISBN 0-7645-7373-X (pbk.) 1. Palm OS. 2. Pocket computers. I. Bachmann, Glenn. II. Title. QA76.76.O63F597185 2005 004.16—dc22 2005000594 Trademarks:Wiley, the Wiley Publishing logo and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. Palm OS is a trademark or registered trademark of PalmSource, Inc. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor men- tioned in this book. About the Authors Lonnon R. Fosteris a programmer and writer who has spent the past nine years creating desktop appli- cations, database front ends, Web sites, communications software, technical documentation, and hand- held applications. He has been developing Palm OS applications almost as long as the platform has existed, starting with his first Pilot 5000 and progressing to more complicated wireless software for Symbol’s 1700 series. Lonnon fills his sparse free time with tactical tabletop gaming, recreational Perl coding, and reading everything he can get his hands on. Glenn Bachmannis a noted author of several books and articles on Palm OS programming and mobile computing. Glenn is also president and founder of Bachmann Software, a leading provider of wireless file management, networking, backup, and printing software products for Palm OS, Pocket PC, and Symbian handheld computing platforms. Founded in 1994, Bachmann Software (www.bachmannsoft- ware.com) has established itself as a leading contributor to the mobile and wireless economy through its utility software products and partnerships with many of the key companies in the mobile computing arena. Bachmann’s PrintBoy, FilePoint, Mobile Backup, and Mobile Utilities are among the best-selling software utilities for handhelds and smartphones. First and foremost I thank my acquisitions editor, Chris Webb, for remembering me from our previous collaborations and providing me with the opportunity to participate in writing this book. I also thank my development editor, Eileen Bien Calabro, who bore the difficult task of keeping the book on track with just the right amount of poking and prodding to the author. I also thank Lonnon Foster for creating the phenomenally successful Palm OS Programming Bible, the second edition of which is the predecessor and foundation of this book. Through Lonnon’s clear and concise writing style and attention to detail, he has helped programmers around the world become Palm OS programmers. There are so many people in the Palm OS developer community—at PalmSource, palmOne, and other software companies—who continue to be the heroes of our little mobile computing industry. These fine folks are responsible for the fantastic handhelds, smartphones, operating systems, and software applica- tions that make it such a delight to participate in and contribute to the success of the Palm Economy. My hat goes off to you all. Thanks are also due to the team at Bachmann Software, truly the finest and most dedicated people I have ever worked with. Finally, I thank my wife for supporting me in my never-ending adventures in growing a software com- pany. I also thank my three wonderful children, who seem to have grown up under the impression that it is entirely normal for their father to possess 58 different handhelds. Credits Executive Editor Graphics and Production Specialists Chris Webb April Farling Carrie A. Foster Development Editor Lauren Goddard Eileen Bien Calabro Denny Hager Joyce Haughey Technical Reviewer Jennifer Heleine JB Parrett Lynsey Osborn Julie Trippetti Copy Editors Stefan Gruenwedel Quality Control Technicians Nancy Rapoport Laura Albert Amanda Briggs Vice President & Executive Group Publisher John Greenough Richard Swadley LeeannHarney Carl William Pierce Vice President and Publisher Brian H. Walls Joseph B. Wikert Proofreading and Indexing Project Coordinator TECHBOOKS Production Services Erin Smith In loving memory of Robert B. Hyslop (1909–2002)