Click here to Skip to main content
15,894,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
jschell5-Feb-24 5:33
jschell5-Feb-24 5:33 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress5-Feb-24 6:38
Salvatore Terress5-Feb-24 6:38 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50545-Feb-24 7:10
mvek50545-Feb-24 7:10 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
jschell6-Feb-24 4:40
jschell6-Feb-24 4:40 
Questionstrlen innards Pin
mike74112-Feb-24 12:02
mike74112-Feb-24 12:02 
AnswerRe: strlen innards Pin
Richard MacCutchan2-Feb-24 21:52
mveRichard MacCutchan2-Feb-24 21:52 
AnswerRe: strlen innards Pin
jschell5-Feb-24 5:58
jschell5-Feb-24 5:58 
QuestionMissing "type specifier " ? Pin
Salvatore Terress2-Feb-24 5:37
Salvatore Terress2-Feb-24 5:37 
AnswerRe: Missing "type specifier " ? Pin
Mircea Neacsu2-Feb-24 5:52
Mircea Neacsu2-Feb-24 5:52 
AnswerRe: Missing "type specifier " ? Pin
jschell2-Feb-24 5:53
jschell2-Feb-24 5:53 
GeneralRe: Missing "type specifier " ? Pin
k50542-Feb-24 7:28
mvek50542-Feb-24 7:28 
AnswerRe: Missing "type specifier " ? Pin
RedDk2-Feb-24 7:39
RedDk2-Feb-24 7:39 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 8:02
Salvatore Terress2-Feb-24 8:02 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 9:05
Salvatore Terress2-Feb-24 9:05 
GeneralRe: Missing "type specifier " ? Pin
Mircea Neacsu2-Feb-24 10:44
Mircea Neacsu2-Feb-24 10:44 
GeneralRe: Missing "type specifier " ? Pin
k50542-Feb-24 12:15
mvek50542-Feb-24 12:15 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 15:28
Salvatore Terress2-Feb-24 15:28 
QuestionPreTranslateMessage method is missing Pin
utcode1-Feb-24 16:35
utcode1-Feb-24 16:35 
AnswerRe: PreTranslateMessage method is missing Pin
Victor Nijegorodov1-Feb-24 22:41
Victor Nijegorodov1-Feb-24 22:41 
QuestionPrinting to exact coordinates on paper or lottery tickets Pin
inlandchris11-Feb-24 6:31
inlandchris11-Feb-24 6:31 
How to? I know the basic printing functions and using the CPrintDialog plus PRINTDLG pd,
a little sample that only prints a statement but shows what I am using:

	CPrintDialog dlg(FALSE, pd.Flags);

	if (dlg.DoModal() != IDOK)
	{
		AfxMessageBox("Abort or Unknown Printer or Printer device error");
		return;
	}
	pd.hDC = dlg.CreatePrinterDC();
	ASSERT(pd.hDC !=0);
/////////////////////////////////////////////////////////////////////////////////////////

  
 
		 CDC * dc  = new CDC;

		 dc = CDC::FromHandle(pd.hDC);   
			// Get Height and Width of large character
		int  cxPage = ::GetDeviceCaps (pd.hDC, HORZRES) ;
		int  cyPage = ::GetDeviceCaps (pd.hDC, VERTRES) ;

		sizePrn.cx = cxPage;
		sizePrn.cy = cyPage;


    memset(&lf, 0, sizeof(lf));
	lf.lfHeight = -MulDiv(12, dc->GetDeviceCaps(LOGPIXELSY), 72);//abs(lf.lfHeight)
	lf.lfWeight = FW_BOLD;  //FW_MEDIUM; //;    
    lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
    lf.lfQuality = PROOF_QUALITY; //NEW
    lstrcpy(lf.lfFaceName, "Times New Roman");  //"Courier");
	VERIFY(font.CreateFontIndirect(&lf));

	dc->SetMapMode (MM_ISOTROPIC) ;
    dc->SetWindowExt ( 1000, 1000) ;
    dc->SetViewportExt (cxPage / 2, -cyPage / 2) ;
    dc->SetViewportOrg (cxPage / 2,  cyPage / 2) ;
	dc->SetTextAlign(TA_BASELINE | TA_CENTER);
	dc->SetBkMode(OPAQUE);
	dc->SetMapMode(MM_TEXT);
	dc->PatBlt(0, 0, sizePrn.cx, sizePrn.cy, WHITENESS);
	dc->LPtoDP(&sizePrn);
	dc->SelectObject(&font) ;

     CSize extentChar = dc ->GetTextExtent("M",1);
     int nCharHeight  = extentChar.cy+4;
     int nCharWidth	  = extentChar.cx+10;     
       
   // Begin printing the doc     
    BeginWaitCursor();

	CString printDate = GetMyCurDateTime();

	DOCINFO docinfo;
    memset(&docinfo, 0, sizeof(docinfo));
    docinfo.cbSize = sizeof(docinfo);
    docinfo.lpszDocName = _T("Calif Lottery Winnings");
	docinfo.fwType = 0;


    rc = dc->StartDocA(&docinfo);
	if (rc < 0)
	{
		sprintf(temp, "Unable to Begin printing - Error[%d]", rc);
		MessageBox(temp, NULL, MB_OK);
		dc->ReleaseAttribDC();
		dc->ReleaseOutputDC();
		dc->DeleteTempMap();
		EndWaitCursor();
		DeleteDC(pd.hDC);
		if(pd.hDevMode != NULL)
			GlobalFree(pd.hDevMode);
		if(pd.hDevNames != NULL)
			GlobalFree(pd.hDevNames);
		dc = 0;
		return;
	}
	szTitle=CString("California Lottery System Printout     ") + printDate;
    //Print a Page Header
	dc -> StartPage();
	dc -> SetTextAlign(TA_LEFT | TA_TOP);
	dc -> TextOut(0, 0, szTitle, szTitle.GetLength() );
	dc -> MoveTo( 0, nCharHeight );
	dc -> LineTo(dc -> GetTextExtent(szTitle, szTitle.GetLength()).cx, nCharHeight);
	nStart =1;


And goes on to print 1 page.
What I want to do is to place a non-character on a ticket but not like an 'X' but a block like a pencil fill-in mark at a specific place on the paper. I need to supply the coordinates for the mark and do that for the full page. Has anybody done something like this before? if so, give me some hints.
Thanks
Craig
AnswerRe: Printing to exact coordinates on paper or lottery tickets Pin
Gerry Schmitz1-Feb-24 7:56
mveGerry Schmitz1-Feb-24 7:56 
GeneralRe: Printing to exact coordinates on paper or lottery tickets Pin
inlandchris11-Feb-24 15:12
inlandchris11-Feb-24 15:12 
Questionhow to bypass loop ? Pin
Salvatore Terress28-Jan-24 6:10
Salvatore Terress28-Jan-24 6:10 
AnswerRe: how to bypass loop ? Pin
k505428-Jan-24 6:30
mvek505428-Jan-24 6:30 
QuestionRe: how to bypass loop ? Pin
CPallini28-Jan-24 21:02
mveCPallini28-Jan-24 21:02 

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.