FAQ for Programming Windows, 5th Edition

Can't install electronic version of book after installing IE 5


I want to install the electronic version of Programming Windows, but it wants to replace my version of Internet Explorer 5 with Internet Explore 4. What do I do?


The Microsoft Press Technical Support group acknowledges this as a known problem. They say: "The setup for the electronic book doesn't recognize IE 5 as being a version of Internet Explorer and will attempt to install IE 4 over top of the existing installation. This won't harm the customer's system but will cause a number of error messages to appear. Here's the workaround:

1. Insert the book's CD-ROM in the CD-ROM drive.
2. Open Windows Explorer.
3. Browse to the \Ebook directory on the CD-ROM.
4. Highlight the .CHM file and select Copy from the Edit menu.
5. Close or minimize all windows so that your desktop is viewable.
6. Right-click an empty spot on your desktop and select Paste from the context menu.

In order to view the electronic book, simply double-click the .CHM file on your desktop."

In other words, you don't need to install anything. Just run the .CHM ("compiled HTML help") file.

EXEs in DEBUG directories don't run under Win95 or Win98


On the CD-ROM, most of the .EXE files in the DEBUG directories don't run under Win95 or Win98. Why not?


As discussed in the README.TXT file on the CD-ROM and in the book in the section "Internationalization and This Book" (pages 38-39), the sample programs on the CD-ROM use mostly default project settings. However, there's one major exception: For the DEBUG configuration the UNICODE identifier is defined. This causes the program to be linked with the wide-character versions of all the function calls. In general, Windows 95 and Windows 98 do not support Unicode and the wide-character function calls. Thus, these .EXE files will only run under Windows NT. If you run the .EXE files under Windows 95 or Windows 98 you'll get an error message that the program requires Windows NT.

If you want to compile a DEBUG version of a sample program to run under Windows 95 or Windows 98, in the Project Settings dialog box, C/C++ tab, remove the UNICODE identifer from the Preprocessor Definitions edit field.

Read-Only Attribute on Copied Files


When I copy the CD-ROM to my hard drive, all the files have the read-only attribute set. What's a good way to remove that attribute from all the files in one shot?


In the MS-DOS Command Prompt window, from the PROGWIN directory, execute the command:
    ATTRIB -r *.* /s

MSDN Web Sites


I can't find the Microsoft Developer Network (MSDN) Web sites you mention on page 12. Where are they?


The Platform SDK can be downloaded at http://www.microsoft.com/msdownload/platformsdk/sdkupdate/. The Platform SDK API documentation is located at http://msdn.microsoft.com/library.

LINK Error: "unresolved external symbol _main"


When I try and compile the sample programs on the CD-ROM, I get an error message "unresolved external symbol _main." What am I doing wrong?


When you get this message it means that the program is being compiled and linked as a character-mode "console" application -- not as a Windows application. The linker can't find a function called main() because the program doesn't have one. The linker should be looking for WinMain(), which the program does have.

If you're creating a new project for the program within VC++, you need to specify "Win32 Application" rather than "Win32 Console Application." See the instructions on page 14 of "Programming Windows," Fifth Edition.

If you're loading the programs from the CD-ROM, use the File | Open Workspace command to load in the appropriate .DSW file on the CD-ROM. Don't use the File | Open command to load in the .C file.

Bug List


Are there any bugs in the sample programs in the book?


Yes, and here's a list:
  • Three of the SYSMETS programs have incorrect comments. In the section containing horizontal scroll processing, a comment refers to the vertical scroll bar. Here's the corrected SYSMETS3.C, SYSMETS4.C, and SYSMETS.C. (Bug reported by Witt Holloway.)

  • In Figure 5-4 on page 136, tmExternalLeading should be tmInternalLeading. (Bug reported by Doug Beleznay.) Also, the caption should refer to TEXTMETRIC rather than FONTMETRIC.

  • The SINEWAVE program in Chapter 5 (pages 147 to 148) is missing an EndPaint statement to conclude WM_PAINT processing. Here's a corrected SINEWAVE.C. (Bug reported by Ross Driedger.)

  • In the second to last paragraph on page 264, the sentence should conclude "and DestroyCaret during the WM_KILLFOCUS message." (Bug reported by John Dlugosz and Doug Yip.)

  • The BLOKOUT2 program in Chapter 7 (pages 314 to 317) has a signed/unsigned mismatch in the WM_MOUSEMOVE and WM_LBUTTONUP message processing. The results of the LOWORD and HIWORD macros should be cast to short values before being assigned to the fields of the POINT structures. Here's a corrected BLOKOUT2.C. (Bug reported by Paul Middleton.)

  • The CLIPTEXT program in Chapter 12 (pages 575 to 579) is missing a GlobalUnlock call during processing of the IDM_EDIT_PASTE case of the WM_COMMAND message. Here's the corrected CLIPTEXT.C. (Bug reported by Doug Yip.)

  • On page 657, the statement that begins with the DeleteObject call should actually be:
      DeleteObject (SelectObject (hdcClient, GetStockObject (WHITE_BRUSH))) ;
    (Bug reported by Paul Levijoki.)

  • In the UPDDEMO program in Chapter 23 (pages 1423 to 1434), the InternetOpen call should have a last argument of 0. I have not implemented a call-back function so I can't use asynchronous I/O. Here's the corrected UPDDEMO.C. (Bug reported by Kia Vang.)
Additional error lists can be found at www.computersciencelab.com/PetzoldErrata.htm and www.jasondoucette.com/books/pw5/pw5errata.html.

© Charles Petzold, 2003, pw5@charlespetzold.com
This page last updated July, 2003.