Drawing Using the Standard Windows Functions
An application should always draw text using the standard Windows function calls, such as ExtTextOut, so the drawing can be seen by screen review utilities. This is true whether drawing is to a screen or to an off-screen bitmap. By watching every function call that creates a bitmap, draws to it, or copies from it, text can be tracked until it is displayed to the user.
Two techniques, the use of bitmapped text and the direct manipulation of pixels or bitmap bits, bypass the normal system calls and prevent a screen review utility from working. These techniques are discussed in the sections that follow.
Use of bitmapped text
Some applications ship precreated bitmaps either as resources or in separate files shipped with the application. A screen review utility can watch these bitmapped images being loaded, manipulated, and copied to the screen, but it has no way of deciphering the contents of the bitmap. If the bitmap contains text, the text will be visible to the sighted user. The utility, however, will not be able to present the text to the user who is blind. These bitmaps are called "bitmapped text." Because the text starts out as part of the bitmap, it is never available to the system.
An application should draw text using the standard Windows functions. There may still be cases, however, where it is necessary to display text as a hand-tuned bitmap (an example would be a corporate logo). There are two simple methods that the application can use to inform the screen review utility about the text associated with the bitmap. The first method is to use a tooltip control to associate the label with the area of the screen where the bitmap is drawn. The second method is to draw the text over the bitmap. The application can easily carry the text along with the bitmap, most likely as entry in its string table resource. When the bitmap is loaded from disk by using the LoadBitmap function, the application can also load the text by using the LoadText function. It can then inform the screen review utility of the relationship between the two.
To perform a drawing operation, create a temporary screen-compatible bitmap and an associated memory device context (DC). Draw the text into the bitmap by using the ExtTextOut function, and then use the BitBlt or StretchBlt function to copy the bitmap onto the destination location, specifying the NOP raster operation. The destination can be either the screen or another off-screen bitmap. It is easiest to do this operation when the bitmap is first loaded into memory. The accessibility aid tracks the information subsequently.
It is only necessary to perform extra operations when a screen review utility is running. To determine whether one is running, call the SystemParametersInfo function with the SPI_GETSCREENREADER value.
Direct manipulation of pixels or bitmap bits
An application should use standard Windows functions, such as BitBlt, PatBlt, and StretchBlt, for erasing text and other graphic objects and for erasing or copying bitmap memory. If an application must use alternative means, you should provide an option for reverting to standard behavior.
Some applications directly manipulate the memory associated with a DC, bypassing the Windows functions altogether. This is most commonly done with monochrome or device-independent bitmaps. When Windows functions are not used, however, the screen review utility is not aware of the changes taking place. For example, if an application draws text into a bitmap using a Windows function call and then later erases it by clearing the bitmap memory, the screen review utility will assume that the text is still present. If the bitmap is used again for another operation, the text might be read to the user, even though it is no longer visible. Similarly, if the bits comprising one bitmap are copied directly into another without using the Windows functions, the screen review utility will not be aware of it, and text displayed visually might be unseen by the screen review utility.
The Windows application programming interface (API) provides several means of manipulating bitmap or display pixels directly, such as DirectDraw, Display Control Interface (DCI), WinG, and the CreateDIBSection function. These techniques bypass screen review utilities. If your application relies on these techniques for performance, you also support using more conventional methods when a screen review utility is running on the system. To determine whether one is running, call the SystemParametersInfo function with the SPI_GETSCREENREADER value.