Errata

Programming Windows

Errata for Programming Windows

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Other Digital Version N/A
United States

I have the .mobi version, so there are no page numbers.
It's in the first few pages of the book, though.

"The reference to ?typescript? means that the pages must as least resemble something that came out of a typewriter. A double-spaced manuscript page with a fixed-pitch font has about 250 words, as the description indicates. A book page is more in the region of 400 words, so Microsoft Press obviously wasn?t expecting a very long book.

Charles Petzold. Programming Windows?, Sixth Edition (Kindle Locations 163-165). Microsoft Press: A Division of Microsoft Corporation. "

------
Typo: "pages must *as* least resemble"
Should be: "pages must *at* least resemble"

Brandon Miller  Jun 07, 2012 
Other Digital Version 1
Location 141 of 8624 in Kindle Mobi Reader

In the My Setup Paragraph Petzold is referring to a Microsoft Comfort Mouse 300, which doesn't exist. I guess he's referring to the Comfort Mouse 3000.

Kai  May 26, 2012 
PDF Page 1
companion content

Programming Windows, Sixth Edition companion content has not been updated to match the book. The author says it is available and that you have not posted it.

Terry Pearson  Aug 16, 2012 
Other Digital Version 2%
390

This is more of a user error than a book error. Beware if you are reading the book via Amazon Kindle and using copy/paste to bring code into Visual Studio.

When I copied "<Image Source =" http://www.charlespetzold.com/pw6/PetzoldJersey.jpg" />" into VS the Kindle copy/paste operation added extra spaces into the XAML code:

< Image Source =" http:// www.charlespetzold.com/ pw6/ PetzoldJersey.jpg" />

This resulted in an error from the compiler: ImageSourceConverter cannot convert from System.String. Since a string is the right variable for the Source parameter the message was a red herring. The offending spaces removed, and it is working fine.

Guess I should be retyping the content rather than relying on copy/paste but hey, I've only got so many keystrokes left in my life. See keysleft.com from Scott Hanselman and friends.

Steven Wolf  Aug 13, 2013 
Printed Page 6
United States

This is also a "Question or request for clarification", but we're given only one option.

First sentence of last paragraph in printed book, page 6:
It begins:

The first namespace declaration with no prefix refers to...

Could this instead read:

The first namespace declaration with no suffix refers to...?

(Change is one word: from "prefix" to "suffix")

Reading these namespaces as I do, each one has a beginning, or prefix. Only the 2nd line (xmlns=...) has a statement with nothing following the colon. Doesn't this mean that it's the first namespace declaration with no suffix?

Jim Kay  Sep 23, 2013 
PDF Page 8
Almost half way down the page

The text states that Metro apps written in C# or Visual Basic do not have access to the DirectX APIs. That is no longer the case as of the Windows 8 Consumer Preview. See http://tinyurl.com/cwn79du for further details.

Bob Flora  Jul 05, 2012 
ePub Page 15
Middle of the page

Original:
When the New Project dialog box comes up, select Templates in the left panel, then Visual C#, and Windows Metro Style

Expected:

Windows Store instead of Windows Metro Style using latest VS2012 RTM

Anonymous  Sep 19, 2012 
ePub Page 15
Near Bottom

Original:
The list of files for this project includes one called BlankPage.xaml, and if you click the little arrowhead next to that file, you?ll see a file named BlankPage.xaml.cs indented underneath BlankPage.xaml:


Expected:
Using Visual Studio 2012:

The pages generated are now MainPage.xaml and MainPlage.xaml.cs.

Need to update all references to BlankPage.

Anonymous  Sep 19, 2012 
PDF Page 25
Bottom of page 24, top of page 25

The class hierarchy table starting at the bottom of page 24 has an alignment problem when it continues on the top of page 25.

The "Grid" term (first line of page 25) seems to be indented 2 levels past "Panel" (last line of page 24).

Similarly, "Control" seems to be indented as a child of "Panel".

Obviously the first 4 lines of page 25 must be exdented.

Larry Smith  May 17, 2012 
Printed Page 32
Multiple line on pages 32 and 33

Code for project: GradientBrushCode does not compile on MSVS2012 Pro.
The following lines generate error messages:
gradientStop.Color = Colors.Blue;
gradientStop.Color = Colors.Red;
Color = Colors.Red
Color = Colors.Blue

The error is the same in each case:
Error 1 The name 'Colors' does not exist in the current context C:\TestProjects\Petzold\GradientBrushCode\GradientBrushCode\MainPage.xaml.cs 34 34 GradientBrushCode

David Marshall  May 23, 2013 
Other Digital Version 32
location 926 of 1574

Code for project: GradientBrushCode does not compile on MSVS2012 Express.

The following lines generate error messages:
gradientStop.Color = Colors.Blue;
gradientStop.Color = Colors.Red;
Color = Colors.Red
Color = Colors.Blue

