-
June 30th, 2001, 12:19 PM
#1
mfc printing
Is there a small block of code I can add to force (or default) to landscape orientation, no matter which network or local printer is selected?
thanks
-
June 30th, 2001, 06:32 PM
#2
Re: mfc printing
It has to be done on a device-by-device basis, so your code needs to monitor all print requests and make the change at runtime. It is handled through the DEVMODE structure, documented in the Platform SDK docs.
// set landscape mode
DEVMODE* pDevMode = printDlg.GetDevMode();
if (pDevMode != NULL)
{
pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
dc.ResetDC(pDevMode);
GlobalFree(pDevMode);
}
-
July 1st, 2001, 11:16 AM
#3
Re: mfc printing
thanks. Actually, I found out that if you put the following code in the WinApp module, all printers default to landscape. When the print dialog comes up, landscape is pre-checked.
{
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);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|