CWinApp::GetPrinterDeviceDefaults

BOOLGetPrinterDeviceDefaults(PRINTDLG*pPrintDlg);

Return Value

Nonzero if successful; otherwise 0.

Parameters

pPrintDlg

A pointer to a structure.

Remarks

Call this member function to prepare a printer device context for printing. 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(m_hDevMode);
      // set orientation to landscape
      pDevMode->dmOrientation=DMORIENT_LANDSCAPE;
      ::GlobalUnlock(m_hDevMode);
   }
}

CWinApp OverviewClass MembersHierarchy Chart

See Also   CPrintDialog