Requires adding the following statement to MainPage.xaml:

'using Windows.UI;'

Will Schlichtman  Jun 19, 2013 
PDF, ePub Page 36
Last (4th) paragraph

"MediaElement" is oddly spaced in the sentence "You can also use MediaElement for playing movies". I believe it should be italicised.

Andrew Wilcox  Aug 29, 2012 
ePub Page 42
Example 1-10

You need to add 'using Windows.UI.Xaml;' in order for Example 1-11 to compile. Without this using statement, neither of the right hand enums resolve:

txtblk.HorizontalAlignment = HorizontalAlignment.Center;
txtblk.VerticalAlignment = VerticalAlignment.Center;

Tyler  Sep 28, 2013 
PDF Page 55
Bottom of the page

I have windows 8 release preview.
I am testing the code related to resources.

All Static resources on the book are not found on the standard blank template.

code like this:
Foreground="{StaticResource rainbowBrush}" FontFamily="{StaticResource fontFamily}" FontSize="{StaticResource fontSize}"


It says resource not found or something like that.

I guess they changed the names on win 8 release preview and the new vs express 2012.

Can you or the author send me an email about this?

Luis Esteban Valencia  Jun 03, 2012 
PDF Page 58
close to the bottom

"Try inserting the following code after the InitializeComponent call in the SharedBrush.xaml.cs file:"

In the SharedBrush project in the source code, there is no SharedBrush.xaml.cs file. I believe it should be BlankPage.xaml.cs.

Rocko  May 31, 2012 
PDF Page 61
Example 2-8. Project: Spiral | File: BlankPage.xaml.cs

"double radius = angle / 10;" uses integer division, which makes the spiral look jagged. Dividing by 10.0 makes the spiral look smooth.

Anonymous  May 20, 2012 
PDF Page 72
2nd paragraph

This a job for Viewbox

should probably be:

This "is" a job for Viewbox

D Lamb  Aug 19, 2012 
PDF Page 92
1st paragraph

"software lawyer" instead of "software layer"

Anonymous  May 17, 2012 
PDF Page 101
3rd paragraph, not counting code

spelling "Somewhat more information, including snapped states, is provided by the ViewStateChanged

event of the ---->AppicationView<---- class"

Peter Beech  Sep 29, 2012 
PDF Page 103
Bottom of page 102, top of page 103

Another alignment issue.

Sample code at the top of page 103 continues indented one tab stop from code at the bottom of page 102.

But more serious is that the paragraph immediately afterward, starting "At first this might not seem a whole lot different..." is also indented, compared to a normal paragraph on page 102.

