Print Page | Close Window

How mix 2 CXTPImageManagerIconHandle?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=15598
Printed Date: 06 May 2024 at 8:30pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How mix 2 CXTPImageManagerIconHandle?
Posted By: zitz
Subject: How mix 2 CXTPImageManagerIconHandle?
Date Posted: 12 November 2009 at 2:33am
I get 2 icons from CXTPImageManager (Is Alpha icons), I want Apply(mix/impose/lay on/наложить) one icon to another, and add to CXTPImageManager.

I have
CXTPImageManagerIconHandle h1;
and
CXTPImageManagerIconHandle h2;
I want to get
CXTPImageManagerIconHandle h3 = Mix( h1, h2 );

How?


-------------
Xtreme ToolkitPro v13.1.0, static, VC++6



Replies:
Posted By: zitz
Date Posted: 29 January 2010 at 7:54am
Solved!
I use this function to get HICON:
HICON CreateIconFromImageManagerIconHandle( CXTPImageManagerIconHandle& hHandle )
{
    class CXTPImageManagerIconHandleCreateIcon : public CXTPImageManagerIconHandle
    {
    public:
        HICON CreateHICON()
        {
            if ( m_hIcon != NULL )
            {
                return ::CopyIcon( m_hIcon );
            }
            else if ( m_pRInfo != NULL )
            {
                CXTPImageManagerIconHandleCreateIcon hHandle;
                m_pRInfo->pResource->CreateIcon( hHandle, m_pRInfo );
                return hHandle.CreateHICON();
            }
            else if ( m_hBitmap != NULL )
            {
                if ( m_pBits != NULL )
                {
                    CXTPImageManagerIconHandleCreateIcon hHandle;
                    hHandle.CopyHandle( m_hBitmap );
                    return hHandle.CreateHICON();
                }
                if ( m_szIcon.cx > 0 && m_szIcon.cy )
                {
                    CImageList il;
                    il.Create( m_szIcon.cx, m_szIcon.cy, ILC_COLOR32, 0, 1 );
                    il.Add( CBitmap::FromHandle( m_hBitmap ), (CBitmap*)NULL );
                    return il.ExtractIcon( 0 );
                }
            }
            return NULL;
        }
    };
    CXTPImageManagerIconHandleCreateIcon& hIcon = (CXTPImageManagerIconHandleCreateIcon&)hHandle;
    return hIcon.CreateHICON();
}


-------------
Xtreme ToolkitPro v13.1.0, static, VC++6



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