Print Page | Close Window

XTP crashes with bitmaps with alpha channels!

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=6233
Printed Date: 17 November 2024 at 8:04pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: XTP crashes with bitmaps with alpha channels!
Posted By: ABuenger
Subject: XTP crashes with bitmaps with alpha channels!
Date 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 - uploads/20070126_113431_Crash.zip





-------------
Codejock support



Replies:
Posted By: Oleg
Date Posted: 26 January 2007 at 2:29pm
Hi,
 
Add LR_CREATEDIBSECTION flag for LoadImage call.


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


Posted By: Oleg
Date 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


Posted By: ABuenger
Date Posted: 26 January 2007 at 2:39pm
Hello Oleg,

have you been able to reproduce the crash?

Andre



-------------
Codejock support


Posted By: Oleg
Date Posted: 27 January 2007 at 2:43am
No.
But I sure reason in LR_CREATEDIBSECTION.


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


Posted By: ABuenger
Date 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



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