Meanwhile, the snippet that spans pages 103-104 exdents, and the normal paragraph indentation resumes ("A bunch of those GradientStop objects..."

Something screwy is going on with the formatting of the document.

Larry Smith  May 17, 2012 
Printed Page 115
1st paragraph

seems to be missing part of the text

fernando Fiore  Aug 17, 2013 
Printed Page 115
1st paragraph

Page 115 does not continue Page 114. At least, the first paragraph of p.115 has nothing to do with the last one on p.114

Werner Tschirch  Jan 26, 2014 
PDF Page 129
2nd and 3rd paragraphs

Consistency/slight contradiction

"One convenient solution is to use .NET reflection to obtain all 141 static Color properties defined in the Colors class:"

and then in 4th para:

"Windows 8 reflection works a little differently from .NET reflection."

Peter Beech  Sep 29, 2012 
PDF Page 132
3rd comment line

In "// Display the tree using TextBlock's added to StackPanel", the apostrophe is extraneous.

Petri Raitio  Aug 27, 2012 
PDF Page 138
last but on paragraph

"Generally." should be "Generally,"
(the full stop should be a comma)

Mark  May 18, 2012 
Printed Page 155
whole

example project ColorScrollWithValueConverter from download does not install because of dated certificate (?).

Wolfgang Gohe  Jun 26, 2013 
PDF Page 168
code

although fairly obvious, maybe should mention that <ColumnDefinition Width="3*" /> should be removed from inner grid.

Peter Beech  Sep 29, 2012 
PDF Page 190
Last line of the page

The caption "Project: LineCapsAndJoins..." should (arguably) appear immediately next to its associated code snippet, not split across pages.

Presumably the Word style for it should contain the Keep With Next attribute.

Larry Smith  May 17, 2012 
PDF Page 209
code, MakeButton method

last comma in Button initialiser in MakeButton not needed. Still compiles, but looks strange and might confuse.

Peter Beech  Sep 29, 2012 
PDF Page 221
Line 16

In "if (SetProperty<double>(ref red, value, "Red"))" the third parameter could and should be omitted, as described on the previous page (and as used in the green and blue property code.

Petri Raitio  Aug 27, 2012 
PDF Page 232
2nd paragraph

"The Func delegates returns an object of a particular type" should be "The Func delegates return ..."

Petri Raitio  Sep 02, 2012 
PDF Page 242
2nd paragraph

The line "setting the Foreground on the root element does not property propagate to the RadioButton controls" is misworded (i.e., "property" should be "properly").

Robert Flora  Aug 12, 2012 
PDF Page 247
2nd full paragraph

"This returns on object of type"

should probably read:

This returns "an" object of type

D Lamb  Jun 10, 2012 
PDF Page 248
First 4 paragraphs

normally, when using mouse and keyboard, clicking the right mouse button brings up the app bar. In this case it brings up the textbox context menu (as you'd actually expect). Is there a way to address this, and have a solution which allows the appbar to be accessible for mouse and keyboard users?

Peter Beech  Sep 29, 2012 
PDF Page 249
5th paragraph

For some reason, "Dispatcher object" has a background color of yellow.

Larry Smith  May 17, 2012 
PDF Page 255
2nd code block

isn't it premature to use the 'using' construct on the stream and the dataReader when calling LoadAsync? Won't the OnFileOpenReadCompleted method simply return before having completed the read and load in LoadAsync, and just before it returns end up trying to close the stream and the dataReader before the LoadAsync has really finished with them? Or is this somehow magically taken care of?

(It is maybe the case that with small text files it works OK, as the LoadAsync has already completed before the objects are closed. But large files might be different - in fact, just putting a delay in before the call to dataReader.ReadString causes it to throw an 'already closed' exception)

Peter Beech  Sep 29, 2012 
PDF Page 256
Penultimate paragraph (but many others)

Paragraph indentation is inconsistent.

Consider page 256. The first paragraph ("XamlCruncher lets you...") is indented. As is the secon ("Here's a view...").

Next you have a graphic. Fine.

But the next paragraph "The editor doesn't include..." is flush left. Is it to be considered a continuation of the previous paragraph? Doesn't seem so; it starts a new thought.

On page 257, 2 out of the 3 paragraphs are flush left.

Other flush-left paragraphs appear on pp 258, 265, 268 * 2 and 271.

Looking at a random page earlier in the document, we find these on pp 57, 58 * 3, 60, 61 and so on.

I checked the paragraph indentation style in Applications = Code + Markup and the problem didn't occur there, since all paragraphs were flush left. Ditto for Programming Microsoft Windows Forms.

FYI...

Larry Smith  May 17, 2012 
PDF Page 256
OnDataReaderLoadCompleted method

asyncAction.Completed = OnRunAsyncCompleted : There is no handler of that name mentioned in the code listing, but perhaps it's worth mentioning you need to set at least an empty handler on the Completed property in order to get it to start.

Peter Beech  Sep 29, 2012 
PDF Page 257
2nd code block

Dispatcher.Invoke - doesn't exist, needs to be RunAsync.

Peter Beech  Sep 29, 2012 
PDF Page 285
1st paragraph

"but they not set" should be "but they are not set"

Petri Raitio  Sep 02, 2012 
PDF Page 305
7th paragraph

"The final FontSize value is 73.5." Should the number be 72.5, half way between 1 and 144?

Petri Raitio  Sep 02, 2012 
PDF Page 384
4th paragraph

"The last row of this matrix is fixed." should be "The last column ..."

Petri Raitio  Sep 02, 2012 
PDF Page 397
Code listing

The class MainPage appears to use the variable storyboardPaused before initializing it.

Petri Raitio  Sep 02, 2012 
PDF Page 406
2nd paragraph

"The last row is fixed, which means that this is an affine transform." should say "column" instead of "row"; however, this has already been stated in the previous paragraph.

Petri Raitio  Sep 02, 2012 
PDF Page 412
Formulas near the bottom

The generalized formulas for SkewTransform use the tangent function, not the sine function. The correct formulas are:

x' = x + tan(AX) y
y' = tan(AY) x + y

John Chen  Jan 04, 2014 
Printed Page 934
MainPage.xaml.cs code section bottom of page

uint variable "pageNumber" is defined as "pageNumbers"

Anonymous  Sep 28, 2013 
Printed Page 936
while clause in code section

the existing while clause enters an infinite loop when December is selected for the month in monthYearSelect2.

solution I used was to replace the while clause lines with:
"while (0 >= calendar.Compare(monthYearSelect2.MonthYear));"

Anonymous  Sep 28, 2013 
Other Digital Version 1106
Top of C++ file in chapter five named GradientButton.h

I'm referring to the companion content code, thus the page number.
This refers to the C++ code for Chapter 5, the project called DependencyProperties.
The file GradientButton.h

Here's the description at the top of the file:

//
// Block.xaml.h
// Declaration of the Block class

The "Block class" does not come until later in the chapter.
This file refers to the Gradient Button project.
It should read something like:
//
// GradientButton.h
// Declaration of the GradientButton class

Jim Kay  Oct 08, 2013