Programming Microsoft Windows with C#

Programming Microsoft Windows with C# Programming Microsoft Windows with C# is a tutorial for programmers wishing to write applications for Windows using the C# programming language and the Windows Forms class library. C# is a new object-oriented programming language based on C, and Windows Forms is part of the Microsoft .NET framework. Knowledge of the C or C++ programming language is required; some familiarity with object-oriented programming is helpful but not necessary.

This book has been translated into Visual Basic .NET and is available as Programming Microsoft Windows with Microsoft Visual Basic .NET"

ISBN: 0-7356-1370-2; Microsoft Press; December, 2001; 1290 pages.


This book is available from: as well as many other real and virtual bookstores.

Using the Book

The example programs in this book (and included on the CD-ROM) were written for Microsoft Visual C# .NET, which is now available and sells for about $100.

Alternatively, you can purchase Microsoft Visual Studio .NET, which also includes .NET versions of C++, J#, and Visual Basic, as well as other features. Various versions of Visual Studio .NET cost about $1,000 and up; upgrades to previous versions of Visual Studio cost about $500 and up.

It's also possible to use the book without Visual C# or Visual Studio. You need to download the 131-megabyte Microsoft .NET Framework Software Development Kit, which is final as of January 16, 2002. The .NET Framework SDK includes a command-line C# compiler that you can use in conjunction with a text editor such as the Windows Notepad. Programming Microsoft Windows with C# includes information and tips on compiling your Windows Forms programs on the command line. The only real problem is that many of the programs in Chapter 11 (and a few programs in some later chapters) include a hard-coded directory path that assumes a directory structure created by Visual Studio .NET; that path would have to be altered slightly.

Known Problems

The Microsoft Knowledge Base Article Q315849 contains corrections (as well as some replacement source code) for this book.

The following pages also discuss known problems in the book:

Visual C# Doesn't Include "Empty Project" Option

Chapter 8 Programs Don't Require NativeWindow Class

Changing the Bitmap Palette

Image Class Save Method Ignores Filename Extension

ThreadStateException Raised in Some Programs

Windows-Compatible Character Encoding

Typos, Quirks, and Bitty Bugs

More Code!

These brief articles and code samples supplement the contents of the book by providing more information on topics that may be of interest to some readers.

Reading Pixels From The Screen

© Charles Petzold, 2003
This page last updated June, 2003