1

Topic: The program press from the MFC-appendix

There is a dialogue interface MFC-appendix. How correctly to organize from it the program press of the information on the printer?

2

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> There is a dialogue interface MFC-appendix. RF> how correctly to organize from it the program press of the information on the printer? Well there there is a functional everything, but it is concentrated in CDocument. On idea, it is possible to create the document and to cause its press.

3

Re: The program press from the MFC-appendix

Hello, MasterZiv, you wrote: RF>> There is a dialogue interface MFC-appendix. RF>> how correctly to organize from it the program press of the information on the printer? MZ> well there there is a functional everything, but it is concentrated in CDocument. MZ> On idea, it is possible to create the document and to cause its press. And the following question will be about Print Preview... Press Support is made in Document/View models. The most simple method will alter "the dialogue" MFC-appendix in Document/View. I at all do not imagine for what these are necessary dialogue , except the elementary cases.

4

Re: The program press from the MFC-appendix

Hello, MasterZiv, you wrote: MZ> Well there there is a functional everything, but it is concentrated in CDocument. MZ> On idea, it is possible to create the document and to cause its press. And structure CPrintInfo?

5

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> And structure CPrintInfo? The most simple method will alter "the dialogue" MFC-appendix in Document/View.

6

Re: The program press from the MFC-appendix

Hello, VladFein, you wrote: VF> Hello, RussianFellow, you wrote: RF>> And structure CPrintInfo? VF> VF> the Most simple method will alter "the dialogue" MFC-appendix in Document/View. In this connection at me two questions: 1) whether It is possible to deduce on the printer from the program the text information without usage Document/View? That is there are three lines "1", "2", "3" type char* (or, let us assume, type char [80], or type std:: string). Whether It is possible to deduce them from the program on the printer without usage Document/View? 2) In dialogue application there is one of dialog boxes (which it is activated at button click in other window) and in which there is a multiline text box (type CEdit, CRichEdit or CListCtrl) in which there is a text information. Whether it is possible to anchor somehow to this dialog box object of class CView (or its descendant) that the press through Document/View only for this dialog box (without applying Document/View to all dialogue application) worked?

