Copyright © 2016 Packt Publishing
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 embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2016
Production reference: 1020916
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-422-4
www.packtpub.com
Stefan Björnander holds a master's degree in computer science, and has worked with software development for many years. He has lectured on programming for the industry and universities. He has also authored Microsoft Visual C++ Windows Applications by Example for Packt Publishing, which gained great acclaim.
Lou Mauget learned to program long ago at Michigan State University as a physics major, learning to use software to design a cyclotron. He worked at IBM for 34 years, and after that, he went on to work for several consulting firms, including a long-term engagement with the railroad industry. He is currently consulting for Keyhole Software of Leawood, Kansas. Recently, he designed and coded MockOla, a drag-drop wire-frame prototyping tool for Keyhole Software. Lou has coded in C++, Java, JavaScript, Python, and newer languages, as each was conceived. His current interests include reactive functional programming, containers, Node JS, NoSQL, geospatial systems, mobile, and any new language or framework. Occasionally, Lou blogs about software technology for Keyhole Software. He has coauthored three computer books and authored two IBM DeveloperWorks XML tutorials and a WebSphere Journal LDAP tutorial. Lou coauthored several J2EE certification tests for IBM. He has reviewed books for Packt Publishing, as well as other publications.
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at
www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
[email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Free access for Packt account holders
Get notified! Find out when new books are published by following @PacktEnterprise
on Twitter or the Packt Enterprise Facebook page.
I dedicate this book to my parents Ralf and Gunilla, my sister Catharina, her husband Magnus, and their sons Emil and Rasmus.
Application development has gained massive popularity because of the immense impact it has on various sectors. In this booming market, it has become critical to have the right set of tools to enable developers to build practical, user-friendly, and efficient applications. This book is focused on the use and implementation of Small Windows, which is a C++ object-oriented class library that eases the development of interactive Windows applications.
Chapter 1, Introduction, gives an introduction to Small Windows, which is a class library that encapsulates a part of the Win32 API.
Chapter 2, Hello, Small World!, starts by building a (very) small application—the Small Windows version of the famous Hello World program. Then, we will continue with a (still rather small) application that handles circles in a window. The user can add and move circles, change their colors, and save and load circles.
Chapter 3, Building a Tetris Application, explores a version of the classic Tetris game. Seven different kinds of figure are falling down the screen and the user’s task is to move or rotate them so that as many rows as possible can be completely filled and removed.
Chapter 4, Working with Shapes and Figures, teaches you how to build a drawing program, which can be regarded as a more advanced version of the circle application. It is possible to create and remove figures as well as mark and drag figures.
Chapter 5, The Figure Hierarchy, continues to build the drawing program. We can define a class hierarchy with lines, arrows, rectangles, and ellipses.
Chapter 6, Building a Word Processor, describes a word processor capable of formatting individual characters.
Chapter 7, Keyboard Input and Character Calculation, discusses how the word processor handles many keyboard input combinations and calculates the size and position of each individual character.
Chapter 8, Building a Spreadsheet Application, talks about the final application, which is a spreadsheet program capable of calculating formulas with the four rules of arithmetic. It is also possible to cut and paste blocks of cells.
Chapter 9, Formula Interpretation, explains that when the user inputs a formula, we need to interpret it. The process is divided into scanning and parsing, which we will look into in this chapter.
Chapter 10, The Framework, describes the most central part of Small Windows. This chapter begins the description of Small Windows. The Application class handles the message loop of the application and the registration of Windows classes. The Window class handles basic window functionality.
Chapter 11, The Document, talks about the document-based Window subclasses, that is, the Document class that provides basic document functionality, such as menus and accelerators, and the Standard Document framework, which provides a document-based framework.
Chapter 12, The Auxiliary Classes, explores a set of small auxiliary classes handling points and sizes, rectangles, colors and fonts, dynamic lists, and tree structures.
Chapter 13, The Registry, Clipboard, Standard Dialogs, and Print Preview, explains the implementation of the registry and clipboard, the standard dialogs to save and load files, choosing color or font, or printing a document. The chapter also explains the implementation a class for print previewing.
Chapter 14, Dialogs, Controls, and Print Setup, describes the possibility to design custom dialogs with controls such as push buttons, check boxes, radio buttons, list boxes, combo boxes, and text field. The input of a text field can be converted to any type. Finally, the Print Setup dialog is a custom dialog annotated with suitable controls.
What you need for this book
First of all, you need to download Visual Studio on your computer. I suggest you download and install Express for Desktop, which is free, and is available at https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx.
Then, there are two ways to ins...