Click here to Skip to main content
15,915,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: overhead of NEW and DELETE Pin
kDevloper14-Jul-08 20:31
kDevloper14-Jul-08 20:31 
AnswerRe: overhead of NEW and DELETE Pin
enhzflep14-Jul-08 20:31
enhzflep14-Jul-08 20:31 
QuestionRe: overhead of NEW and DELETE Pin
David Crow15-Jul-08 3:29
David Crow15-Jul-08 3:29 
AnswerRe: overhead of NEW and DELETE Pin
ThatsAlok15-Jul-08 3:44
ThatsAlok15-Jul-08 3:44 
AnswerRe: overhead of NEW and DELETE Pin
Mark Salsbery15-Jul-08 6:20
Mark Salsbery15-Jul-08 6:20 
QuestionCannot print landscape with default printer Pin
tataxin14-Jul-08 14:24
tataxin14-Jul-08 14:24 
GeneralRe: Cannot print landscape with default printer Pin
tataxin14-Jul-08 20:09
tataxin14-Jul-08 20:09 
AnswerRe: Cannot print landscape with default printer Pin
Nelek14-Jul-08 21:24
protectorNelek14-Jul-08 21:24 
Well, I don't know if you are using MFC, but I made it like that:

BOOL CMyFormView::OnPreparePrinting(CPrintInfo* pInfo)
{	// Standardvorbereitung
    delete pInfo->m_pPD ;		// Release previous MFC allocated standard dialog object
	//Miguel: Attach the new CDlgPrinting
    pInfo->m_pPD = new CDlgPrinting(FALSE, PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS
								| PD_HIDEPRINTTOFILE | PD_NOSELECTION, this) ;   //My own CPrintDialog self defined
	pInfo->m_pPD->m_pd.hInstance = AfxGetInstanceHandle();
	pInfo->m_pPD->m_pd.lpPrintTemplateName = MAKEINTRESOURCE(IDD_PRINT_PRDLG);
	pInfo->m_pPD->m_pd.Flags |= PD_ENABLEPRINTTEMPLATE;
	pInfo->m_pPD->m_pd.nMinPage = 1;
.
// Other checks and configurations
.
	if (pInfo->m_bPreview)
		return DoPreparePrinting(pInfo);

	int nAnswer = pInfo->m_pPD->DoModal ();
	if (nAnswer == IDCANCEL)
		return FALSE;

	pInfo->m_pPD->m_pd.hDC = pInfo->m_pPD->CreatePrinterDC ();

	return TRUE;
}

//*********************************

void CMyFormView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{	// TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen
	if (pDC->IsPrinting ())
	{	DEVMODE* devMode = pInfo->m_pPD->GetDevMode ();
		devMode->dmOrientation = DMORIENT_LANDSCAPE;
		devMode->dmFields |= DM_ORIENTATION;
		pDC->ResetDC (devMode);
	}
	
	CFormView::OnPrepareDC(pDC, pInfo);
}

//*********************************

void CMyFormView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{	// TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen	
// Setting printing parameters
	pDC->SetMapMode (MM_LOMETRIC);
	
	double dLeftOffset = 200 - (pDC->GetDeviceCaps (PHYSICALOFFSETX) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSX);
	double dTopOffset = 200 - (pDC->GetDeviceCaps (PHYSICALOFFSETY) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSY);
	double dRightMargin = 2770 - (pDC->GetDeviceCaps (PHYSICALOFFSETX) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSX);
	double dBottomMargin = 1950 - (pDC->GetDeviceCaps (PHYSICALOFFSETY) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSY);

	pInfo->m_rectDraw.left += (int) dLeftOffset;
	pInfo->m_rectDraw.top += (int) dTopOffset;
	pInfo->m_rectDraw.right = (int) dRightMargin;
	pInfo->m_rectDraw.bottom = (int) dBottomMargin;

..........
.......
,....



I don't know if it is totally correct and I guess it can be optimized, but it works. I hope it helps you

Regards.
--------
M.D.V. Wink | ;)

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.

GeneralRe: Cannot print landscape with default printer Pin
tataxin15-Jul-08 1:10
tataxin15-Jul-08 1:10 
QuestionProcess priority Pin
locoone14-Jul-08 14:00
locoone14-Jul-08 14:00 
QuestionRe: Process priority Pin
Mark Salsbery14-Jul-08 14:04
Mark Salsbery14-Jul-08 14:04 
AnswerRe: Process priority Pin
locoone14-Jul-08 15:10
locoone14-Jul-08 15:10 
AnswerRe: Process priority Pin
tataxin14-Jul-08 15:21
tataxin14-Jul-08 15:21 
GeneralRe: Process priority Pin
locoone14-Jul-08 15:26
locoone14-Jul-08 15:26 
QuestionDesign Question: Only Bitmap or JPEG ? Pin
gabbana14-Jul-08 11:01
gabbana14-Jul-08 11:01 
AnswerRe: Design Question: Only Bitmap or JPEG ? Pin
Mark Salsbery14-Jul-08 13:40
Mark Salsbery14-Jul-08 13:40 
AnswerRe: Design Question: Only Bitmap or JPEG ? Pin
Nelek14-Jul-08 21:16
protectorNelek14-Jul-08 21:16 
GeneralRe: Design Question: Only Bitmap or JPEG ? Pin
gabbana16-Jul-08 4:37
gabbana16-Jul-08 4:37 
GeneralRe: Design Question: Only Bitmap or JPEG ? Pin
Nelek20-Jul-08 23:36
protectorNelek20-Jul-08 23:36 
QuestionCFrameWnd *without* a view [modified] Pin
[d3m0n]14-Jul-08 10:24
[d3m0n]14-Jul-08 10:24 
Questionunresolved external symbol Pin
AndreFratelli14-Jul-08 10:03
AndreFratelli14-Jul-08 10:03 
AnswerRe: unresolved external symbol Pin
led mike14-Jul-08 12:15
led mike14-Jul-08 12:15 
GeneralRe: unresolved external symbol Pin
AndreFratelli14-Jul-08 20:02
AndreFratelli14-Jul-08 20:02 
AnswerRe: unresolved external symbol Pin
Stephen Hewitt14-Jul-08 14:43
Stephen Hewitt14-Jul-08 14:43 
GeneralRe: unresolved external symbol Pin
AndreFratelli14-Jul-08 20:25
AndreFratelli14-Jul-08 20:25 

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.