Bonjour à tous,
j'ai un problème avec l'impression d'une image.
Voici mon code:
CBitmap *Bmp = NULL;
SIZE CadreDest;
HBITMAP g_hBmpSrc = NULL; // bitmap source
BITMAP pBitMap;
char Path[_MAX_PATH];
//Chargement d'une image (bmp ou jpg ou gif) dans un HBITMAP
g_hBmpSrc = LoadAnImage(Path);
//Création d'un CBitmap à partir du HBITMAP
Bmp = CBitmap::FromHandle(g_hBmpSrc);
//Récupération des attributs du CBitmap
Bmp->GetBitmap(&pBitMap);
int w = pBitMap.bmWidth;
int h = pBitMap.bmHeight;
SIZE BMP = {2 * w,2 * h};
//Création du Memory Device Context
CDC memDC;
memDC.CreateCompatibleDC(&dcPrint);
//Sélection du CBitmap
CBitmap *pBmp = memDC.SelectObject(Bmp);
if (pBmp == NULL)
{
AfxMessageBox("Erreur chargement image");
return;
}
//Mise en forme puis Impression du CBitmap
memDC.SetMapMode(dcPrint.GetMapMode());
dcPrint.SetStretchBltMode(COLORONCOLOR);
CadreDest = pts->CalcDim(BMP,500 * NewResX, 500 * NewResY);
dcPrint.StretchBlt(50, OffsetLigne, CadreDest.cx, CadreDest.cy, &memDC, 0, 0, w, h, SRCCOPY);
memDC.SelectObject(pBmp);
Mon problème est que le MessageBox s'affiche et donc que l'image n'est pas 'attachée' à l'imprimante.
Si j'enlève le 'return' pour poursuivre l'impression, il n'y a rien sur la feuille!
Quelqu'un aurait-il la solution?
Merci d'avance
--------------------------------------------------------------------------------
Phantom_2005 
<font color="#0000