在MFC中设置打印的默认方式为Landscape模式

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;  
  
}  
  
}  
原文地址:https://www.cnblogs.com/lansh/p/1072669.html