Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
I

inlandchris1

@inlandchris1
About
Posts
6
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Printing to exact coordinates on paper or lottery tickets
    I inlandchris1

    That is a good idea, will look into it.

    C / C++ / MFC help tutorial question

  • Printing to exact coordinates on paper or lottery tickets
    I inlandchris1

    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() );
    
    C / C++ / MFC help tutorial question

  • I like C more than I thought I would
    I inlandchris1

    I too is the same, started in C language in 1992 and in a few years, I graduated to C++ and I loved it. However, my last project included over 400,000 lines of MFC/C++ code and a lot of memory. So much memory (CStrings!) it would crash in 2 weeks for no reason. I finally figured out that the CStrings were eating up memory. I changed most of the CStrings with common C language variables (static arrays [], chars etc). More work but running smoothly.

    The Lounge c++ wpf iot

  • has anybody hired developers from this site?
    I inlandchris1

    Quote: laws that prevent you from reducing salaries Does that mean programmers from the same Euro Union? What about contracting from other countries? I am curious because I am a U.S. citizen living in Thailand doing C++ with MFC. Is there a chance of doing contract work in the Euro zone?

    The Lounge com question

  • Windows 11 update...
    I inlandchris1

    Everybody needs to view Linus @ youtube, he has the answers why you can’t upgrade to Win11 and how to work around those restrictions so you Can upgrade. DON’T buy a new PC for Windows 11! - How to install - YouTube[^] Not sure if this link works here.

    The Lounge csharp mobile com question announcement

  • WTAF is going on with my laptop and mouse!!!!!!!! (Win10)
    I inlandchris1

    Just updated windows 10 yesterday and the mouse acted like someone else was using it. I unplugged the RJ45 and still had the problem. Looking deeper, the CPU was maxed out at 100% so not much processing power going to the mouse. After waiting a while, it calmed down and started working ok but took a long time, an hour or so. I think the new update was still working on things in the background so you could do things in the foreground, didnt work.

    The Lounge csharp com collaboration question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups