Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - XTP crashes with bitmaps with alpha channels!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

XTP crashes with bitmaps with alpha channels!

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

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Topic: XTP crashes with bitmaps with alpha channels!
    Posted: 26 January 2007 at 11:40am
I've got several reports that the application crashes after the upgrade to 10.40.

I was able to reproduce the crash and to track it down. It crashes as soon as I add a bitmap (.bmp, not .png) with an alpha channel to the QAT.

It doesn't crash on every PC but I've been able to reproduce it on a clean Win2K SP2 English installation.



In the RibbonSample add a CBitmap m_bitmap; to the CMainFrame class and in LoadIcons add the following lines:

void CMainFrame::LoadIcons ()
{
    CXTPCommandBars* pCommandBars = GetCommandBars();

    HANDLE hBitmap = ::LoadImage (NULL, _T("EditUndo.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);

    m_bitmap.Attach (hBitmap);

    UINT nId = ID_EDIT_UNDO;

    pCommandBars->GetImageManager()->SetIcons(m_bitmap, &nId, 1, CSize(16,16), xtpImageNormal, TRUE);
   

    //pCommandBars->GetImageManager()->SetIcons(IDR_SMALLICONS);
....
}

I've attached the modified files as well as the bitmap.

uploads/20070126_113431_Crash.zip



Codejock support
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 26 January 2007 at 2:29pm
Hi,
 
Add LR_CREATEDIBSECTION flag for LoadImage call.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 26 January 2007 at 2:31pm
... You can call CXTPImageManagerIcon::LoadBitmapFromFile that automatically detect if it has Alpha channel/png file.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2007 at 2:39pm
Hello Oleg,

have you been able to reproduce the crash?

Andre

Codejock support
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 27 January 2007 at 2:43am
No.
But I sure reason in LR_CREATEDIBSECTION.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2007 at 5:40am
Originally posted by oleg oleg wrote:

Hi,
 
Add LR_CREATEDIBSECTION flag for LoadImage call.


That avoids the crash, but transparency doesn't work.

No problem on W2k SP4, only W2k SP2 here, but others have reported the problem also with W2k SP4 and XP Home.

Codejock support
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.188 seconds.