Click here to Skip to main content
15,890,506 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionc++ file mergesort Pin
lockheart878-Oct-07 13:45
lockheart878-Oct-07 13:45 
QuestionRe: c++ file mergesort Pin
David Crow9-Oct-07 3:27
David Crow9-Oct-07 3:27 
AnswerRe: c++ file mergesort Pin
jhwurmbach9-Oct-07 3:35
jhwurmbach9-Oct-07 3:35 
Questionsetting text on dialog from a subclass Pin
locoone8-Oct-07 13:04
locoone8-Oct-07 13:04 
AnswerRe: setting text on dialog from a subclass Pin
Mark Salsbery8-Oct-07 13:39
Mark Salsbery8-Oct-07 13:39 
GeneralRe: setting text on dialog from a subclass Pin
locoone8-Oct-07 14:03
locoone8-Oct-07 14:03 
GeneralRe: setting text on dialog from a subclass Pin
Mark Salsbery8-Oct-07 14:35
Mark Salsbery8-Oct-07 14:35 
QuestionPrinting array of bitmap files Pin
ShilpaPotnis8-Oct-07 10:34
ShilpaPotnis8-Oct-07 10:34 
I need to print an array of 24 individual bitmap files( about 1.5 inch image each) in array of 4X6 directly to the printer on one page. I can print only one file using foll. code. Is there any way I can use a for loop or any other trick to accomplish this? Please help!

void PrintBitmap(LPCTSTR filename)
{
CPrintDialog printDlg(FALSE);
printDlg.GetDefaults();
// Or get from user:
// if (printDlg.DoModal() == IDCANCEL)
// return;
CDC dc;
if (!dc.Attach(printDlg.GetPrinterDC())) {
AfxMessageBox(_T("No printer found!")); return;
}

dc.m_bPrinting = TRUE;
DOCINFO di;
// Initialise print document details
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = filename;
BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job
// Get the printing extents
// and store in the m_rectDraw field of a
// CPrintInfo object
CPrintInfo Info;
Info.SetMaxPage(1); // just one page
int maxw = dc.GetDeviceCaps(HORZRES);
int maxh = dc.GetDeviceCaps(VERTRES);
//Info.m_rectDraw.SetRect(0, 0, maxw, maxh);
for (UINT page = Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK; page++)
{
dc.StartPage(); // begin new page
Info.m_nCurPage = page;
CBitmap bitmap;
// LoadImage does the trick here, it creates a DIB section
// You can also use a resource here
// by using MAKEINTRESOURCE() ... etc.


//for (int ii=0; ii<2; ii++)

if(!bitmap.Attach(::LoadImage(
::GetModuleHandle(NULL), filename, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE))) {
AfxMessageBox(_T("Error loading bitmap!")); return;
}
BITMAP bm;
bitmap.GetBitmap(&bm);
int w = bm.bmWidth;
int h = bm.bmHeight;
// create memory device context
CDC memDC;

memDC.CreateCompatibleDC(&dc);
CBitmap *pBmp = memDC.SelectObject(&bitmap);
memDC.SetMapMode(dc.GetMapMode());

dc.StretchBlt(0, 0, 2*w, 2*h, &memDC, 0, 0, w, h, SRCCOPY);

// clean up
memDC.SelectObject(pBmp);



bPrintingOK = (dc.EndPage() > 0); // end page
}
if (bPrintingOK)
dc.EndDoc(); // end a print job
else dc.AbortDoc(); // abort job.
}
AnswerRe: Printing array of bitmap files Pin
Mark Salsbery8-Oct-07 11:25
Mark Salsbery8-Oct-07 11:25 
GeneralRe: Printing array of bitmap files Pin
ShilpaPotnis9-Oct-07 3:10
ShilpaPotnis9-Oct-07 3:10 
QuestionVS2005 MFC C++ degugging Pin
Andy H8-Oct-07 9:45
Andy H8-Oct-07 9:45 
AnswerRe: VS2005 MFC C++ degugging Pin
VonHagNDaz8-Oct-07 10:53
VonHagNDaz8-Oct-07 10:53 
Questionhow to implement Pin
snoop828-Oct-07 7:47
snoop828-Oct-07 7:47 
AnswerRe: how to implement Pin
Chris Losinger8-Oct-07 9:42
professionalChris Losinger8-Oct-07 9:42 
GeneralRe: how to implement Pin
led mike8-Oct-07 9:52
led mike8-Oct-07 9:52 
AnswerRe: how to implement Pin
leckey8-Oct-07 10:49
leckey8-Oct-07 10:49 
QuestionRe: how to implement Pin
David Crow9-Oct-07 3:32
David Crow9-Oct-07 3:32 
QuestionPreTranslate Message problem Pin
_tasleem8-Oct-07 6:38
_tasleem8-Oct-07 6:38 
AnswerRe: PreTranslate Message problem Pin
Mark Salsbery8-Oct-07 7:32
Mark Salsbery8-Oct-07 7:32 
GeneralRe: PreTranslate Message problem Pin
_tasleem9-Oct-07 7:23
_tasleem9-Oct-07 7:23 
GeneralRe: PreTranslate Message problem Pin
Mark Salsbery9-Oct-07 7:56
Mark Salsbery9-Oct-07 7:56 
AnswerRe: PreTranslate Message problem Pin
santhoshv848-Oct-07 17:15
santhoshv848-Oct-07 17:15 
GeneralRe: PreTranslate Message problem Pin
chandu0048-Oct-07 22:04
chandu0048-Oct-07 22:04 
Questionradio button Pin
viliam8-Oct-07 6:35
viliam8-Oct-07 6:35 
AnswerRe: radio button Pin
Mark Salsbery8-Oct-07 7:05
Mark Salsbery8-Oct-07 7:05 

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.