Enrico Maria Giordano wrote:I think xHarbour has nothing to do with the buttons of the ribbonbar. We have to dig deep inside FWH...
function TransBmp()
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
static void TransBmp( HBITMAP hBitmap, int iXsize, int iYsize,
COLORREF rgbTransparent, HDC hDC,
int iXOffset, int iYOffset, int iWidth, int iHeight )
{
HDC mDC, nDC;
HBITMAP hMask, hBmOld1, hBmOld2;
LPBYTE lpBits;
mDC = CreateCompatibleDC( hDC );
if( mDC )
{
hBmOld1 = ( HBITMAP ) SelectObject( mDC, hBitmap );
lpBits = ( LPBYTE ) hb_xgrab( iXsize * iYsize * 2 );
if( lpBits )
{
hMask = CreateBitmap( iXsize, iYsize, 1, 1, lpBits );
if( hMask )
{
nDC = CreateCompatibleDC( hDC );
if( nDC )
{
hBmOld2 = ( HBITMAP ) SelectObject( nDC, hMask );
SetBkColor( mDC, rgbTransparent );
if( ! BitBlt( nDC, 0, 0, iXsize, iYsize, mDC, 0, 0, SRCCOPY ) )
MessageBox( 0, "BitBlt() failed from TransBmp()", "error", 0 );
SetStretchBltMode( hDC, COLORONCOLOR );
if( ! StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
mDC, 0, 0, iXsize, iYsize,
SRCINVERT ) )
MessageBox( 0, "StretchBlt() 1 failed from TransBmp()", "error", 0 );
if( ! StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
nDC, 0, 0, iXsize, iYsize,
SRCAND ) )
MessageBox( 0, "StretchBlt() 2 failed from TransBmp()", "error", 0 );
if( ! StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
mDC, 0, 0, iXsize, iYsize,
SRCINVERT ) )
MessageBox( 0, "StretchBlt() 3 failed from TransBmp()", "error", 0 );
SelectObject( nDC, hBmOld2 );
DeleteDC( nDC );
}
else
MessageBox( 0, "can't create compatible DC 2 from TransBmp()", "error", 0 );
DeleteObject( hMask );
}
hb_xfree( lpBits );
}
else
MessageBox( 0, "hb_xgrab() failed from TransBmp()", "error", 0 );
SelectObject( mDC, hBmOld1 );
DeleteDC( mDC );
}
else
MessageBox( 0, "can't create compatible DC 1 from TransBmp()", "error", 0 );
}
HB_FUNC( TRANSBMP )
{
TransBmp( ( HBITMAP ) hb_parnl( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), hb_parnl( 4 ),
( HDC ) hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ),
hb_parnl( 9 ) );
}
#pragma ENDDUMP
Antonio Linares wrote:If at any moment it fails a msg will be displayed that will help us to know what it is going on. Thanks for your help!
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 29 guests