![]() |
How to get bitmap and not glyph |
Post Reply ![]() |
Author | |
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() Posted: 01 March 2009 at 6:15pm |
I am doing the following:
pIcon = XTPImageManager()->GetImage( nID, 16); CXTPImageManagerIconHandle IconHandle = pIcon->GetIcon(); hbm = IconHandle.GetBitmap(); I expected to get a handle to a bitmap for the input command id (nID). Instead what I get is the entire glyph the bitmap is part of. I stepped into the code and found that m_pRInfo contians a member, "rc" that has the location of the command in the glyph but the code appears to just return a handle to a glyph. How do I get an individual bitmap of the size I have asked for?
HBITMAP CXTPImageManagerIconHandle::GetBitmap() const{ ASSERT(IsAlpha());
if (m_hBitmap)
return m_hBitmap;
if (m_pRInfo && m_pRInfo->pResource && m_pRInfo->pResource->m_hbmpImage)
return m_pRInfo->pResource->m_hbmpImage;
ASSERT(FALSE); return NULL;} |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Just make individual copy of this handle:
CXTPImageManagerIconHandle IconHandle = pIcon->GetIcon(); CXTPImageManagerIconHandle IconCopy;IconCopy.CopyHandle(IconHandle);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() |
Thanks that seems to work. I went back to V11 when our code was working and it appears there has been a fairly significant change in the underlying CodeJock code in V12 that now is rippling its way thru our products. I can understand why CodeJock made the underlying archetectural change to how the images are stored and displayed. But why the change in the seamantics of the GetImage method so that it returns the entire glyph instead of the bitmap of the command ID that is passed in?
Should I start checking the version of CJ at runtime to deduce the semantics of various api calls? Or was this change in the semantics of GetImage something that was accidental?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
You can call
XTPImageManager()->m_bUseResources = FALSE;
to return it all back.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() |
Why change the previous behavior by default? There have been other issues like this with V12 where previous behavior is changed and to change it back we have to set a flag (accelerators on shortcut menus comes to mind). I would have thought m_bUseResources would default to FALSE and if I want to turn it on I would specifically do so and hence know or understand the repercussions and additional coding that is then necessary. Release notes could indicate the new functionality, why it was added and how to turn it on and any known issues when it is turned on.
We started out late with CJ (version 11) so we have only lived thru one version change (we are in the process of moving to 13 but are now wondering what will bite us next). These sort of semantic/behavior changes are catching us flat footed and we are beginning to wonder about the approach CJ is taking when producing a new version. Basically we are spending resources trying to fix what used to work. Setting a new flag is not much trouble. Finding out what caused the regression and how to get back to the start point is time consuming.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
It was in release notes for 11.2.1 version and marked as important change.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
tralfaz ![]() Groupie ![]() Joined: 21 June 2009 Status: Offline Points: 36 |
![]() ![]() ![]() ![]() ![]() |
This is not working for me
CXTPImageManagerIcon* pIcon = XTPImageManager()->GetImage( CmdID, 16); if (pIcon) { CXTPImageManagerIconHandle IconHandle = pIcon->GetIcon(); CXTPImageManagerIconHandle IconCopy; IconCopy.CopyHandle(IconHandle); if (IconCopy!= NULL) { hBM = (HBITMAP)IconCopy.GetBitmap(); } } pIcon is good and contains the correct information, but the HBITMAP is always null. The toolbar button with CmdID exists. Used this to create the toolbar CXTPTabManagerItem* pItem = CreateToolbar(pCommandBars, pToolBar, Index, _TT("Main"), IDR_MAINFRAME3, true, true, false); Can you tell me how to get the HBitmap from an ID? |
|
XP Pro SP3 / VS2008 C++ / Xtreme CommandBars v13.1.0 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |