Printing JPG bitmap

I need to print jpg files, the following
code works with bmp files but not jpg.  Thank you in advance.

LPCTSTR thebmp;
thebmp="c:\\nameit.jpg";
CBitmap bjg;
bjg.Attach(::LoadImage(NULL,thebmp,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_DEFAULTSIZE));
CPoint p;
p.x=100;
p.y=100;
CSize s;
s.cx=1700;
s.cy=1400;
pDC->DrawState(p,s,&bjg,NULL,NULL);
CRecordView::OnPrint(pDC, pInfo);
binstarAsked:
Who is Participating?
 
AlexVirochovskyConnect With a Mentor Commented:
You don't react!
For this i think, that one of those
URL helps you.
Alex
0
 
bbousquetCommented:
I'm pretty sure LoadImage works with BMP files only (well, icons and cursors too). Therefore if I'm not mistaken you'll have to get a hold of a picture conversion package (maybe Win32 can do something about that but I don't think LoadImage will load a JPG (or GIF, TIF, etc.) by itself.
0
 
hongjunCommented:
Can you list down what header files have you included?

hongjun
0
 
hongjunCommented:
Can you list down what header files have you included?

hongjun
0
 
AlexVirochovskyCommented:
LoadImage don't work with jpg. You need
specific code for this. There are many
free source, see, for example,
            CImage Class for RAW, JIFF, GIF, JPG, PNG
http://www.visualc.com/default.asp?activex=&web=Download&lang=en&htype=&dlname=cimage.zip
            Nviewlib - Jpeg, GIF, BMP, RLE, DIB, PCX, TGA viewer DLL
http://home.att.net/~knishita/nviewlib.htm
 Or
            //See GIF/JPG files
http://www.vsce.com/src_code/faq_source_code.html
http://www.ijg.org
or PaintLib
www.paintlib.de , www.paintlib.com
Or
home.wxs.nl/~flvdberg
Or ...
0
All Courses

From novice to tech pro — start learning today.