Click here to Skip to main content
15,885,757 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reading BIOS Pin
John M. Drescher19-Apr-03 21:03
John M. Drescher19-Apr-03 21:03 
GeneralRe: Reading BIOS Pin
Toni7821-Apr-03 11:30
Toni7821-Apr-03 11:30 
GeneralRe: Reading BIOS Pin
John M. Drescher22-Apr-03 4:27
John M. Drescher22-Apr-03 4:27 
GeneralProblem with MAPI Pin
Atlence19-Apr-03 8:16
Atlence19-Apr-03 8:16 
GeneralSend Message Pin
Zygmunt19-Apr-03 7:44
Zygmunt19-Apr-03 7:44 
GeneralRe: Send Message Pin
Rickard Andersson2019-Apr-03 8:01
Rickard Andersson2019-Apr-03 8:01 
GeneralRe: Send Message Pin
David Crow21-Apr-03 3:28
David Crow21-Apr-03 3:28 
QuestionCan not print in Landscape Mode Pin
ATC19-Apr-03 6:32
ATC19-Apr-03 6:32 
Hi,

I am trying desperately to print a report in Landscape
Mode with VC++, but even I try with "hDevMode" ... it
still always print in Portrait Mode:
<br />
    CPrintDialog printDlg(FALSE, PD_RETURNDEFAULT | PD_RETURNDC);<br />
<br />
    if (printDlg.DoModal() == IDCANCEL)     return; <br />
<br />
    ////////////////// Landscape Mode //////////////////////<br />
<br />
    HGLOBAL m_hDevMode;<br />
    HGLOBAL m_hDevNames;<br />
<br />
    PRINTDLG   pd;<br />
    pd.lStructSize = (DWORD) sizeof(PRINTDLG);<br />
<br />
    // Lock memory handle.<br />
    DEVMODE FAR* pDevMode =<br />
        (DEVMODE FAR*)::GlobalLock(m_hDevMode);<br />
    LPDEVNAMES lpDevNames;<br />
    LPTSTR lpszDriverName, lpszDeviceName, lpszPortName;<br />
    HANDLE hPrinter;<br />
	<br />
    // pDevMode is not TRUE, program not going this LOOP<br />
    if (pDevMode)   <br />
    {<br />
        // Change printer settings in here.<br />
       pDevMode->dmOrientation = DMORIENT_LANDSCAPE;<br />
<br />
       // Unlock memory handle.<br />
       lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);<br />
       lpszDriverName = (LPTSTR )lpDevNames + lpDevNames->wDriverOffset;<br />
       lpszDeviceName = (LPTSTR )lpDevNames + lpDevNames->wDeviceOffset;<br />
       lpszPortName   = (LPTSTR )lpDevNames + lpDevNames->wOutputOffset;<br />
<br />
       ::OpenPrinter(lpszDeviceName, &hPrinter, NULL);<br />
       ::DocumentProperties(NULL,hPrinter,lpszDeviceName,pDevMode,<br />
						   <br />
       pDevMode, DM_IN_BUFFER|DM_OUT_BUFFER);<br />
<br />
       // Sync the pDevMode.<br />
       ::ClosePrinter(hPrinter);<br />
       ::GlobalUnlock(m_hDevNames);<br />
       ::GlobalUnlock(m_hDevMode);<br />
    }<br />
<br />
    ///////////////////// Standrad Printing  /////////////////<br />
<br />
	CDC		dc;<br />
	CPrintInfo	Info;<br />
	CFont		oFont;<br />
<br />
	dc.Attach(printDlg.GetPrinterDC());   	<br />
        dc.SaveDC();					<br />
	dc.m_bPrinting = TRUE;<br />
<br />
	CString strTitle;                      <br />
	strTitle.LoadString(AFX_IDS_APP_TITLE);<br />
<br />
	DOCINFO di;                            	<br />
        ::ZeroMemory (&di, sizeof (DOCINFO));<br />
	di.cbSize = sizeof (DOCINFO);<br />
	di.lpszDocName = strTitle;<br />
<br />
	BOOL bPrintingOK = dc.StartDoc(&di);  <br />
        ....................................<br />
        ....................................<br />

Can any one know why? To show you my problem I can
send "my small project" if you provide me your Email
address

I appreciate a lot anyone try to help me here

Thanks
AnswerRe: Can not print in Landscape Mode Pin
Paolo Messina19-Apr-03 9:20
professionalPaolo Messina19-Apr-03 9:20 
GeneralRe: Can not print in Landscape Mode Pin
ATC19-Apr-03 11:33
ATC19-Apr-03 11:33 
GeneralRe: Can not print in Landscape Mode Pin
Paolo Messina19-Apr-03 11:55
professionalPaolo Messina19-Apr-03 11:55 
GeneralRe: Can not print in Landscape Mode Pin
ATC19-Apr-03 12:36
ATC19-Apr-03 12:36 
GeneralRe: Can not print in Landscape Mode Pin
Bartosz Bien20-Apr-03 4:41
Bartosz Bien20-Apr-03 4:41 
GeneralRe: Can not print in Landscape Mode Pin
ATC20-Apr-03 5:34
ATC20-Apr-03 5:34 
GeneralRe: With your helps, it works now! Pin
ATC22-Apr-03 9:03
ATC22-Apr-03 9:03 
GeneralSplitterWnd - Moving the bar Pin
Shutter19-Apr-03 5:26
Shutter19-Apr-03 5:26 
GeneralQuestion about const pointer. Pin
George219-Apr-03 4:04
George219-Apr-03 4:04 
GeneralRe: Question about const pointer. Pin
John M. Drescher19-Apr-03 5:01
John M. Drescher19-Apr-03 5:01 
GeneralRe: Question about const pointer. Pin
George219-Apr-03 18:17
George219-Apr-03 18:17 
GeneralRe: Question about const pointer. Pin
Phil Hamer19-Apr-03 16:44
Phil Hamer19-Apr-03 16:44 
GeneralRe: Question about const pointer. Pin
George219-Apr-03 18:19
George219-Apr-03 18:19 
GeneralModeless Dialog to back and taskbar button Pin
Mathias S.19-Apr-03 2:07
Mathias S.19-Apr-03 2:07 
GeneralRe: Modeless Dialog to back and taskbar button Pin
John M. Drescher19-Apr-03 3:46
John M. Drescher19-Apr-03 3:46 
GeneralRe: Modeless Dialog to back and taskbar button Pin
Michael Dunn19-Apr-03 5:19
sitebuilderMichael Dunn19-Apr-03 5:19 
GeneralWorker-Thread in Win32 Application Pin
ZarrinPour19-Apr-03 1:16
ZarrinPour19-Apr-03 1:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.