PJPEG);
typedef void (__stdcall* DRAWJPEGIMAGE)(HDC,int,int,PJPEG);
class CTDlg : public CDialog
{
public:
HINSTNACE m_hLib;
CREATEJPEGIMAGE pCreateJPEGImage;
LOADJPEGIMAGE pLoadJPEGImage;
FREEJPEGIMAGE pFreeJPEGImage;
DRAWJPEGIMAGE pDrawJPEGImage;
}
BOOL CTDlg::OnInitDialog()
{
m_hLib = LoadLibrary("ImageLib.dll");
pCreateJPEGImage = (CREATEJPEGIMAGE)GetProcAddress(m_hLib,"CreateJPEGImage");
pLoadJPEGImage = (LOADJPEGIMAGE)GetProcAddress(m_hLib,"LoadJPEGImage");
pFreeJPEGImage = (FREEJPEGIMAGE)GetProcAddress(m_hLib,"FreeJPEGImage");
pDrawJPEGImage = (DRAWJPEGIMAGE)GetProcAddress(m_hLib,"DrawJPEGImage");
}
void CTDlg::OnDestroy()
{
if (m_hLib)
FreeLibrary(m_hLib);
}
void CTDlg::OnPaint()
{
CPaintDC dc(this);
PJPEG pJPEG;
pJPEG = (*pCreateJPEGImage)();
if (pJPEG)
{
if ((*pLoadJPEGImage)(pJPEG,"c:\\test.jpg"))
(*pDrawJPEGImage)(dc.m_hDC,0,0,pJPEG);
(*pFreeJPEGImage)(pJPEG);
}
}