Click to See Complete Forum and Search --> : VC++ 6.00: How set the landscape printing mode?


May 10th, 1999, 11:23 AM
I know that it seems to be a trivial question.
But I did not find how to set the printing mode to landscape before displaying
the CPrintDialog, with VC++ 6.00.
I tried to change the DEVMODE structure with GetDevMode method but I always got
an error: The memory could not be written.

Help highly appreciates.
JH MORIN.

Harvey Hawes
May 10th, 1999, 11:39 AM
Hi,

There is a Knowledge Base article at Microsoft's site on how to do this. Don't have the article off hand, should be able to search for it. If you can't find it, I could post the code... let me know.

HTH,

Harvey Hawes

Software Engineer
BioScience Analysis Software Ltd.

Masters Candidate
Cardiovascular/Respiratory Sciences
Faculty of Medicine
University of Calgary
Calgary, Alberta, Canada

czieler
May 10th, 1999, 12:54 PM
This is how I do it

LPDEVMODE lp = (LPDEVMODE) ::GlobalLock(dlg.m_pd.hDevMode);
ASSERT(lp);
lp->dmOrientation = DMORIENT_LANDSCAPE;
::GlobalUnlock(dlg.m_pd.hDevMode);
ResetDC(dlg.m_pd.hDC,lp);

May 11th, 1999, 07:58 AM
Thanks to all.
The code below does excatly what I wanted.

LPDEVMODE lp = (LPDEVMODE) ::GlobalLock(dlg.m_pd.hDevMode);
ASSERT(lp);
lp->dmOrientation = DMORIENT_LANDSCAPE;
::GlobalUnlock(dlg.m_pd.hDevMode);
ResetDC(dlg.m_pd.hDC,lp);

Jean-Hubert Morin