ERRATA FOR THE OLD NEW THING (0321440307) As of December 2006 Page 87, the function UsePopupMenu forgets to declare the lParam parameter. // Sample usage: UsePopupMenu(hwnd, g_hinst, MAKEINTRESOURCE(1), lParam); void UsePopupMenu(HWND hwnd, HINSTANCE hinst, LPCTSTR pszMenu, LPARAM lParam) { HMENU hmenu = LoadMenu(hinst, pszMenu); if (hmenu) { HMENU hmenuPopup = GetSubMenu(hmenu, 0); TrackPopupMenu(hmenuPopup, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, hwnd, NULL); DestroyMenu(hmenu); } } Page 88, the function Sample makes the same mistake as well as missing a closing brace. // sample usage void Sample(HWND hwnd, LPARAM lParam) { HMENU hmenuPopup = LoadPopupMenu(g_hinst, MAKEINTRESOURCE(1)); if (hmenuPopup) { TrackPopupMenu(hmenuPopup, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, hwnd, NULL); DestroyMenu(hmenuPopup); } } Page 97, sixth line from the bottom should read And add the following code to WinMain before the call to CreateWindow: replacing CreateWindowEx with CreateWindow. Page 102, ninth line should read To WinMain, add before the call to CreateWindow: replacing CreateWindowEx with CreateWindow. In the code sample, the lines RECT rcClient; GetClientRect(hwnd, &rcClient); should be changed to RECT rc; GetClientRect(hwnd, &rc); Page 108, in the code fragment at the bottom, an extra close parenthesis is missing from the "if" test: if (FAILED(TextOutFL(hdc, x, y, psz, cch))) { Throughout this section, the calls to TextOut should be replaced with TextOutW. Alternatively, you can define UNICODE at the top of the program. Page 158, in the resource template, the DEFPUSHBUTTON line should read DEFPUSHBUTTON "&Bye",IDCANCEL,7,4,50,14,WS_TABSTOP Page 160, insert the line HINSTANCE g_hinst; before the definition of the InitApp function. Page 163, insert one line of code at the beginning of the WinMain function: g_hinst = hinst; Page 210, in the DlgProc function, change EndManualModeDialog(hdlg, IDOK); to EndManualModalDialog(hdlg, IDOK); and similarly EndManualModeDialog(hdlg, IDCANCEL); to EndManualModalDialog(hdlg, IDCANCEL); Page 232, in the code sample, delete the line MSG msg; since the msg variable is already declared at the top of WinMain. Page 456, add the line #define IDT_BACKGROUND 1 before the function OnBackgroundTimer. Page 460, the last line of the OnCreate function should read return g_hfAntialias && g_hfClearType; correcting the capitalization of g_hfAntialias.