Udostępnij za pośrednictwem


CPrintDialog::CreatePrinterDC

Creates a printer device context (DC) from the DEVMODE and DEVNAMES structures.

HDC CreatePrinterDC( );

Return Value

Handle to the newly created printer device context.

Remarks

This DC is assumed to be the current printer DC, and any other previously obtained printer DCs must be deleted by the user. This function can be called, and the resulting DC used, without ever displaying the Print dialog box.

Example

// Display the Windows Print dialog box with "All" radio button 
// initially selected. All other radio buttons are disabled.
CPrintDialog dlg(FALSE);
if (dlg.DoModal() == IDOK)
{
   // Create a printer device context (DC) based on the information
   // selected from the Print dialog.
   HDC hdc = dlg.CreatePrinterDC();
   ASSERT(hdc);
}

Requirements

Header: afxdlgs.h

See Also

Reference

CPrintDialog Class

Hierarchy Chart

CPrintDialog::GetDevMode

Other Resources

CPrintDialog Members