Click here to Skip to main content
15,882,802 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: how to bypass loop ? Pin
jschell29-Jan-24 4:38
jschell29-Jan-24 4:38 
Questionhelp me to replace / clean my hack C++ code PLEASE Pin
Salvatore Terress27-Jan-24 4:41
Salvatore Terress27-Jan-24 4:41 
AnswerRe: help me to replace / clean my hack C++ code PLEASE Pin
Richard MacCutchan27-Jan-24 5:17
mveRichard MacCutchan27-Jan-24 5:17 
QuestionFinding a location for a function that would cause it to get called on a constant basis Pin
Calin Negru26-Jan-24 8:32
Calin Negru26-Jan-24 8:32 
AnswerRe: Finding a location for a function that would cause it to get called on a constant basis Pin
k505426-Jan-24 11:17
mvek505426-Jan-24 11:17 
GeneralRe: Finding a location for a function that would cause it to get called on a constant basis Pin
Calin Negru26-Jan-24 22:03
Calin Negru26-Jan-24 22:03 
QuestionHelp me to decipher the error messages Pin
Salvatore Terress20-Jan-24 2:46
Salvatore Terress20-Jan-24 2:46 
AnswerRe: Help me to decipher the error messages Pin
Richard MacCutchan20-Jan-24 3:18
mveRichard MacCutchan20-Jan-24 3:18 
AnswerRe: Help me to decipher the error messages Pin
Dave Kreskowiak20-Jan-24 4:56
mveDave Kreskowiak20-Jan-24 4:56 
AnswerRe: Help me to decipher the error messages Pin
Gerry Schmitz20-Jan-24 6:34
mveGerry Schmitz20-Jan-24 6:34 
AnswerRe: Help me to decipher the error messages Pin
Richard Andrew x6421-Jan-24 11:33
professionalRichard Andrew x6421-Jan-24 11:33 
AnswerRe: Help me to decipher the error messages Pin
CPallini21-Jan-24 20:33
mveCPallini21-Jan-24 20:33 

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.