TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: All
from: Neil Heller
date: 2003-03-29 09:50:00
subject: Printer stuff

I needed a print dialog box in an application I was writing.  The 
documentation said:

"After calling DoModal(), GetDefaults() or GetPrinterDC() a printer DC 
will be returned in m_pd.hDC.  This DC must be freed by the caller of 
CPrintDialog."

Given the following code:

   pprtdlg = new CPrintDialog(false);


   if (pprtdlg->DoModal() == IDOK)
      pcdc->Attach(pprtdlg->GetPrinterDC());

   delete(pprtdlg->m_pd.hDC); <-------- offending line
   delete pprtdlg;

Does anyone have an idea of why the offending line causes a GPF?

þ CMPQwk 1.42 999

--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.