Print Page | Close Window

Changes to imagemanager, missing functionality

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9593
Printed Date: 22 July 2025 at 9:10am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Changes to imagemanager, missing functionality
Posted By: Janomat
Subject: Changes to imagemanager, missing functionality
Date Posted: 15 February 2008 at 8:41am
Hi there,

while appreciating the changes in the imagemanager in reducing the amount of needed handles for storing all the content iīm missing some functionality.
In Toolkit 10.4 it was possible to extract the hbitmap or hicon from the imagemanager, depending on the way the image was stored in the imagemanger, with the following code.

    CXTPImageManagerIcon icon = XTPImageManager()->GetImage(IDC_MYICON, 16);
    CXTPImageManagerIconHandle xtphIcon = icon.GetIcon();
    HBITMAP hBitmap = xtphIcon.GetBitmap();
    HICON hIcon = xtphIcon.GetIcon();

Now it is absolutly impossible to get these informations from the imagemanager. This leads to the need of storing hbitmaps and hicons in seperate stores having the side effect of even more handle allocations.

Why doesnīt the Imagemanager store appropriate functionality to create hbitmap and hicon from itīs internal store.

Am i missing something?

Thanks for reading so far, hoping for your answers :)

Jan





Replies:
Posted By: Oleg
Date Posted: 17 February 2008 at 5:04am

Hi,

 
Just copy it to som fre handle:
 
CXTPImageManagerIconHandle xtphIcon = icon.GetIcon();
CXTPImageManagerIconHandle hIconFree;
hIconFree.CopyHandle(xtphIcon);
 
or don't use resources feature - pImageManager->m_bUseResources = FALSE;
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Janomat
Date Posted: 18 February 2008 at 1:47am
Hi Oleg,

i need it the other way round. I donīt want to copy a HBITMAP to the imagemanager, i need to get a HBITMAP or HICON FROM the Imagemanager. Even telling the imagemanager not to use ressources is the opposit of what i need and want.

Your solution ist:
    // Summary:
    //     Copies data from an HBITMAP or CXTPImageManagerIconHandle object

I need functions to get the imagemanager to create a hicon or hbitmap of itīs internal image in memory and iīm wondering why the imagemanager doesnīt offer these.

Best regards,

Jan






Posted By: Oleg
Date Posted: 18 February 2008 at 3:43am
Obviously you didn't try my solutions...

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Janomat
Date Posted: 19 February 2008 at 4:31am
Sorry. Got it. Sample for others following this thread...

    CXTPImageManagerIcon* pXTPIcon = XTPImageManager()->GetImage(MYICONID, 16);
    CXTPImageManagerIconHandle cXTPIconHandle = pXTPIcon->GetIcon(xtpImageNormal);
    CXTPImageManagerIconHandle cXTPnewIconHandle;
    cXTPnewIconHandle.CopyHandle(cXTPIconHandle);
    HBITMAP hBitmap = cXTPnewIconHandle.GetBitmap();

hBitmap can be used for creating an hIcon if needed using this code:

HICON Helper::CreateAlphaIcon(HBITMAP hBitmap, const CSize& size)
{
    HICON hIcon = NULL;
    CBitmap bmpResample;
    CImageList list;

    if (XTPImageManager()->IsAlphaIconsImageListSupported())
    {
        list.Create(size.cx, size.cy, ILC_COLOR32, 0, 1);
        bmpResample.Attach(hBitmap);
        list.Add(&bmpResample, (CBitmap*)NULL);
    }
    else
    {
        list.Create(size.cx, size.cy, ILC_MASK | ILC_COLOR24, 0, 1);
        bmpResample.Attach(CXTPImageManager::ResampleAlphaLayer(hBitmap, RGB(255,255,255)));
        list.Add(&bmpResample, RGB(255,255,255));
    }
    hIcon = list.ExtractIcon(0);
    bmpResample.Detach();
   
    return hIcon;
}

Thanks oleg :)

Jan




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net