I have a problem with Debug Assertion Failed (picture) Debug Assertion Failed This problem occur when I push "Print" button on dialog box a second time. (on first time work well) Dialog Box: Dialog Box
After debugging code I guess it is caused when I create DC second time. But I can explain why, because ealier I delete DC by DeleteDC() function. Below I put snippets of code when I initialize DC and delete DC.
BOOL Druk::StartPrint()
{
//Configuration();
hDC.CreateDC(DriverName, DeviceName, OutputName, NULL);
StartDoc(hDC, NULL);
//StartPage(hDC);
return TRUE;
}
BOOL Druk::ZakonczDruk()
{
EndDoc(hDC);
//EndPage(hDC);
DeleteDC(hDC);
return TRUE;
}
It looks like you are using MFC's CDC
class, evidenced by
hDC.CreateDC(DriverName, DeviceName, OutputName, NULL);
For symmetry sake, delete it also by that class' method: CDC::DeleteDC
hDC.DeleteDC();