C.4 Common Programming Errors

The following list describes programming errors that sometimes appear in Windows applications:

Passing invalid parameters.

Accessing nonexistent window words. (In Windows 3.0, a call to the SetWindowWord or SetWindowLong function past the end of the allocated window words, as defined by the RegisterClass function, would damage internal window-management structures.)

Using handles after they have been deleted or destroyed.

Using a device context after it has been released.

Deleting GDI objects before they are selected out of a device context.

Neglecting to delete GDI or USER objects when an application terminates.

Writing past the end of an allocated memory block.

Reading or writing using a memory pointer after it has been freed.

Neglecting to export window procedures and other callback functions.

Neglecting to use the MakeProcInstance function with dialog procedures and other callback functions.

Many of these programming errors can cause unrecoverable application errors in Windows version 3.0. The debugging system can help you locate these types of problems.