GrahamRounce
August 2nd, 2005, 09:06 AM
Hi - I've been a few days trying to debug this problem, and have made it show up "to order" in the following code, which looks like it can't be wrong to me, but.... (I get the printer hdc from PrintDlg):
if ( (GetDeviceCaps(hDC,RASTERCAPS) & RC_BITBLT) == RC_BITBLT ) {
MessageBox(NULL, "BitBlt supported", textString, MB_OK);
TextOut( hDC, 75, 150, "FROMHERE", 8);
if (!BitBlt( hDC, 0, 0, 121, 52, hDC, 75, 150, SRCCOPY)) {
sprintf(debBuf, "BitBlt failed. Last error=%d", GetLastError());
MessageBox(NULL, debBuf, textString, MB_OK);
} else {
MessageBox(NULL, "BitBlt was OK", textString, MB_OK);
}
}
It should copy the "FROMHERE" to the top left corner of the page, but I get the "BitBlt failed" message box - but with a Last Error of zero!
(This does work though:
TextOut(hDC, 0, 0, "FROMHERE", 8);
but I need to do the BitBlting, and StretchBlting, too, if I can get that far!)
Thanks for any help,
Graham
if ( (GetDeviceCaps(hDC,RASTERCAPS) & RC_BITBLT) == RC_BITBLT ) {
MessageBox(NULL, "BitBlt supported", textString, MB_OK);
TextOut( hDC, 75, 150, "FROMHERE", 8);
if (!BitBlt( hDC, 0, 0, 121, 52, hDC, 75, 150, SRCCOPY)) {
sprintf(debBuf, "BitBlt failed. Last error=%d", GetLastError());
MessageBox(NULL, debBuf, textString, MB_OK);
} else {
MessageBox(NULL, "BitBlt was OK", textString, MB_OK);
}
}
It should copy the "FROMHERE" to the top left corner of the page, but I get the "BitBlt failed" message box - but with a Last Error of zero!
(This does work though:
TextOut(hDC, 0, 0, "FROMHERE", 8);
but I need to do the BitBlting, and StretchBlting, too, if I can get that far!)
Thanks for any help,
Graham