void SetPrntOrientation()
{
/*dmOrientation 
For printer devices only,
 selects the orientation of the paper. 
 This member can be either 
 DMORIENT_PORTRAIT (1) or 
 DMORIENT_LANDSCAPE (2). 
纵向: portrait
横向: landscape orientation
*/ 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_PORTRAIT;//DMORIENT_LANDSCAPE;
::GlobalUnlock(m_hDevMode);
}}