Click here to Skip to main content
16,016,669 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC-Dll? Pin
Sam_c8-May-07 0:27
Sam_c8-May-07 0:27 
QuestionDll registeration failed in debug build Pin
tom groezer7-May-07 23:19
tom groezer7-May-07 23:19 
AnswerRe: Dll registeration failed in debug build Pin
Cedric Moonen8-May-07 0:14
Cedric Moonen8-May-07 0:14 
GeneralRe: Dll registeration failed in debug build Pin
tom groezer8-May-07 2:00
tom groezer8-May-07 2:00 
GeneralRe: Dll registeration failed in debug build Pin
Cedric Moonen8-May-07 2:49
Cedric Moonen8-May-07 2:49 
GeneralRe: Dll registeration failed in debug build Pin
tom groezer8-May-07 5:13
tom groezer8-May-07 5:13 
GeneralRe: Dll registeration failed in debug build Pin
Cedric Moonen8-May-07 5:50
Cedric Moonen8-May-07 5:50 
QuestionPrinting Problems [modified] Pin
Nelek7-May-07 23:08
protectorNelek7-May-07 23:08 
Hi all,

I have some problems by printing from my application. The first is that I have to avoid the user choosing page's orientation, I have found one Roger Allen's article (http://www.codeproject.com/printing/customprintdialog.asp[^]) and I think I have understood it right, so it won't be a problem. Then, setting the orientation that every view needs I had the problem that it only worked at the second time, it now works good thanks to this forum and some answers that I found during today. But there is something that I don't understand.

One example says:
if (bRet)
{
// protect memory handle with ::GlobalLock and ::GlobalUnlock
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(m_hDevMode) ;
// set orientation to landscape
pDevMode->dmOrientation = DMORIENT_LANDSCAPE ;
::GlobalUnlock(m_hDevMode) ;
}

And the code I have used (found here too) is:
void CMyView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
if (pDC->IsPrinting ())
{	DEVMODE* devMode = pInfo->m_pPD->GetDevMode ();
	devMode->dmOrientation = DMORIENT_PORTRAIT;
	devMode->dmFields |= DM_ORIENTATION;
	pDC->ResetDC (devMode);
}
CScrollView::OnPrepareDC(pDC, pInfo);
}


Can someone explain me where the two codes differ and which one is better from the aspect of printing compatibility in different printers? Confused | :confused:



And the only problem I can't solve is:
By placing the bitmaps of the elements in my program (is a simulator) I used
void CMyView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
pDC->SetMapMode (MM_LOMETRIC);
CDC dcNormMem;
dcNormMem.CreateCompatibleDC (pDC);

BITMAP bmNormTemp;
CBitmap bmNormIn;
bmNormIn.CreateCompatibleBitmap (pDC, 2 * SIGWIDTH, 2 * SIGHEIGHT);
//...more code 
if (pInfo->m_nCurPage == 1)
{
//Place Inputs
//Ensure that the CBitmap-Object is empty
if (bmNormIn.m_hObject != NULL)
bmNormIn.DeleteObject();
//Load and select the concrete resource
bmNormIn.LoadBitmap (IDB_NORMIN);
bmNormIn.GetObject(sizeof(bmNormTemp), &bmNormTemp);
dcNormMem.SelectObject(&bmNormIn);
//Place a bitmap for every element of the document and its label
for (int nIn = 0; nIn < nTotalIn; nIn++)
{	pDC->StretchBlt (
			2 * pDoc->m_cmlInputSet[nIn].m_cpInCoord.x,
		-50 + (-2 * pDoc->m_cmlInputSet[nIn].m_cpInCoord.y),
			2 * bmNormTemp.bmWidth,
			-2 * bmNormTemp.bmHeight,
			&dcNormMem,
			0,
			0,
			bmNormTemp.bmWidth,
			bmNormTemp.bmHeight,
			SRCCOPY
			);
}
//more code for other elements...
}
//...
}


It was working perfectly in three different printers here in the Firm (one Brother HL-2040 series, one HP DeskJet 930C/932C/935C and one ploter HP Designjet 70). But from one day to the next, the bitmaps didn't come anymore OMG | :OMG: WTF | :WTF: . It is just drawn a point in the corner (top-left) of the bitmap, and nothing more. Text, lines, self-drawn graphics and so on work good.

I suppose it has something to do with DDB and DIB bitmaps, and now I'm creating the function to transform it but... Mad | :mad: Why the hell it was working good during days and suddenly worked no more? Confused | :confused: D'Oh! | :doh: And the thing is pissing me off is that I have tried with the backups of the versions that were working right, but they can not print the Bitmaps as they actually did during days... Confused | :confused:

Can someone tell me the reason? I will try with the conversion in DIB and the StrechDIBBits but I would like to know what happened. D'Oh! | :doh:

Thanks.

Sorry for the large of the message and if I have failures (I'm not english speaker)

EDIT: In Bold



--------
M.D.V.

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?

Question64 bit linking Error. Pin
VC_RYK7-May-07 21:09
VC_RYK7-May-07 21:09 
AnswerRe: 64 bit linking Error. Pin
Gavin Taylor8-May-07 0:11
professionalGavin Taylor8-May-07 0:11 
GeneralRe: 64 bit linking Error. Pin
VC_RYK8-May-07 0:47
VC_RYK8-May-07 0:47 
Questiontab navigation,plz help me Pin
prathuraj7-May-07 21:05
prathuraj7-May-07 21:05 
AnswerRe: tab navigation,plz help me Pin
Hamid_RT7-May-07 21:09
Hamid_RT7-May-07 21:09 
GeneralRe: tab navigation,plz help me Pin
prathuraj7-May-07 21:32
prathuraj7-May-07 21:32 
GeneralRe: tab navigation,plz help me Pin
Rajesh R Subramanian7-May-07 21:48
professionalRajesh R Subramanian7-May-07 21:48 
GeneralRe: tab navigation,plz help me Pin
David Crow8-May-07 2:55
David Crow8-May-07 2:55 
GeneralRe: tab navigation,plz help me Pin
Hamid_RT9-May-07 6:40
Hamid_RT9-May-07 6:40 
AnswerOff topic Pin
Rajesh R Subramanian7-May-07 21:45
professionalRajesh R Subramanian7-May-07 21:45 
GeneralRe: Off topic Pin
prathuraj8-May-07 0:24
prathuraj8-May-07 0:24 
QuestionMessage to Debug window in VC++ IDE Pin
ragavan7-May-07 20:56
ragavan7-May-07 20:56 
AnswerRe: Message to Debug window in VC++ IDE Pin
Stephen Hewitt7-May-07 20:59
Stephen Hewitt7-May-07 20:59 
AnswerRe: Message to Debug window in VC++ IDE Pin
ThatsAlok16-May-07 20:21
ThatsAlok16-May-07 20:21 
QuestionOn-screen keyboard Pin
Mohammad A Gdeisat7-May-07 20:34
Mohammad A Gdeisat7-May-07 20:34 
AnswerRe: On-screen keyboard Pin
Mohammad A Gdeisat8-May-07 3:10
Mohammad A Gdeisat8-May-07 3:10 
AnswerRe: On-screen keyboard Pin
Hans Dietrich8-May-07 3:15
mentorHans Dietrich8-May-07 3:15 

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.