Should I 'delete' this CDC?
Posted
by Binary Worrier
on Stack Overflow
See other posts from Stack Overflow
or by Binary Worrier
Published on 2010-05-19T14:26:46Z
Indexed on
2010/05/19
14:30 UTC
Read the original article
Hit count: 182
Folks, I'm trying to track down an intermittant bug that's showing up on site. I've a feeling it's in some GDI code I'd to cobble together to get a tally printer working.
I'm connfused over how to delete this CDC, my code looks OK to me, but is this correct.
// Create a device context for printing
CDC* dc = new CDC();
if(! dc->CreateDC(safeDriverName.AsBSTR(), safePrinterName.AsBSTR(), NULL, NULL))
{
throw . . .
}
// as I finish with the CDC
dc->DeleteDC();
delete dc;
Do I need delete dc
after dc->DeleteDC();
?
Thanks
© Stack Overflow or respective owner