About This Guide

This guide is intended to help the experienced C programmer make the transition to writing applications that use the Windows version 3.1 API. It explains how to use Windows functions, messages, and structures to carry out useful tasks common to all Windows applications and illustrates these explanations with code samples that you can compile and run with Windows version 3.1.

This guide consists of three parts, each containing several chapters.

Part 1, “Programming in the Windows Environment,” presents an overview of the Windows operating system and programming environment and provides an in-depth look at a sample Windows application. Part 1 contains the following chapters:

Chapter 1, “Overview of the Windows Environment,” compares Windows to the MicrosoftÒ MS-DOSÒ programming environment, provides a brief overview of Windows, describes the elements of a Windows application, and outlines the Windows application-development process.

Chapter 2, “Generic Windows Application,” shows how to create a simple Windows application called Generic. This application is the basis for subsequent examples in this guide.

Part 2, “Programming Windows Applications,” explains basic Windows programming tasks, such as creating menus, printing, and using the clipboard. Each chapter covers a specific topic and provides code samples that illustrate that topic. Part 2 contains the following chapters:

Chapter 3, “Output to a Window,” introduces the graphics device interface (GDI) and shows how to use GDI tools to create your own output.

Chapter 4, “Keyboard and Mouse Input,” shows how to process input from the mouse and keyboard.

Chapter 5, “Icons,” shows how to create and display icons.

Chapter 6, “Cursors,” shows how to create and display cursors.

Chapter 7, “Menus,” shows how to create menus for your applications and how to process input from menus.

Chapter 8, “Controls,” explains how to create and use controls, such as push buttons and list boxes.

Chapter 9, “Dialog Boxes,” explains how to create and use dialog boxes and how to fill them with controls.

Chapter 10, “File Input and Output,” explains how to use the OpenFile function and provides rules about reading from and writing to disk files.

Chapter 11, “Bitmaps,” shows how to create and display bitmaps.

Chapter 12, “Printing,” explains how to use a printer with Windows.

Chapter 13, “Clipboard,” explains the clipboard and shows how to use it.

Part 3, “Advanced Programming Topics,” introduces and explains some advanced topics, such as memory management and dynamic data exchange (DDE). Each chapter covers a specific topic. Part 3 contains the following chapters:

Chapter 14, “C and Assembly Language,” presents some guidelines for writing C-language and assembly-language Windows applications.

Chapter 15, “Memory Management,” shows how to allocate global and local memory.

Chapter 16, “More Memory Management,” provides a more in-depth look at how your application can efficiently manage memory. This chapter also explains how Windows manages memory under different memory configurations.

Chapter 17, “Print Settings,” explains how to tailor printer settings (such as page size and orientation).

Chapter 18, “Fonts,” shows how to create and load fonts and how to use them in the TextOut function.

Chapter 19, “Color Palettes,” shows how to use Windows color palettes to make the most effective use of color.

Chapter 20, “Dynamic-Link Libraries,” explains how to create and use Windows dynamic-link libraries (DLLs).

Chapter 21, “Multiple Document Interface,” explains how to create an application that uses the Windows multiple document interface (MDI) so that users can work with more than one document at a time.

Chapter 22, “Dynamic Data Exchange,” explains how to pass data from one application to another by using the message-based DDE protocol.