Visual C++
Windows Shell Programming
Dino Esposito
Wrox Press Ltd.
Visual C++ Windows Shell Programming
© 1998 Wrox Press
All rights reserved. No part of this book may be reproduced, stored in a retrieval system or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embodied in critical articles or reviews.
The author and publisher have made every effort in the preparation of this book to ensure the
accuracy of the information. However, the information contained in this book is sold without
warranty, either express or implied. Neither the authors, Wrox Press nor its dealers or
distributors will be held liable for any damages caused or alleged to be caused either directly
or indirectly by this book.
Published by Wrox Press Ltd. 30 Lincoln Road, Olton, Birmingham, B27 6PA
Printed in USA
ISBN 1-861001-8-43
Trademark Acknowledgements
Wrox has endeavored to provide trademark information about all the companies and products
mentioned in this book by the appropriate use of capitals. However, Wrox cannot guarantee
the accuracy of this information.
Credits
Author Cover
Dino Esposito Andrew Guillaume
Concept by Third Wave
Development Editor
John Franklin Design/Layout
Noel Donnelly
Editors
Jon Hill Index
Chris Hindley Andrew Criddle
Technical Reviewers
Davide Marcato
Tommy Riddle
Kenn Scribner
Marc Simkin
Mark Stiver
Julian Templeman
Keep it simple: as simple as possible, but no simpler.
Albert Einstein
Photo of the ammonite courtesy of Claren Kidd at the
Laurence S Youngblood Energy Library, University of Oklahoma.
http://www-lib.ou.edu/depts/geol/lammonite.html
About the Author
Dino Esposito is a senior consultant who specializes in Windows and COM development. At
present, his work for Andersen Consulting focuses on the development of Web-based
applications. He's a frequent speaker at industry conferences such as Microsoft Developer Days
and occasionally holds seminars for Mondadori Informatica Education.
He also has extensive experience developing commercial Windows-based software, especially
for the photography world, and was part of the team who designed and realized one of the first
European image databanks.
Dino loves writing, and is a contributing editor to Microsoft Internet Developer for which he runs
the Cutting Edge column. He contributes to a number of magazines including Microsoft Systems
Journal, MSDN News, Windows Developer's Journal, Dr. Dobb's Journal and a number of Italian
magazines. He co-authored Professional IE4 Programming and authored Instant DHTML Scriptlets,
both published by Wrox Press.
Dino lives in Rome (Italy) with his wife Silvia and a six-month-old son, Francesco. Feel free to
contact him at desposito@infomedia.it.
Acknowlegements
Even though I appear smiling and relaxed on the cover, believe me, doing this book was no
picnic. It's been a pleasure, though. I've really enjoyed presenting my development experience
and telling you about all the pitfalls I've found along the way. My hope is that, with this book,
your coding will progress more quickly.
I said it wasn't easy, and didn't just mean for myself. Silvia, my wife, was incredibly patient
with me and many nights, at the end of a chapter, I found her solicitously awake. This book
considerably increased her capacity to sleep in spite of the typical but annoying noise of a
programmer: the unremitting clicking, plop and plonk, dialing and so on. There's nothing to
do, I really love you – and it's rhymed too!
No, Francesco, don't cry! Daddy loves you too. Francesco is now six months old and shows a
great interest for everything with buttons, from keyboards to remote controls and from
telephones to cameras. He's a very lively and precocious baby. Although his name doesn't
appear among the technical reviewers, he really gave a considerable contribution to the last
two chapters. (Jon, now you know the real reason why you got them so late…)
Jon Hill was the lead technical editor of this book and, let me say, did an excellent job testing
and re-testing the source code, providing countless pieces of good advice and, above all,
addressing the weak points in the original text. You'll never know about them, but believe me,
the book is now far more readable, rich and enjoyable. Thank you, Jon!
And thanks also to all the guys that reviewed the various chapters. In particular, I'd like to
mention Kenn Scribner who led me to discover and consider a number of neglected topics.
Thank you, Kenn; I appreciated your ideas very much.
Other people contributed to this book with their suggestions and technical tips. I want to say
thanks to Marco Losavio, Graziano Lorusso, Giuseppe Dimauro, Francesco Balena, Carlo
Pescio and Antonio Derossi.
Writing a book related to Windows necessarily involves pinging people at Microsoft, searching
for help, tips, references and so forth. Among others, I'd like to mention Scott Roberts, Andrew
Clinick and Michael Edwards who clarified a number of obscure points and helped me to find
up-to-date information. Scott was incredibly kind and patient and even answered my questions
over some weekends. I'm really grateful. I'll write it in Italian too: Te ne sono veramente molto
grato.
Other people at Microsoft provided assistance, directly or indirectly. In no particular order:
Josh Trupin and Joe Flanigen, for their appreciation and continued encouragement, and with
them all the staff at MIND and MSJ. Paula Ladenburg, for giving me the opportunity to appear
on MSDN and astound friends and colleagues with public full-text search engines. Joanne
Steinhart, for providing me with the colorful MIND mousepad that many times has captured
Francesco's attention and allowed me to work a bit more quietly.
Writing a book is just one aspect of my daily activity. Thus, I want to reserve a special mention
for the people at Andersen Consulting. In particular, I want to thank Bruno Ronchetti and
Giorgio Di Paolo for the opportunities they offered me and the patience they always
demonstrated.
Thanks also to Natale Fino and Roberto Palumbo at Infomedia. Their magazines are probably
the only chance I have not to forget how to write in Italian!
I love writing, but speaking is another thing that lets you touch what's going on in development
today. For this, I wish to mention Stefano Maruzzi and Alessandro Pedone at Mondadori
Informatica Education.
A word written a few lines above now is striking me: weekend. What's that? I think I'll have to
do some research to figure it out. When you work so hard month after month, sooner or later
you end up neglecting friends. To try to partially remedy this, I want to embrace in a common
thought Marco Lucani, Raffaele D'Orsogna, Roberto Raschetti and my brother Telly.
Last but not least, I would like to thank the person who is somewhat responsible for this book:
John Franklin. I enjoyed writing this book, despite the hard work. You and your team made it
really pleasant.
Thanks to you all
Dino