Share via


CPrintDialog::GetPrinterDC

擷取控制代碼印表機內容。

HDC GetPrinterDC( ) const;

傳回值

對印表機內容的控制代碼,如果成功,否則 NULL

備註

如果 CPrintDialog 建構函式的 bPrintSetupOnly 參數是 (表示列印對話方塊顯示),則 GetPrinterDC 將控制代碼傳回至印表機內容。 使用時,,,這樣您必須呼叫 Windows 函式 DeleteDC 刪除裝置內容。

範例

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();
}

需求

Header: afxdlgs.h

請參閱

參考

CPrintDialog 類別

階層架構圖