7

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> 1) whether It is possible to deduce on the printer from the program the text information without usage Document/View? Yes it is possible to send all hands on the press Approximately so: DWORD size = MAX_PATH; TCHAR temp [MAX_PATH]; GetDefaultPrinter (temp, &size); HDC hDc = CreateDC (NULL, temp, NULL, NULL); if (hDc) {DOCINFO docinfo; docinfo.cbSize = sizeof (docinfo); docinfo.lpszDocName = ("Simple"); docinfo.lpszOutput = NULL; docinfo.lpszDatatype = ("EMF"); docinfo.fwType = 0; if (StartDoc (hDc, &docinfo)> 0) {if (StartPage (hDc)> 0) {//the necessary actions EndPage (hDc);} EndDoc (hDc);}} DeleteDC (hDc); the Necessary actions - it is drawable any figures, we deduce the text, all as in normal output agent WM_PAINT, only there with coordinate system and fonts it is necessary to understand still, I already do not remember particulars.

8

Re: The program press from the MFC-appendix

Clearly, thanks! I have a program example which I created: void CPrintSolvedNUDialog:: OnBnClickedOk ()//if there was a pushed button "Press" {//TODO: add the code of the output agent of notification messages int i, n; CString myString; LPCSTR pzText; DWORD size = MAX_PATH; TCHAR temp [MAX_PATH]; m_IDC_EDIT1.GetWindowTextA (myString); n = myString. GetLength (); pzText = (LPCSTR) myString; GetDefaultPrinter (temp,&size); HDC hDC = CreateDC (NULL, temp, NULL, NULL); if (hDC) {DOCINFO docinfo; docinfo.cbSize = sizeof (docinfo); docinfo.lpszDocName = "Simple"; docinfo.lpszOutput = NULL; docinfo.lpszDatatype = "EMF"; docinfo.fwType = 0; if (StartDoc (hDC,&docinfo)> 0) {if (StartPage (hDC)> 0) {TextOut (hDC, 0,0, pzText, 80); EndPage (hDC);} EndDoc (hDC);} DeleteDC (hDC);} CDialogEx:: OnOK ();} This example works. But it works for the single line which is in multiline text box CEdit. And how correctly to make so that this example worked and for those cases when in text box CEdit there are some lines? Whether it is necessary to make a cycle of reading of lines from m_IDC_EDIT1 (CEdit) inside if (StartPage (hDC> 0)) {//...} and in the same place to print them, or the cycle of reading of lines from m_IDC_EDIT1 is better for making before HDC hDC = CreateDC (NULL, temp, NULL, NULL); - to write down them in an array of lines, and inside if (StartPage (hDC> 0)) {//...} to work with this array of lines? The number of deduced lines approximately is equal 55 - 60 so all of them  to go in on one sheet.

9

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> to work with this array of lines? RF> the number of deduced lines approximately is equal 55 - 60 so all of them  to go in on one sheet. You look for examples of drawing by means of GDI. If I correctly remember, DrawText can transfer the text in the given area. It is possible to estimate also minimum necessary size of area by means of functions from this families. But generally, it is all very much  and it is inconvenient. The document can have fields, they can be the different sizes, sheet orientation can be different, it is you all are obliged to consider. I on your place would try to draw an output in Word, or is simple in RTF, or in HTML.

10

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> This example works. But it works for the single line which is in multiline text box CEdit. RF> And how correctly to make so that this example worked and for those cases when in text box CEdit there are some lines? Yes it is perfect  how to receive a line, easier what for to copy a line in the temporary buffer? Waste of time In a cycle to receive and there and then to deduce. Only it is all it makes sense for really primitive documents in pair lines if the document structure is supposed though a little difficult - to use any ready means better. The report generator any, for MFC like was Crystal Reports, or to pass on doc/view, there there is a variant when twist will be dialogue, complexities special should not arise. RF> the number of deduced lines approximately is equal 55 - 60 so all of them  to go in on one sheet. At such approach only the hardcore - all should be considered most, the sizes of lines, the sizes of indents, font height It [is etc. added] Still it is possible instead of CEdit to use CRichEditCtrl, it like has a possibility to deduce a text piece on the printer

11

Re: The program press from the MFC-appendix

Here this example works for me: I fill mine m_IDC_EDIT1 in five identical lines on 80 characters: BOOL CPrintSolvedNUDialog:: OnInitDialog () {char s [1024]; CDialog:: OnInitDialog (); strcpy (s, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab"); strcat (s, "\r\n"); strcat (s, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab"); strcat (s, "\r\n"); strcat (s, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab"); strcat (s, "\r\n"); strcat (s, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab"); strcat (s, "\r\n"); strcat (s, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab"); m_IDC_EDIT1.SetWindowTextA (s); return TRUE;} Also I produce them on the press: void CPrintSolvedNUDialog:: OnBnClickedOk ()//if there was a pushed button "Press" {//TODO: add the code of the output agent of notification messages int i, n, cyChar, cyPage, yPos; CString myString; LPCSTR pzText; LPTSTR lpszText; DWORD size = MAX_PATH; TCHAR temp [MAX_PATH]; TEXTMETRIC txtm; m_IDC_EDIT1.GetWindowTextA (myString); lpszText = "";//n = myString. GetLength (); n = m_IDC_EDIT1.GetLineCount (); pzText = (LPCSTR) myString; GetDefaultPrinter (temp,&size); HDC hDC = CreateDC (NULL, temp, NULL, NULL); if (hDC) {cyPage = GetDeviceCaps (hDC, VERTRES); GetTextMetrics (hDC,&txtm); cyChar = txtm.tmHeight + txtm.tmExternalLeading; yPos = 0; DOCINFO docinfo; docinfo.cbSize = sizeof (docinfo); docinfo.lpszDocName = "Simple"; docinfo.lpszOutput = NULL; docinfo.lpszDatatype = "EMF"; docinfo.fwType = 0; if (StartDoc (hDC,&docinfo)> 0) {if (StartPage (hDC)> 0) {//TextOut (hDC, 0,0, pzText, 80); for (i=0; i <n; i ++) {//m_IDC_EDIT1.GetLine (i, lpszText); int len = m_IDC_EDIT1.LineLength (i); m_IDC_EDIT1.GetLine (i, myString. GetBuffer (len), len); myString. ReleaseBuffer (); myString = myString + "\r\n"; pzText = myString. GetBuffer (); TextOut (hDC, 0, yPos, pzText, 80); yPos + = cyChar;} EndPage (hDC);} EndDoc (hDC);} DeleteDC (hDC);} CDialogEx:: OnOK ();} five identical lines are as a result deduced on the printer!

12

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> Here this example works for me: Yes from what to it not to work? I about other that if wants  - problems begin.

13

Re: The program press from the MFC-appendix

Such question: how to set font name, dimensionality of a font, attributes of a font (a normal font, a thick font, an oblique font) which will be printed? And whether it is possible to set distance between lines which are printed?

14

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> Such question: how to set font name, dimensionality of a font, attributes of a font (a normal font, a thick font, an oblique font) which will be printed? And whether it is possible to set distance between lines which are printed? To create a context to Create a font with necessary attributes to Load a font in an executable context, receiving a descriptor of the preempted object to Draw a line/line to Load the old saved descriptor to Delete a font to Delete a context You examples looked?

15

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> Such question: how to set font name, dimensionality of a font, attributes of a font (a normal font, a thick font, an oblique font) which will be printed? CrteateFont - there all parameters of a font are set. RF> and whether it is possible to set distance between lines which are printed? Certainly it is possible, in your example the distance between lines is set by this expression yPos + = cyChar; Change cyChar and will be either more or less distance Generally printing practically does not differ from drawing on the screen, is simple in case of the press the printer context is used.

16

Re: The program press from the MFC-appendix

Hello, Evgeniy Skvortsov, you wrote: ES> Generally printing practically does not differ from drawing on the screen, is simple in case of the press the printer context is used. And white on black on the printer it is already possible to write?

17

Re: The program press from the MFC-appendix

Hello, VladFein, you wrote: VF> And white on black on the printer it is already possible to write? Make a black background and draw white letters,  problems?

18

Re: The program press from the MFC-appendix

Hello, Evgeniy Skvortsov, you wrote: ES> I about other that if wants  - problems begin. Yes, problems at me began. Here my code: the Designer of class CPrintSolvedNUDialog (the empty designer): CPrintSolvedNUDialog::CPrintSolvedNUDialog (CWnd* pParent / * = NULL*/): CDialogEx (CPrintSolvedNUDialog:: IDD, pParent) {} Function setOutputInfo class CPrintSolvedNUDialog - transmission to structure dialogue aps type addparstruct in which fields, for an output in a text window of dialogue contain many: void CPrintSolvedNUDialog:: setOutputInfo (addparstruct aps) {this-> aps = aps;} Function OnInitDialog of class CPrintSolvedNUDialog in which information output from structure aps in a multiline text box (class CEdit) is carried out: BOOL CPrintSolvedNUDialog:: OnInitDialog () {char s [7000], s2 [160]; int i, n; long double val1, val2, val3; string str; CDialog:: OnInitDialog (); strcpy (s, ""); strcpy (s2, "Results of the decision of a boundary value problem on determination of orbit  \r\n"); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "the Measured interval (date/time): %s \r\n", aps.measuresinterval); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "the Used measurements: \r\n"); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "Types It is considered Is included Allocation on time (ET)  dispersion (O-C) \r\n"); n = aps.typeofmeasinterval.size (); if (n> 0) {for (i=0; i <n; i ++) {str = (string) (aps.typeofmeasinterval.at (i)); strcpy (s2, str.c_str ()); strcat (s, s2); strcat (s, "\r\n");} } sprintf (s2, "All %d %d %s \r\n" ,aps.nummeas,aps.nummeas,aps.measuresinterval); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "the Amount of the fulfilled iterations: %d \r\n", aps.nummeas); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "the Coordination of measurements: sigma0 = %.6f \r\n"); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "Specified WELL Corrections to initial WELL  WELL (1 sigma) \r\n"); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "t %s\r\n", aps.stNU); strcat (s, s2); sprintf (s2, "x (km) of %.15le %.15le %.9le \r\n", aps.x, aps.deltax, aps. SKOx); strcat (s, s2); sprintf (s2, "y (km) of %.15le %.15le %.9le \r\n", aps.y, aps.deltay, aps. SKOy); strcat (s, s2); sprintf (s2, "z (km) of %.15le %.15le %.9le \r\n 15le %.15le %.9le \r\n ", aps. Vx, aps.deltaVx, aps. SKOVx); strcat (s, s2); sprintf (s2," Vy (km) of %.15le %.15le %.9le \r\n ", aps. Vy, aps.deltaVy, aps. SKOVy); strcat (s, s2); sprintf (s2," Vz (km) of %.15le %.15le %.9le \r\n ", aps. Vz, aps.deltaVz, aps. SKOVz); strcat (s, s2); n = aps. Sbarray.size (); if (n> 0) {//output Sb} n = aps.kappaarray.size (); if (n> 0) {//an output kappa;} n = aps. Vimparray.size (); if (n> 0) {for (i=0; i <n/3; i ++) {val1 = (long double) (aps. Vimparray.at (i*3)); val2 = (long double) (aps. Vimparray.at (i*3+1)); val3 = (long double) (aps. Vimparray.at (i*3+2)); sprintf (s2," dV%dx (km/s) of %.15le %.15le %.9le \r\n ", i+1, val1, val2, val3); strcat (s, s2);} } sprintf (s2, "\r\n"); strcat (s, s2); sprintf (s2, "Mean squared errors in orbital system RNB \r\n"); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "sigma r (km) sigma n (km) sigma b (km) sigmaVr (km/s) sigmaVn (km/s) sigmaVb (km/s) \r\n"); strcat (s, s2); sprintf (s2, "%.5le %.5le %.5le %.5le %.5le %.5le \r\n" ,aps.sigmar,aps.sigman,aps.sigmab,aps.sigmaVr,aps.sigmaVn,aps.sigmaVb); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "Specification of elements of an orbit \r\n"); strcat (s, s2); strcpy (s2, "\r\n"); strcat (s, s2); sprintf (s2, "a (km) of %.15le %.9le %.9le \r\n", aps.a, aps.deltaa, aps. SKOa); strcat (s, s2); sprintf (s2, "e %.15le %.9le %.9le \r\n", aps.e, aps.deltae, aps. SKOe); strcat (s, s2); sprintf (s2, "i (hailstones) of %.15le %.9le %.9le \r\n", aps.ild, aps.deltaild, aps. SKOild); strcat (s, s2 9le \r\n ", aps. Omega, aps.deltaOmega, aps. SKOOmega); strcat (s, s2); sprintf (s2," w (hailstones) of %.15le %.9le %.9le \r\n ", aps.omega, aps.deltaomega, aps. SKOomega); strcat (s, s2); sprintf (s2," tpi %s %.4fs %.4fs \r\n ", aps.stpi, aps.deltaperiod, aps. SKOtpi); strcat (s, s2); sprintf (s2," the Period %s %.4fs %.4fs \r\n ",aps.period,aps.deltaperiod,aps.SKOperiod); strcat (s, s2); strcpy (s2,"\r\n"); strcat (s, s2); sprintf (s2," Correlation matrix of elements Kq \r\n "); strcat (s, s2); sprintf (s2," an e i W w tpi \r\n "); strcat (s, s2); sprintf (s2," a %.7f %.7f %.7f %.7f %.7f %.7f \r\n ", aps.covmatr [0], aps.covmatr [1], aps.covmatr [2], aps.covmatr [3], aps.covmatr [4], aps.covmatr [5]); strcat (s, s2); sprintf (s2," e %.7f %.7f %.7f %.7f %.7f %.7f \r\n ", aps.covmatr [6], aps.covmatr [7], aps.covmatr [8], aps.covmatr [9], aps.covmatr [10], aps.covmatr [11]); strcat (s, s2); sprintf (s2, "i %.7f %.7f %.7f %.7f %.7f %.7f \r\n", aps.covmatr [12], aps.covmatr [13], aps.covmatr [14], aps.covmatr [15], aps.covmatr [16], aps.covmatr [17]); strcat (s, s2); sprintf (s2, "W %.7f %.7f %.7f %.7f %.7f %.7f \r\n", aps.covmatr [18], aps.covmatr [19], aps.covmatr [20], aps.covmatr [21], aps.covmatr [22], aps.covmatr [23]); strcat (s, s2); sprintf (s2, "w %.7f %.7f %.7f %.7f %.7f %.7f \r\n", aps.covmatr [24], aps.covmatr [25], aps.covmatr [26], aps.covmatr [27], aps.covmatr [28], aps.covmatr [29]); strcat (s, s2); sprintf (s2, "tpi %.7f %.7f %.7f %.7f %.7f %.7f \r\n", aps.covmatr [30], aps.covmatr [31], aps.covmatr [32], aps.covmatr [33], aps.covmatr [34], aps.covmatr [35]); strcat (s, s2); m_IDC_EDIT1.SetWindowTextA (s Function OnBnClickedOk of class CPrintSolvedNUDialog - in it is carried out the information output, being in a multiline text box (class CEdit) on the printer: void CPrintSolvedNUDialog:: OnBnClickedOk ()//if there was a pushed button "Press" {//TODO: add the code of the output agent of notification messages int i, n, cyChar, cyPage, yPos; CString myString; LPCSTR pzText; LPTSTR lpszText; DWORD size = MAX_PATH; TCHAR temp [MAX_PATH]; TEXTMETRIC txtm; m_IDC_EDIT1.GetWindowTextA (myString); lpszText = "";//n = myString. GetLength (); n = m_IDC_EDIT1.GetLineCount (); pzText = (LPCSTR) myString; GetDefaultPrinter (temp,&size); HDC hDC = CreateDC (NULL, temp, NULL, NULL); if (hDC) {cyPage = GetDeviceCaps (hDC, VERTRES); GetTextMetrics (hDC,&txtm); cyChar = txtm.tmHeight + txtm.tmExternalLeading; yPos = 0; DOCINFO docinfo; docinfo.cbSize = sizeof (docinfo); docinfo.lpszDocName = "Simple"; docinfo.lpszOutput = NULL; docinfo.lpszDatatype = "EMF"; docinfo.fwType = 0; if (StartDoc (hDC,&docinfo)> 0) {if (StartPage (hDC)> 0) {//TextOut (hDC, 0,0, pzText, 80); for (i=0; i <n; i ++) {//m_IDC_EDIT1.GetLine (i, lpszText); int len = m_IDC_EDIT1.LineLength (i); if (len> 0) {m_IDC_EDIT1.GetLine (i, myString. GetBuffer (len), len); myString. ReleaseBuffer ();} else myString = ""; myString = myString + "\r\n"; pzText = myString. GetBuffer (); TextOut (hDC, 0, yPos, pzText, 90); yPos + = cyChar;} EndPage (hDC);} EndDoc (hDC);} DeleteDC (hDC);} CDialogEx:: OnOK ();} And the problem consists in the following: instead of a normal output of lines at me on the press something is deduced type Results of the decision of a boundary value problem on determination of orbit  Measured ?  <<<<<<<<<<<<<<<<; M} WNet Provider Class <<<<<<<<<<<<<<<<<<<<the Measured interval (date/time): 2017.04.22/01:06: 9.184 - 2017.0<<<<<<<<<<<<<<<<?<<<<<<<< ; M} WNet Provider Class <<<<<<<<D | 1452HHHHHHHHHHH <<<<<<<< V | 1452HHHHHHHHHHH <<<<<<<< <<<<<<<<?  <<<<<<<<; M {WNet Provider Class That is at me are not printed correctly passages to new lines, lines not always deduced completely (though length of any of deduced lines of less than 80 characters), blank lines are not deduced - but the abracadabra is deduced. In what the reason of it? Whether it is possible to solve this problem and if yes as it to solve?

19

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: the Error most likely in your infernal trick with obtaining of lines. I tried to collect this piece, but it is not compiled at all, there a heap of errors as at you it is launched, I (likely at you the project not ) Launch under a debugger and look that appears in pzText before call TextOut.

20

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> That is at me passages to new lines, lines not always are not printed correctly deduced completely (though length of any of deduced lines of less than 80 characters), blank lines are not deduced - but the abracadabra is deduced. int len = m_IDC_EDIT1.LineLength (i); if (len> 0) {m_IDC_EDIT1.GetLine (i, myString. GetBuffer (len), len); myString. ReleaseBuffer ();} else myString = ""; myString = myString + "\r\n";//<is superfluous pzText = myString. GetBuffer (); TextOut (hDC, 0, yPos, pzText, len);//<- here it is necessary to specify length of a line, instead of 90

21

Re: The program press from the MFC-appendix

And still a question: how program to produce on the press text a file from the MFC-appendix?

22

Re: The program press from the MFC-appendix

And at me a question: how to carry out the program press  the text?

23

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: RF> And still a question: how program to produce on the press text a file from the MFC-appendix? I think. That it is not difficult. Read file contents in  CEdit and print its standard methods. The help: CEdit - successor CWnd.

24

Re: The program press from the MFC-appendix

Hello, RussianFellow, you wrote: And still a question: RF> Function OnBnClickedOk of class CPrintSolvedNUDialog - in it is carried out the information output, being in a multiline text box (class CEdit) on the printer: RF> RF> void CPrintSolvedNUDialog:: OnBnClickedOk () RF>//if there was a pushed button "Press" RF> {RF>//TODO: add the code of the output agent of notification messages RF> int i, n, cyChar, cyPage, yPos; RF> CString myString; RF> LPCSTR pzText; RF> LPTSTR lpszText; RF> DWORD size = MAX_PATH; RF> TCHAR temp [MAX_PATH]; RF> TEXTMETRIC txtm; RF> m_IDC_EDIT1.GetWindowTextA (myString); RF> lpszText = ""; RF>//n = myString. GetLength (); RF> n = m_IDC_EDIT1.GetLineCount (); RF> pzText = (LPCSTR) myString; RF> GetDefaultPrinter (temp,&size); RF> HDC hDC = CreateDC (NULL, temp, NULL, NULL); RF> if (hDC) RF> {RF> cyPage = GetDeviceCaps (hDC, VERTRES); RF> GetTextMetrics (hDC,&txtm); RF> cyChar = txtm.tmHeight + txtm.tmExternalLeading; RF> yPos = 0; RF> DOCINFO docinfo; RF> docinfo.cbSize = sizeof (docinfo); RF> docinfo.lpszDocName = "Simple"; RF> docinfo.lpszOutput = NULL; RF> docinfo.lpszDatatype = "EMF"; RF> docinfo.fwType = 0; RF> if (StartDoc (hDC,&docinfo)> 0) RF> {RF> if (StartPage (hDC)> 0) RF> {RF>//TextOut (hDC, 0,0, pzText, 80); RF> for (i=0; i <n; i ++) RF> {RF>//m_IDC_EDIT1.GetLine (i, lpszText); RF> int len = m_IDC_EDIT1.LineLength (i); RF> if (len> 0) RF> {RF> m_IDC_EDIT1.GetLine (i, myString. GetBuffer (len), len); RF> myString. ReleaseBuffer (); RF>} RF> else RF> myString = ""; RF> myString = myString + "\r\n"; RF> pzText = myString. GetBuffer (); RF> TextOut (hDC, 0, yPos, pzText, 90); RF> yPos + = cyChar; RF>} RF> EndPage (hDC); RF>} RF> EndDoc (hDC); RF> RF>} RF> the Question consists in the following: how to set a certain font for the press (for example, Courier New) with the certain size (height) - for example, 10?

25

Re: The program press from the MFC-appendix

Hello, Nikita123, you wrote: N> I think. That it is not difficult. Read file contents in  CEdit and print its standard methods. N> the help: CEdit - successor CWnd. I solved it in another way (a code fragment): if (StartDoc (hDC,&docinfo)> 0) {if (StartPage (hDC)> 0) {f = fopen ("results.txt", "rt"); while (! feof (f)) {fgets (s, 256, f); len = strlen (s); pzText = (LPCSTR) s; TextOut (hDC, 0, yPos, pzText, len); yPos + = cyChar;} fclose (f); EndPage (hDC);} EndDoc (hDC);}