Hi Yury, following your advice I succeeded using AlphaBlend function
Yet unfortunatelly, using AlphaBlend with ImageDecompress unit seems a no way as the Alpha channel is lost when loading the image :cry:
Furthermore it seems that DecompressImageIndirect used in ImageDecompress is going to be deprecated and starting from WM5 and above it is advised to use Image Factory :
HBITMAP LoadImageWithImagingApi(const CString &strFileName)
{
IImagingFactory *pImgFactory = NULL;
IImage *pImage = NULL;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
HBITMAP hResult = 0;
if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_IImagingFactory,
(void **)&pImgFactory)))
{
ImageInfo imageInfo;
if (SUCCEEDED(pImgFactory->CreateImageFromFile(strFileName, &pImage))
&& SUCCEEDED(pImage->GetImageInfo(&imageInfo)))
{
CWindowDC dc(0);
CDC dcBitmap;
dcBitmap.CreateCompatibleDC(&dc);
hResult = CreateCompatibleBitmap(dc.GetSafeHdc(), imageInfo.Width, imageInfo.Height);
if (hResult) {
HGDIOBJ hOldBitmap = dcBitmap.SelectObject(hResult);
pImage->Draw(dcBitmap.GetSafeHdc(), CRect(0, 0, imageInfo.Width, imageInfo.Height), NULL);
dcBitmap.SelectObject(hOldBitmap);
}
pImage->Release();
}
pImgFactory->Release();
}
CoUninitialize();
return hResult;
}
is it possible to translate this code to pascal / Lazarus / Kol CE ?
Thank you for your help !