Поделиться через


CWinApp::GetPrinterDeviceDefaults

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

BOOL GetPrinterDeviceDefaults(
   struct tagPDA* pPrintDlg 
);

Параметры

  • pPrintDlg
    A pointer to a PRINTDLG structure.

Возвращаемое значение

Nonzero if successful; otherwise 0.

Заметки

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.

Пример

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

Требования

Header: afxwin.h

См. также

Основные понятия

CWinApp Class

CWinApp Members

Hierarchy Chart

CPrintDialog Class