Returns a handle provided by the Microsoft Windows operating environment to the device context of an object.
object.hDC
object:Form, Printer, CommDlg
This property is a Windows operating environment device context handle. The Windows operating environment manages the system display by assigning a device context for the Printer object and for each form in your application. You can use the hDC property to refer to the handle for an object's device context. This provides a value to pass to Windows API calls.
With a CommDlg object, this property returns a device context for the printer selected in the Print dialog box when the cdpReturnDCflag is set or an information context when the cdpReturnIC flag is set.
The following routine copies an area from the Screen.DC and copies it to the hDC of Window 1.
// Courtesy of Juergen
OpenW 1, 0, 0, 402, 402, 0
Win_1.AutoRedraw = 1
BitBlt Screen.GetDC, 400, 400, 400, 400, Win_1.hDC, 0, 0, &H00CC0020
The value of the hDC property can change while a program is running, so don't store the value in a variable; instead, use the hDC property each time you need it.
{Created by Sjouke Hamstra; Last updated: 09/10/2014 by James Gaite}