타이핑의 기억

CE 에서 imaging.lib 이용해서 이미지 출력

unier 2006. 10. 4. 13:55
void DrawImage(HDC hdc)
{
IImagingFactory *pImgFactory = NULL;
IImage *pImage = NULL;
RECT rc = { 좌표 };

// Normally you would only call CoInitialize/CoUninitialize
// once per thread. This sample calls CoInitialize in this
// draw function simply to illustrate that you must call
// CoInitialize before calling CoCreateInstance.
CoInitializeEx(NULL, COINIT_MULTITHREADED);

// Create the imaging factory.
if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_IImagingFactory,
(void **)&pImgFactory)
))
{
// Load the image from the JPG file.
if (SUCCEEDED(pImgFactory->CreateImageFromFile(
TEXT("이미지 경로"),
&pImage)))
{
// Draw the image.
pImage->Draw(hdc, &rc, NULL);
pImage->Release();
}

pImgFactory->Release();
}
CoUninitialize();
}