Lucas,
If you have a real proof of that, then I appreciate if you show it.
If not, then I appreciate if you think it twice before saying it, thanks
Lucas,
If you have a real proof of that, then I appreciate if you show it.
If not, then I appreciate if you think it twice before saying it, thanks
Marco & Maurizio:
Can either of you verify if you were able to measure the problem using checkres or in some other way?
Or is all we know is that toolbar icons disappear after some period of time?
Can either of you offer any other insight or feedback?
I just upgraded to FWH 1212 and then 1301 and I'm afraid to start distributing our new version.
Randal Ferguson
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.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 );
BitBlt( nDC, 0, 0, iXsize, iYsize, mDC, 0, 0, SRCCOPY );
SetStretchBltMode( hDC, COLORONCOLOR );
StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
mDC, 0, 0, iXsize, iYsize,
SRCINVERT );
StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
nDC, 0, 0, iXsize, iYsize,
SRCAND );
StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
mDC, 0, 0, iXsize, iYsize,
SRCINVERT );
SelectObject( nDC, hBmOld2 );
DeleteDC( nDC );
}
else
MessageBox( 0, "(1) Can't create compatible DC!", "Error", 0 );
DeleteObject( hMask );
}
else
MessageBox( 0, "(2) Can't create bitmap!", "Error", 0 );
hb_xfree( lpBits );
}
else
MessageBox( 0, "(3) Can't allocate memory!", "Error", 0 );
SelectObject( mDC, hBmOld1 );
DeleteDC( mDC );
}
else
MessageBox( 0, "(4) Can't create DC!", "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 ENDDUMPLucas,
Esa informaci贸n si es realmente util, gracias! ![]()
hMask = CreateBitmap( iXsize, iYsize, 1, 1, lpBits );
lpBits existe y es correcto, 贸 no hubiese avanzado hasta ah铆. Se me ocurre que los valores de iXsize 贸 iYsize sean err贸neos (negativos) y de ahi que falle CreateBitmap()
Este error puedes reproducirlo ? Es siempre el mismo ?
聽 LPVOID lpMsgBuf;
聽 聽FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
聽 聽 聽 聽 聽 聽 聽 聽 聽 NULL,
聽 聽 聽 聽 聽 聽 聽 聽 聽 GetLastError(),
聽 聽 聽 聽 聽 聽 聽 聽 聽 MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
聽 聽 聽 聽 聽 聽 聽 聽 聽 ( LPTSTR ) &lpMsgBuf,
聽 聽 聽 聽 聽 聽 聽 聽 聽 0,
聽 聽 聽 聽 聽 聽 聽 聽 聽 NULL );
聽 聽 MessageBox( 0, lpMsgBuf, "error", 0 );
聽 聽LocalFree( lpMsgBuf );#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.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 );
聽 聽 聽 聽 聽 BitBlt( nDC, 0, 0, iXsize, iYsize, mDC, 0, 0, SRCCOPY );
聽 聽 聽 聽 聽 SetStretchBltMode( hDC, COLORONCOLOR );
聽 聽 聽 聽 聽 StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 mDC, 0, 0, iXsize, iYsize,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SRCINVERT );
聽 聽 聽 聽 聽 StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 nDC, 0, 0, iXsize, iYsize,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SRCAND );
聽 聽 聽 聽 聽 StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 mDC, 0, 0, iXsize, iYsize,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SRCINVERT );
聽 聽 聽 聽 聽 SelectObject( nDC, hBmOld2 );
聽 聽 聽 聽 聽 DeleteDC( nDC );
聽 聽 聽 聽 }
聽 聽 聽 聽 else
聽 聽 聽 聽 聽 聽MessageBox( 0, "(1) Can't create compatible DC!", "Error", 0 );
聽 聽 聽 聽 DeleteObject( hMask );
聽 聽 聽 }
聽 聽 聽 else
聽 聽 聽 {
聽 聽 聽 聽 聽LPVOID lpMsgBuf;
聽 聽 聽 聽 聽FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
聽 聽 聽 聽 聽 聽 聽 聽 聽 NULL,
聽 聽 聽 聽 聽 聽 聽 聽 聽 GetLastError(),
聽 聽 聽 聽 聽 聽 聽 聽 聽 MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
聽 聽 聽 聽 聽 聽 聽 聽 聽 ( LPTSTR ) &lpMsgBuf,
聽 聽 聽 聽 聽 聽 聽 聽 聽 0,
聽 聽 聽 聽 聽 聽 聽 聽 聽 NULL );
聽 聽 聽 聽 MessageBox( 0, lpMsgBuf, "(2) Can't create bitmap!", 0 );
聽 聽 聽 聽 LocalFree( lpMsgBuf );
聽聽 聽 聽}
聽 聽 聽 hb_xfree( lpBits );
聽 聽 }
聽 聽 else
聽 聽 聽 聽 聽 聽 MessageBox( 0, "(3) Can't allocate memory!", "Error", 0 );
SelectObject( mDC, hBmOld1 );
聽 聽 DeleteDC( mDC );
聽 }
聽 else
聽 聽 聽MessageBox( 0, "(4) Can't create DC!", "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
=====>
Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala
FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10
FiveWin, One line of code and it's done...
Bayron,
Por favor, prueba a cambiar esta l铆nea asi:
static void TransBmp( HBITMAP hBitmap, unsigned int iXsize, unsigned int iYsize,
Otro cambio, distinto al anterior, que puede solucionar el problema:
hMask = CreateBitmap( iXsize, iYsize, 1, 1, NULL ); // lpBits );
Creo que esto solucionar谩 el problema definitivamente ![]()
Hi Antonio,
Would like to request to you to put the comment in english as well, as your comments are very improtant to us.
Thanks
Shridhar
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
static void TransBmp( HBITMAP hBitmap, unsigned int iXsize, unsigned 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, NULL ); // lpBits );
聽 聽 聽 if( hMask )
聽 聽 聽 {
聽 聽 聽 聽 nDC = CreateCompatibleDC( hDC );
聽 聽 聽 聽 if( nDC )
聽 聽 聽 聽 {
聽 聽 聽 聽 聽 hBmOld2 = ( HBITMAP ) SelectObject( nDC, hMask );
聽 聽 聽 聽 聽 SetBkColor( mDC, rgbTransparent );
聽 聽 聽 聽 聽 BitBlt( nDC, 0, 0, iXsize, iYsize, mDC, 0, 0, SRCCOPY );
聽 聽 聽 聽 聽 SetStretchBltMode( hDC, COLORONCOLOR );
聽 聽 聽 聽 聽 StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 mDC, 0, 0, iXsize, iYsize,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SRCINVERT );
聽 聽 聽 聽 聽 StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 nDC, 0, 0, iXsize, iYsize,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SRCAND );
聽 聽 聽 聽 聽 StretchBlt( hDC, iXOffset, iYOffset, iWidth, iHeight,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 mDC, 0, 0, iXsize, iYsize,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 SRCINVERT );
聽 聽 聽 聽 聽 SelectObject( nDC, hBmOld2 );
聽 聽 聽 聽 聽 DeleteDC( nDC );
聽 聽 聽 聽 }
聽 聽 聽 聽 else
聽 聽 聽 聽 聽 聽MessageBox( 0, "(1) Can't create compatible DC!", "Error", 0 );
聽 聽 聽 聽 DeleteObject( hMask );
聽 聽 聽 }
聽 聽 聽 else
聽 聽 聽 {
聽 聽 聽 聽 聽LPVOID lpMsgBuf;
聽 聽 聽 聽 聽FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
聽 聽 聽 聽 聽 聽 聽 聽 聽 NULL,
聽 聽 聽 聽 聽 聽 聽 聽 聽 GetLastError(),
聽 聽 聽 聽 聽 聽 聽 聽 聽 MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
聽 聽 聽 聽 聽 聽 聽 聽 聽 ( LPTSTR ) &lpMsgBuf,
聽 聽 聽 聽 聽 聽 聽 聽 聽 0,
聽 聽 聽 聽 聽 聽 聽 聽 聽 NULL );
聽 聽 聽 聽 MessageBox( 0, lpMsgBuf, "(2) Can't create bitmap!", 0 );
聽 聽 聽 聽 LocalFree( lpMsgBuf );
聽 聽 聽 }
聽 聽 聽 hb_xfree( lpBits );
聽 聽 }
聽 聽 else
聽 聽 聽 聽 聽 聽 MessageBox( 0, "(3) Can't allocate memory!", "Error", 0 );
SelectObject( mDC, hBmOld1 );
聽 聽 DeleteDC( mDC );
聽 }
聽 else
聽 聽 聽MessageBox( 0, "(4) Can't create DC!", "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=====>
Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala
FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10
FiveWin, One line of code and it's done...
Bayron,
Many thanks for your tests ![]()
Shridhar,
It seems as we finally found the bug and solved it ![]()
"The mistery of the vanishing bitmaps" is over
Antonio Linares wrote:It seems as we finally found the bug and solved it
Antonio,
Thank ,
I really hope that the problem it solved .
Regards Maurizio
Maurizio,
It was in front of our eyes all this time but we didn't see it ![]()
We were supplying a wrong buffer filled with garbage. Sometimes Windows was able to manage it, but sometimes, the memory garbish (as it was an unitialized memory block) had wrong data for WIndows. And the fact is that such buffer was not needed at all ![]()
聽 聽 lpBits = ( LPBYTE ) hb_xgrab( iXsize * iYsize * 2 );
聽 聽 if( lpBits )
聽 聽 {
聽 聽 }
hb_xfree( lpBits );