hDC Property (ACommonDialog)

Returns a device context for the printer selected in the Print dialog box.

Syntax

 [ ldHc = ] Object.hDC

The hDC property syntax has the following parts:

 

Name

Type

Description

Object

ACommonDialog

ACommonDialog control

ldHc

Long

A device context for the printer selected in the Print dialog box.

Comments

The Windows operating environment manages the system display by assigning a device context for the Printer object and for each form and PictureBox control in your application. The hDC property can be used to refer to the handle for an object's device context. This provides a value to pass to Windows API calls.

With the ACommonDialog control, this property returns a device context for the printer selected in the Print dialog box when the acdlgPrintOptionsReturnIC flag is set in the PrintOptions property or an information context when the acdlgPrintOptionsReturnIC flag is set.

Note: 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.

Example

The following statement retrieves the ACommonDialog's device context handle:

hPrinterDC=cdlg1.hDC

Applies to

ACommonDialog

See Also

Form.hDC, ShowPrint