impression automatique en mfc
Bonjour,
(je programme en mfc avec visual c++)
Je voudrai savoir comment évité la boite de dialogue d'impression lorsque je clic sur l'icone d'impression dans la barre des tache, et imprimé directement sur l'imprimante par defaut du pc, les différent objet tracé dans mon programme.
Mon code est celui créé automatiquement par les mfc dans le view:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| BOOL CImp1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}*/
void CImp1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CImp1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
} |
et j'ai essayé cela aussi (sans resultat)mais a vrai dire je me suis un peu perdu sur la msdn et j'ai rien compris au processus d'impression :
Code:
1 2 3 4 5 6 7
| CPrintDialog
/*void CImp1View::OnPrint( CDC *pDC, CPrintInfo *pInfo )
{
// Print headers and/or footers, if desired.
// Find portion of document corresponding to pInfo->m_nCurPage.
OnDraw( pDC );
} |
merci d'avance...nikus
[utilise plutot la balise [ code ] / nico-pyright(c)]
resolu cool merci mat.M trop la classe !!
bon alors ct bien sa sauf que cdc::Isprinting() n'est pas necessaire et qu'il faut maettre la valeur a true et non a false voila tout simplement ce que j'ai rajouté :
Code:
1 2 3 4 5 6
| BOOL CImp1View::DoPreparePrinting( CPrintInfo* pInfo )
{
pInfo->m_bPreview = true;
return CView::DoPreparePrinting (pInfo);
} |
voila merci baucoup mat.M sa marche !!!!