After many days of searching (and not finding) a way to load a JPG from a resource and show it on a dialog based application, I decided to take steps
So I created what I call a very simple and useful class, it can easily be implemented by adding it to a project, and you do not have to be a real JPEG freak and invent all header reading from the beginning (it uses the IPicture interface - same way as Internet Explorer does)
About The Project
I was little carried away with this "ACDSee alike" picture viewer, as it was not my main purpose - I did not have the time to make it "perfect", if you feel lucky and want to improve it here and there then please share it with me.
COPYFREE (F) - ALL RIGHTS FREE
class CPicture
{
public:
void FreePictureData();
BOOL Load(CString sFilePathName);
BOOL Load(UINT ResourceName, LPCSTR ResourceType);
BOOL LoadPictureData(BYTE* pBuffer, int nSize);
BOOL SaveAsBitmap(CString sFilePathName);
BOOL Show(CDC* pDC, CPoint LeftTop, CPoint WidthHeight, int MagnifyX,
int MagnifyY);
BOOL Show(CDC* pDC, CRect DrawRect);
BOOL ShowBitmapResource(CDC* pDC, const int BMPResource,
CPoint LeftTop);
BOOL UpdateSizeOnDC(CDC* pDC);
CPicture();
virtual ~CPicture();
IPicture* m_IPicture;
LONG m_Height;
LONG m_Weight;
LONG m_Width;
};
(.BMP .DIB .EMF .GIF .ICO .JPG .WMF)
CPoint(m_Picture.m_Width, m_Picture.m_Height), 0,0);