![]() |
Get HICON from XTPImageManager |
Post Reply
|
| Author | |
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Topic: Get HICON from XTPImageManagerPosted: 16 April 2010 at 7:01am |
|
Hello,
have some trouble after change from V11.1.3 to V14.0.0Beta. i add a Toolbar to XTPImageManager. than i will get a HICON, but it return NULL. add this lines CXTPImageManagerIcon* pIcon = pCommandBars->GetImageManager()->GetImage(ID_COLOR_FORE); HICON hIcon1 = pIcon->GetIcon(); after line: pCommandBars->GetImageManager()->SetIcons(IDR_TOOLBAR_COLOR); in CommandBarControls Sample (MainFrm.cpp). hIcon1 is NULL. Any solution to retrieve HICON ? Thanks Jimmy |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 April 2010 at 6:11am |
|
Later versions store icons as one single image to decrease GDI resource usage. Try something like this:
BOOL IconFromPNG(HINSTANCE hInstance, UINT nResourceID, CXTPImageManagerIconHandle &hIconHandle)
{ hIconHandle.Clear(); BOOL bAlphaBitmap = FALSE; |
|
|
PokerMemento - http://www.pokermemento.com/
|
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 April 2010 at 8:10am |
|
Hello,
Thanks for answer. But this doesn't help. My old function use this for fill a own CImageList (with ID's) with using ImageManager to Load from toolbar (with id's). Now i have add my own function loading toolbar id's. But i think, it's not correct from CJ to return no ICON. CJ can remove this function an can add a new function. CXTPImageManagerIcon* pIcon = pCommandBars->GetImageManager()->GetImage(ID_COLOR_FORE); HICON hIcon1 = pIcon->CreateIcon(); Jimmy |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 September 2010 at 9:08am |
|
Hello,
Any solution for this ? We add all your bmp, ico, Toolbar icons, ... to the ImageManager. But how can i get a HICON from the ImageManager ? I'll add the Icon to a dialog. Jimmy |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 September 2010 at 7:30am |
|
Hi,
Yes, now all icons locates in single GDI object. Please copy it first when you need single icon: CXTPImageManagerIcon* pIcon = pCommandBars->GetImageManager()->GetImage(ID_COLOR_FORE); CXTPImageManagerIconHandle handle; handle.CopyHandle(pIcon->GetIcon()); HICON hIcon1 = handle; |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 September 2010 at 11:02am |
|
Hello Oleg,
Thanks for answer, that work great. i've a little wish. please add HICON Detach() { HICON hIcon = m_hIcon; m_hIcon = NULL; return hIcon; } to CXTPImageManagerIconHandle class. Thanks Jimmy |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 September 2010 at 12:58am |
|
Hi,
Added.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 September 2010 at 3:30am |
|
Great,
Thanks Oleg. Jimmy |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 01 October 2010 at 2:18am |
|
Hi Oleg,
Have one more trouble with this. CopyHandle does not create a HICON, if the ImageIcon is a alpha bitmap. Now we use this. static HICON CreateAlphaIcon(HBITMAP hBitmap, DWORD dwWidth,
DWORD dwHeight)
{
// dwWidth & Height could be extract from HBITMAP |
|
![]() |
|
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 |