Hi Neil,
Can you have a look at this please, I can't figure out why DrawText does not work.
thanks,
Hennie
void SendFile( char *sFile, char *sText ) {
CDC dc;
BYTE *dib, *jpg;
DWORD nchannels, width, height, size=1000000;
CBitmap bm, *pOldBitmap;;
CRect r;
if( DecodeJPGFileToGeneralBuffer( sFile, &width, &height, &nchannels, &dib) ) {
if( dc.CreateCompatibleDC( NULL ) ) {
if( bm.CreateCompatibleBitmap( &dc, width, height ) ) {
bm.SetBitmapBits( width * height * 3, &dib );
pOldBitmap = (CBitmap*) dc.SelectObject(bm);
r.left = 0;
r.top = 0;
r.bottom = height;
r.right = width;
// if( dc.BitBlt( 0, 0, width, height, &dc, 0, 0, SRCCOPY ) ) {
dc.DrawText( sText, -1, r, DT_CENTER );
dc.SelectObject(pOldBitmap);
if( EncodeToJPEGBuffer( dib, width, height, &jpg, &size) ) {
printf( "Content-Length: %ld", size );
printf( "\r\n\r\n" );
fwrite( jpg, sizeof( char ), size, stdout );
free( jpg );
}
// }
}
}
free( dib );
}
}
============================================================
'C' is shorthand for Confusion, 'C++' much more confusion...