Device Context (Windows API)

Under Windows, when using the standard drawing functions (GDI Graphics Device Interface (Windows).), a device context is associated to the window. The device context maintains the current drawing attributes, such as pen and brush specifications.

In a Windows API application, the device context is referred to by means of a device context handle (HDC). This value must be passed to the Open eVision drawing functions.

In an MFC Microsoft Foundation Classes. application, the device context is encapsulated in the CDC class. Member function CDC.GetSafeHdc provides the corresponding device context handle.

In an OWL Object Windows Library (Borland/CodeGear). application, the device context is encapsulated in the TDC class. The typecast member function TDC.HDC provides the corresponding device context handle.

In a VCL Visual Classes Library (Borland/CodeGear). application, the device context handle can be obtained form the form canvas by using syntax Form.Canvas.Handle.