The Device Context

The basic tool that Windows uses to provide device independence for an application is called a device context, or DC. The DC is an internal structure that Windows uses to maintain information about an output device. Instead of sending output directly to the hardware, an application sends it to the DC, and then Windows sends it to the hardware. The following example shows the steps necessary to output a string to the client area of a window.

 HDC hDC; // A handle to the device context. hDC = GetDC( hWnd ); // Get a handle to the window's client area DC. // Output a text string to the client area. //......................................... TextOut( hDC, 0, 0, "Text output to client area.", 27 ); ReleaseDC( hWnd, hDC ); // Release ...

Get Microsoft Windows 2000 API SuperBible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.