J'ai un probleme d'assertion en essayant d'imprimer une boite de dialogue
Code:
void CDialogueReservation::OnFilePrint()
{
// TODO: Add your command handler code here
CDialogueImpression Imprim;
...
Initialisation des champs de la boite
...
DWORD dwNeeded, dwReturned ;
HDC hdc ;
PRINTER_INFO_4 * pinfo4 ;
PRINTER_INFO_5 * pinfo5 ;
//sous Windows 98
if (GetVersion () & 0x80000000)
{
EnumPrinters (PRINTER_ENUM_DEFAULT, NULL, 5, NULL,
0, &dwNeeded, &dwReturned) ;
pinfo5 = (PRINTER_INFO_5 *)malloc (dwNeeded) ;
EnumPrinters (PRINTER_ENUM_DEFAULT, NULL, 5, (PBYTE) pinfo5,
dwNeeded, &dwNeeded, &dwReturned) ;
hdc = CreateDC (NULL, pinfo5->pPrinterName, NULL, NULL) ;
free (pinfo5) ;
}
//sous un win NT
else
{
EnumPrinters (PRINTER_ENUM_LOCAL, NULL, 4, NULL,
0, &dwNeeded, &dwReturned) ;
pinfo4 = (PRINTER_INFO_4 *)malloc (dwNeeded) ;
EnumPrinters (PRINTER_ENUM_LOCAL, NULL, 4, (PBYTE) pinfo4,
dwNeeded, &dwNeeded, &dwReturned) ;
hdc = CreateDC (NULL, pinfo4->pPrinterName, NULL, NULL) ;
free (pinfo4) ;
}
pDC = reinterpret_cast<CDC*>(hdc) ;
Imprim.Print(pDC,PRF_CLIENT);
}
J'obtiens un probleme d'assert a l'execution qui me renoie a la ligne suivante
_AFXWIN_INLINE void CWnd::Print(CDC* pDC, DWORD dwFlags) const
{ ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, WM_PRINT, (WPARAM)pDC->GetSafeHdc(), dwFlags); }
Merci de m'aider
Cobra