다음을 통해 공유


CWinApp::GetPrinterDeviceDefaults

Call this member function to prepare a printer device context for printing.

BOOL GetPrinterDeviceDefaults(
   struct tagPDA* pPrintDlg 
);

Parameters

  • pPrintDlg
    A pointer to a PRINTDLG structure.

Return Value

Nonzero if successful; otherwise 0.

Remarks

Retrieves the current printer defaults from the Windows .INI file as necessary, or uses the last printer configuration set by the user in Print Setup.

Example

void CMyApp::SetLandscapeMode()
{
   PRINTDLG pd;
   pd.lStructSize = (DWORD)sizeof(PRINTDLG);
   BOOL bRet = GetPrinterDeviceDefaults(&pd);
   if(bRet)
   {
      // protect memory handle with ::GlobalLock and ::GlobalUnlock
      DEVMODE FAR *pDevMode = (DEVMODE FAR *)::GlobalLock(pd.hDevMode);
      // set orientation to landscape
      pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
      ::GlobalUnlock(pd.hDevMode);
   }
}

Requirements

Header: afxwin.h

See Also

Concepts

CWinApp Class

CWinApp Members

Hierarchy Chart

CPrintDialog Class