
28 2. Windows Programming Fundamentals
HDC hdc; // Handle to device context
Listing 2.12. Handle to device context.
Text may be displayed in the window using the TextOut function. We will only be
using TextOut in this chapter so that we may test our text input code. In later chapters,
we will use dierent techniques for displaying text in our games. e rst parameter in
TextOut is our hdc variable. e code in Listing 2.13 is added to our WinProc function.
case WM_PAINT: // The window needs to be redrawn
hdc = BeginPaint(hwnd, &ps); // Get handle to device context
GetClientRect(hwnd, &rect); // Get the window rectangle
// Display the character