Print a long CString
-
Hi, I have a C++ program with MFC. I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut(). That is working the first time I print. If I repeat the print job, the page is blank. I don't understand why. Here is a portion of OnPrint(): CString resToken; I print the Cstring one line at a time. pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); Does it have a better way to do the printing? Why the page is blank the second time? Do I have to reset something? Thanks,
-
Hi, I have a C++ program with MFC. I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut(). That is working the first time I print. If I repeat the print job, the page is blank. I don't understand why. Here is a portion of OnPrint(): CString resToken; I print the Cstring one line at a time. pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); Does it have a better way to do the printing? Why the page is blank the second time? Do I have to reset something? Thanks,
From things you've said, I think you're talking about printing on paper instead of a screen. There is indeed a process to follow when doing so, it involves telling the print sub-system that you've printed a page and wish to print another in the same print-job. If indeed producing a hard-copy output is your aim, you may find the following of some use: Answer --> I want to print an image from a class library project without any gui.[^] You can and should enumerate the available printers in your system and allow the user to choose from them. In this example, I've simply used the printer's name, as seen in
Control Panel\Hardware and Sound\Devices and Printers
in Win7."When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
-
Hi, I have a C++ program with MFC. I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut(). That is working the first time I print. If I repeat the print job, the page is blank. I don't understand why. Here is a portion of OnPrint(): CString resToken; I print the Cstring one line at a time. pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); Does it have a better way to do the printing? Why the page is blank the second time? Do I have to reset something? Thanks,