CPrintDialog::GetPrinterDC

HDCGetPrinterDC()const;

Return Value

A handle to the printer device context if successful; otherwise NULL.

Remarks

If the bPrintSetupOnly parameter of the CPrintDialog constructor was FALSE (indicating that the Print dialog box is displayed), then GetPrinterDC returns a handle to the printer device context. You must call the Windows function to delete the device context when you are done using it.

Example

CPrintDialog dlg(FALSE);
if (dlg.DoModal() == IDOK)
{
   // Get a handle to the printer device context (DC).
   HDC hdc = dlg.GetPrinterDC();
   ASSERT(hdc);

   // Do something with the HDC...

   // Clean up.
   CDC::FromHandle(hdc)->DeleteDC();
}

CPrintDialog OverviewClass MembersHierarchy Chart