Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Changes to imagemanager, missing functionality
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Changes to imagemanager, missing functionality

 Post Reply Post Reply
Author
Message
Janomat View Drop Down
Newbie
Newbie
Avatar

Joined: 20 February 2006
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Janomat Quote  Post ReplyReply Direct Link To This Post Topic: Changes to imagemanager, missing functionality
    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


Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Janomat View Drop Down
Newbie
Newbie
Avatar

Joined: 20 February 2006
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Janomat Quote  Post ReplyReply Direct Link To This Post 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




Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2008 at 3:43am
Obviously you didn't try my solutions...
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Janomat View Drop Down
Newbie
Newbie
Avatar

Joined: 20 February 2006
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Janomat Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.046 seconds.