Charles Petzold on writing books, reading books, and exercising the internal UTM

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

“Programming Windows” 6th Edition Release Preview Now Available!

August 14, 2012
Roscoe, N.Y.

The Release Preview ebook of Programming Windows 6th edition is now available. For the next two weeks, through August 27, 2012, the ebook is available at a special price of just $30. But don't tarry, because after August 27, the price goes up to $40. Complete details can be found on the Microsoft Press blog.

Of course, if you've already purchased the Programming Windows 6th edition ebook at whatever price, you can now download the Release Preview. (There seems to be a little glitch with the updated code samples — also known as the Companion Content — but that should be fixed later today.)

Programming Windows 6th edition is all about writing applications for the new-style user interface of Windows 8 using the Windows Runtime (WinRT) API with C# and XAML. Downloadable code samples have also been converted to C++/CX (which is C++ with Component Extensions so you don't have to access WinRT using COM).

The Release Preview has six more chapters and partial chapters than the Consumer Preview. These chapters are entitled: Animation, Transforms, Touch Etc, Bitmaps, Printing, and Going Native, for a total of 579 pages (so far). The final ebook — which you'll be able to download at no additional cost if you've purchased the Consumer Preview or Release Preview ebook at whatever price — is scheduled for mid-November, just three months from now.

Wish me luck!

Programming Windows, 6th Edition

Special Price through August 27!

For just $30, you get:

(1) the Release Preview ebook right now
(2) the final ebook in November

Programming Windows 6th edition
Programming Windows 6th Edition
Release Preview eBook


I just downloaded the update from O'Reilly. The PDF is up-to-date, but the Companion Content is still the source code from May.

By the way, your book is excellent.

— Stefan Lange, Tue, 14 Aug 2012 17:40:49 -0400

Yes, that's the little glitch I was referring to. O'Reilly knows about the problem. — Charles

This arrived just in time to stop the LineCapsAndJoins example from going through the window, along with the PC on which it was compiled. I'm feeling much calmer now. :)

Loving the tutorial approach of this book, I don't always know where I'm going but when I get there I know far more than I expected. Keep up the great work Charles.

— Steve Monks, Wed, 15 Aug 2012 05:06:14 -0400


I like chapter 13 (touch) I'm sure you need a few more things, but as it is now, I think is great.

In Windows 7 and now as I read your book, in Windows 8, you have to either use raw touch data or "ready-to-use" gestures but not both. Is this the case for Windows 8? It seems that Windows Touch in Win8 is a bit better. It would be nice to compare them.

The one chapter that I was expecting something different is "Going Native"

I was under the impression you were going to talk more about native coding and not using p/invoke. While still great for people that use managed language, it would be nice to have a chapter for metro c++ going native. We know that you are going to write the entire book in C# with samples in C++ and C#. But it would be cool how different the code for example of metro c++ for win8 would look as opposed to use the pure win32 api. I know you talked about this before, but a chapter covering that maybe a good idea. It could even be a pdf add-on to the book.

Anyways, like always, thank you for such amazing work.

See if you can give me some info about the touch for Windows 8. In special , the differences between win 7 touch and win 8 touch. I'm using windows 7 raw touch in C++ WIN32


Francisco, Wed, 15 Aug 2012 13:49:26 -0400


Still no updated companion content available from the O'Reilly site. I really like to work through the code as I read the book. Any other way to get the source code?

This is really a great book.

— Terry, Thu, 16 Aug 2012 04:44:42 -0400

Downloaded the book and love it so far! Too bad there isn't a good way to read the EPub on Windows8 ;)

— Gary A Bushey, Thu, 16 Aug 2012 13:52:12 -0400

Charles- Thanks so much for taking the time to write this. Your guided tour has been extremely helpful and insightful.

Scott Seely, Fri, 17 Aug 2012 15:34:58 -0400


In Windows 7 one uses WM_TOUCH or WM_GESTURE

In Windows 8, it seems now WM_POINTER is used.

Are you going to go over this in the final book?

It would be great to know about touch in terms of the native side (C/C++ )


Francisco, Fri, 17 Aug 2012 17:07:43 -0400

A new-style Windows 8 app handles touch, mouse, and pen input using the Pointer and Manipulation events defined by the WinRT API. Those events are covered in Chapter 13 of the book.

Regardless whether you're using C# or C++ or JavaScript to write a new-style Windows 8 app, WinRT is the native API.

The WM_POINTER message is not part of the WinRT API and does not play a role in new-style Windows 8 apps. The WM_POINTER message is part of the Win32 API that you'll continue to use for writing desktop apps.

I have been very clear that I won't be covering the programming of desktop apps in this book. — Charles

Hi, everybody. The companion content is indeed now available. Click the "Companion Content" link at, and then you're on your way. The ZIP file for this new release is 19.2MB.

Devon Musgrave, Fri, 17 Aug 2012 17:35:13 -0400


Thank you for the answer.

For some reason I was confused thinking that when writting apps in C++ using WinRT, one would mixed that with win32 api.

Now, I understand that the metro is a whole new bread of interface (in some sort of way) and while it may be possible to combine (which I'm not sure) it with win32, in reality, using C++ and WinRT is all you need to do true native metro apps.

Thanks for the clarification

Always, thanks for the great work!

Francisco, Tue, 21 Aug 2012 10:27:01 -0400

There are some Win32 APIs allowed in a new-style Windows 8 app, but they are restricted to those referenced here:

— Charles

I was looking at the BitmapEncoder section in your book, and wondered how precisely the third parameter of

CreateAsync(Guid, IRandomAccessStream, IIterable(IKeyValuePair))

could be used to specify an encoding option such as image quality. The docs say "provide a string that contains the name of the option, and a BitmapTypedValue that contains the desired value.", but neglect to explain what strings are used for what option.

Did you happen to know this?

— Andrew Webb, Wed, 29 Aug 2012 21:47:03 -0400

Here is how I did it eventually.

void save( IRandomAccessStream^ putJpgStream )
BitmapPropertySet ^ bitmapPropertiesSet= ref new BitmapPropertySet();
bitmapPropertiesSet->Insert( "ImageQuality", ref new BitmapTypedValue( quality, PropertyType::Single ) );
// See Native WIC Codecs
task< BitmapEncoder^ > getEncoderTask( BitmapEncoder::CreateAsync( BitmapEncoder::JpegEncoderId, putJpgStream, bitmapPropertiesSet ) );
getEncoderTask.then( [=] ( BitmapEncoder^ bitmapEncoder )
setPixelDataParams->setPixelData( bitmapEncoder );

— Andrew Webb, Wed, 5 Sep 2012 19:17:06 -0400

Thanks! — Charles

Dear Charles,

Thank you for your book, I've just downloaded it this week. As a ASP.NET programmer and new enthusiast of Windows 8 I'm looking for a great starting book which can help me wire into Win8Apps. So far a great book, excellent, easy to take on, and love the final perk on the COM interop for the C# developers (such as myself).

Thank you for sharing your knowledge and experience with the community. Best of luck for this book.

Warm regards

Tiago Cardoso, Wed, 7 Nov 2012 07:01:07 -0500

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

(c) Copyright Charles Petzold