Re: Printing a dialog box
Check out the WM_PRINT message.
Here's an example (this code from a CDialog-derived class)...
//--------------------------------------------------------------------------------------------------
CWindowDC WindowDC(this);
CDC MemoryDC;
MemoryDC.CreateCompatibleDC(&WindowDC);
CRect WindowRect;
GetWindowRect(&WindowRect);
CBitmap WindowBitmap;
WindowBitmap.CreateCompatibleBitmap(&WindowDC, WindowRect.Width(),
WindowRect.Height());
CBitmap *pOldBitmap = MemoryDC.SelectObject(&WindowBitmap);
SendMessage(WM_PRINT, (WPARAM)(HDC)MemoryDC, PRF_ERASEBKGND | PRF_CHILDREN |
PRF_CLIENT | PRF_NONCLIENT);
//**test
BitBlt(WindowDC,100,100,WindowRect.Width(), WindowRect.Height(), MemoryDC,
0, 0, SRCCOPY);
//**end test
MemoryDC.SelectObject(pOldBitmap);
//--------------------------------------------------------------------------------------------------
Of course, for printing you'd probably want to print the dialog to a printer
DC
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
"Don Dilworth" <Don Dilworth@discussions.microsoft.com> wrote in message
news:FF68FFD5-7817-42C5-9E3D-AEA10B844671@microsoft.com...
My code opens some dialog boxes, with buttons and all the rest, and I draw
some data of my own on the dialog. I want to print the dialog exactly as
it
appears on the screen. But because the dialog is not derived from CView
or
other class that knows how to print, there seems to be no provision for
this
function.
I have succeeded only by recreating the entire thing with a separate
routine
that is not itself a dialog. There must be an easier way. Does anyone
know
how?
I can make a bitmap copy of the screen and paste it into a graphics
program,
but that is a kludge.