printing problem 
Author Message
 printing problem

We have developed an application which is not using the
MFC Doc/View architecture. Our main window is a dialog
which is used to control different analysis algorithms and
display the results in special designed graphic windows
(which are running in different threads).

Our problem is the printing of the graphic windows. We just
want to create a printer-DC for the default printer. The MFC
(VC5) documentation is not the best information-base and so
i'am not sure if our solution is right.

Our solution:

// create the printer DC
CPrintDialog pd(FALSE);
pd.GetDefaults();
HDC  hDC = pd.GetPrinterDC();
CDC *pDC = CDC::FromHandle(hDC);

.... print the graphics window

// release the printer DC
::DeleteDC(hDC);
::GlobalFree(pd.m_pd.hDevMode);
::GlobalFree(pd.m_pd.hDevNames);
::GlobalFree(pd.m_pd.hDC);
// done

Is this code ok. Please send answers directly to me

Thank you



Sun, 12 Aug 2001 03:00:00 GMT  
 printing problem

Normally I use the following method -

        CPrintDialog dlgPrint(FALSE);
        CDC dc; //for the printer
        HDC hDC;

       // attach  the printer dc
        hDC = dlgPrint.m_pd.hDC;
        dc.Attach(hDC);

//Do whatever printing here

     dc.Detach(); //Finished printing - detach the printer DC

Quote:

>We have developed an application which is not using the
>MFC Doc/View architecture. Our main window is a dialog
>which is used to control different analysis algorithms and
>display the results in special designed graphic windows
>(which are running in different threads).

>Our problem is the printing of the graphic windows. We just
>want to create a printer-DC for the default printer. The MFC
>(VC5) documentation is not the best information-base and so
>i'am not sure if our solution is right.

>Our solution:

>// create the printer DC
>CPrintDialog pd(FALSE);
>pd.GetDefaults();
>HDC  hDC = pd.GetPrinterDC();
>CDC *pDC = CDC::FromHandle(hDC);

>..... print the graphics window

>// release the printer DC
>::DeleteDC(hDC);
>::GlobalFree(pd.m_pd.hDevMode);
>::GlobalFree(pd.m_pd.hDevNames);
>::GlobalFree(pd.m_pd.hDC);
>// done

>Is this code ok. Please send answers directly to me

>Thank you

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.codeguru.com/    The website for Visual C++ programmers.


Sun, 12 Aug 2001 03:00:00 GMT  
 printing problem

Quote:

>Normally I use the following method -

> CPrintDialog dlgPrint(FALSE);
> CDC dc; //for the printer
>        HDC hDC;

>       // attach  the printer dc
> hDC = dlgPrint.m_pd.hDC;
> dc.Attach(hDC);

>//Do whatever printing here

>     dc.Detach(); //Finished printing - detach the printer DC

I have tried this code. May be it works for printing, but if you try to
query device-caps (like: dc.GetDeviceCaps(HORZSIZE)
an assertion occours. Unfortunatly we are using some query-
functions to compute the page-layout.

Nevertheless, thank you for your answer
Anton Noll



Mon, 13 Aug 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Printing Problems (how to print, pause printing, then print more)

2. Rich Edit Control Printing Problem (like the print preview problem)

3. print preview and printing problem

4. Print preview / print problem

5. RichEditCtrl printing problems

6. Printing problem

7. Printing Problem

8. Printing problem ! Please Help

9. Printing problems

10. Printing problem

11. C# Printing Problems

12. print problems

 

 
Powered by phpBB® Forum Software