FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour falla de brush con xharbour.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
falla de brush con xharbour.com
Posted: Thu Aug 11, 2011 03:07 AM
Antonio

Usando FWH 11.03 con xhb.com ultima version, tiene la particularidad de que fallan los brush, con la ultima version de xharbour para borland no hay problema, para ejemplo adjunto una screenshot del ejemplo testxbrw.exe de la carpeta samples, incluso un redefine bitmap en un dialogo falla tambien, oBrush:hBrush tiene un valor de cero.


Uploaded with ImageShack.us

incluso e probado una fivehcm.lib de junio 2011 que has posteado en el foro y aun falla.
salu2
carlos vargas
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Fri Aug 12, 2011 02:21 AM

por favor antonio, daniel... ayuda :-)

salu2
carlos vargas

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: falla de brush con xharbour.com
Posted: Sat Aug 13, 2011 09:02 AM

You said it works on XP but fails on Windows 7 64 bit Home.
Can you confirm it is exactly the same exe file? Or have you built the exes separately on XP and on home 64 bits pc?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Sat Aug 13, 2011 04:44 PM
the error is strange, since I've taken a old app, I've compiled latest version with FWH xhb.com 11.03 and works fine, but now I'm developing application that fails, I have no third party libraries or classes FWH changes , no extra code. I have two days with this problem and I can not figure it out.
I have functions PALBMPLOAD (used in TBITMAP CLASS) and LOADBITMAP (BRUSH CLASS) both return zero

Compiled con xharbour last version all work ok.
Code (fw): Select all Collapse
FUNCTION Main()
聽 聽LOCAL oBrush, oFont

聽 聽oApp := TApplication():New()

聽 聽IF !Main_Configure()
聽 聽 聽 RETURN
聽 聽ENDIF

聽 聽IF !Acceso()
聽 聽 聽 Main_Close()
聽 聽 聽 RETURN
聽 聽ENDIF

聽 聽DEFINE BRUSH oBrush NAME "BM_FONDO2"

?oBrush:hBrush // fwh xhb return zero, i verify what bitmap "BM_FONDO2" is include in the exe

聽 聽DEFINE FONT 聽oFont 聽NAME GetDefaultFontName() SIZE 0, GetDefaultFontHeight()

聽 聽DEFINE WINDOW oApp:oMainWnd 聽 ;
聽 聽 聽 FROM 1, 1 TO 600, 800 聽 聽 聽;
聽 聽 聽 TITLE "Sistema de control - CREDICOM, version 1.1a" ;
聽 聽 聽 ICON 聽GetIcon() 聽 聽 聽 聽 聽 聽;
聽 聽 聽 BRUSH oBrush

聽 聽 聽 DEFINE MSGBAR oApp:oMsgBar OF oApp:oMainWnd PROMPT "KDSoft(c), Managua, Agosto 2011" 2010

聽 聽 聽 DEFINE MSGITEM oApp:aoItemsMsgBar[ IMB_INFO_CONN 聽] OF oApp:oMsgBar PROMPT oApp:InfoConn() 聽SIZE 330 COLOR CLR_BLUE, NIL
聽 聽 聽 DEFINE MSGITEM oApp:aoItemsMsgBar[ IMB_INFO_UTYPE ] OF oApp:oMsgBar PROMPT oUser:cUserType 聽SIZE 080 COLOR CLR_BLUE, NIL
聽 聽 聽 DEFINE MSGITEM oApp:aoItemsMsgBar[ IMB_INFO_UID 聽 ] OF oApp:oMsgBar PROMPT oUser:cUserAlias SIZE 100 COLOR CLR_BLUE, NIL

聽 聽 聽 oApp:oMsgBar:KeybOn()

聽 聽 聽 oApp:oMainWnd:bInit := {|| oApp:oMainWnd:SetFont( oFont ), ShowMenu() }

聽 聽ACTIVATE WINDOW oApp:oMainWnd MAXIMIZED VALID MsgNoYes( "Desea salir de la aplicaci贸n?", "Seleccione" )

聽 聽Main_Close()

RETURN NIL


Code (fw): Select all Collapse
/*-------------------------------------------------------------------------------------------------*/
#include "credicom.ch"

/*-------------------------------------------------------------------------------------------------*/
GLOBAL EXTERNAL oApp, oUser

STATIC nIntentos

/*-------------------------------------------------------------------------------------------------*/

FUNCTION Acceso()
聽 聽LOCAL oDlg
聽 聽LOCAL oFnt1
聽 聽LOCAL lAcceso
聽 聽PRIVATE cAlias, cContrasena

聽 聽#ifdef __PRUEBA__
聽 聽cAlias 聽 聽 聽 := PadR( LOGIN_USERDEV, 10 )
聽 聽cContrasena 聽:= PadR( LOGIN_PASSDEV, 10 )
聽 聽#else
聽 聽cAlias 聽 聽 聽 := Space( 10 )
聽 聽cContrasena 聽:= Space( 10 )
聽 聽#endif

聽 聽lAcceso 聽 := FALSE
聽 聽nIntentos := 0

聽 聽DBSELECT "USUA"
聽 聽USUA->( OrdSetFocus( "ALIAS" ), DBGoTop() )

聽 聽DEFINE FONT oFnt1 NAME "Tahoma" SIZE 0,-12

聽 聽DEFINE DIALOG oDlg NAME "DLG_ACCESO" ICON GetIcon() FONT oFnt1

聽 聽REDEFINE BITMAP ID 301 OF oDlg NAME "BM_ACCESO" //this bitmap is not show in dialog, i verify what bitmap "BM_ACCESO" is included in the exe

聽 聽REDEFINE GET cAlias 聽 聽 聽ID 101 OF oDlg PICTURE "@!"
聽 聽REDEFINE GET cContrasena ID 102 OF oDlg

聽 聽REDEFINE BUTTON ID 201 OF oDlg ACTION IIf( lAcceso := Acceso_Validar( oDlg ), oDlg:END(), NIL )
聽 聽REDEFINE BUTTON ID 202 OF oDlg ACTION oDlg:END() CANCEL

聽 聽ACTIVATE DIALOG oDlg CENTER

聽 聽LimpiarAreas()

聽 聽RELEASE FONT oFnt1
聽 聽RELEASE cAlias, cContrasena

RETURN lAcceso

/*-------------------------------------------------------------------------------------------------*/

Code (fw): Select all Collapse
HB_FUNC( LOADBITMAP )
{
聽 聽#ifndef UNICODE
聽 聽 聽 #ifndef _WIN64
聽 聽 聽 聽 聽HBITMAP hBmp = LoadBitmap( ( HINSTANCE ) hb_parnl( 1 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 IF( HB_ISCHAR( 2 ), hb_parc( 2 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ) );
聽 聽 聽 #else 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽HBITMAP hBmp = LoadBitmap( ( HINSTANCE ) hb_parnll( 1 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 IF( HB_ISCHAR( 2 ), hb_parc( 2 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ) );
聽 聽 聽 #endif
聽 聽#else
聽 聽 聽 LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 2 ) ); 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 HBITMAP hBmp = LoadBitmap( ( HINSTANCE ) hb_parnl( 1 ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF( HB_ISCHAR( 2 ), pW,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽( LPWSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ) );
聽 聽 聽 _xfree( pW );
聽 聽#endif 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽

聽 聽RegisterResource( hBmp, "BMP" );

聽 聽hb_retnl( ( unsigned long ) hBmp );
}


Code (fw): Select all Collapse
HB_FUNC( PALBMPLOAD ) // ( cResourceName )
{
聽 聽 #ifndef UNICODE
聽 聽 聽 聽HRSRC 聽hRes = FindResource( ( HMODULE ) GetResources(),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF( HB_ISCHAR( 1 ), hb_parc( 1 ), MAKEINTRESOURCE( hb_parni( 1 ) ) ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽RT_BITMAP );
聽 聽 #else
聽 聽 聽 聽LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 1 ) );
聽 聽 聽 聽HRSRC 聽hRes = FindResource( ( HMODULE ) GetResources(),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF( HB_ISCHAR( 1 ), pW, MAKEINTRESOURCE( hb_parni( 1 ) ) ),
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽RT_BITMAP );
聽 聽 #endif 聽 聽 聽 聽 聽 聽 聽 聽 
聽 聽 HANDLE hResource = IF( hRes, LoadResource( GetResources(), hRes ), 0 );

聽 聽 #ifdef UNICODE
聽 聽 聽 聽_xfree( pW );
聽 聽 #endif 聽 

聽 聽 if( hRes )
聽 聽 {
聽 聽 聽 聽#ifndef __FLAT__
聽 聽 聽 聽 聽 hb_reta( 2 );
聽 聽 聽 聽 聽 hb_stornl( ( LONG ) hPalBitmapNew( 0, (LPBITMAPINFO) GlobalLock( hResource ) ), -1, 1 );
聽 聽 聽 聽 聽 hb_stornl( ( LONG ) hPalette, -1, 2 );
聽 聽 聽 聽 聽 GlobalUnlock( hResource );
聽 聽 聽 聽#else
聽 聽 聽 聽 聽 hb_reta( 2 );
聽 聽 聽 聽 聽 hb_storvnl( ( LONG ) hPalBitmapNew( 0, ( struct tagBITMAPINFO * ) hResource ), -1, 1 );
聽 聽 聽 聽 聽 hb_storvnl( ( LONG ) hPalette, -1, 2 );
聽 聽 聽 聽#endif
聽 聽 聽 聽#ifndef UNICODE
聽 聽 聽 聽 聽 FreeResource( hResource );
聽 聽 聽 聽#endif 聽 
聽 聽 }
聽 聽 else
聽 聽 {
聽 聽 聽 聽hb_reta( 2 );
聽 聽 聽 聽hb_storvnl( 0, -1, 1 );
聽 聽 聽 聽hb_storvnl( 0, -1, 2 );
聽 聽 }
}





Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: falla de brush con xharbour.com
Posted: Sat Aug 13, 2011 06:25 PM

Carlos,

Could you please test it using samples\buildx.bat with free xHarbour ? thanks

Here it is working fine with MSVC 2010 and samples\buildh32.bat

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Sat Aug 13, 2011 07:20 PM

Antonio lo interesante de esto es que tengo un app mas peque帽a en la cual funciona correctamente todo, pero esta ultima es mas grande, y creme cuando te digo que en estos dos dias he buscado en el codigo cualquier cosa que alterase los resultados, repito que no he usado libs de terceros, ni modificaciones a las clases tbitmap y brush, ambas app usa las misma libs, el mismo orden, y ambas funcionan muy bien con xharbour free de bcc, pero al usar xhb.com solo la mas peque帽a no presenta el problema.

ahora he cometido un error al indicar que se usara testxbrw como proueba ya que cuando compile para xhb.com no he incluido el rc por lo cual el recurso no fue incluido y por tanto no fue presentado el fondo. por lo cual por favvor disculap al se帽alar que se usara como ejemplo-

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: falla de brush con xharbour.com
Posted: Sun Aug 14, 2011 10:00 PM

Carlos,

Por favor modifica la clase TBrush para que justo despues de llamar a LoadBitmap() llame a MsgInfo( GetErrMsg() ) y asi sepamos que error de Windows ha ocurrido para que no se cargue el bitmap, gracias

O prueba a llamar a esa funci贸n despues de mostrar hBrush. Lo que ocurre es que alguna operaci贸n previa de Windows puede cambiar la informaci贸n del ultimo error a estado de no error.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Sun Aug 14, 2011 11:55 PM
en este caso muestra correctamente el nombre del recurso, el cual he verificado exista en el exe usando resedit
GetResource esta retornando un valor numerico.

en brush.prg
Code (fw): Select all Collapse
        case cBmpRes != nil
           ::hBitmap = LoadBitmap( GetResources(), cBmpRes )
           MsgInfo( GetErrMsg() )
           ?ProcName(),cBmpRes, GetResources(),::hBitmap
           MsgInfo( GetErrMsg() )
           ::hBrush  = If( ::hBitmap != 0, CreatePatternBrush( ::hBitmap ),)
           MsgInfo( GetErrMsg() )



TBRUSH:NEW
BM_FONDO2
4194304
0

retorno de GetErrMsg es: El nombre de recurso especificado no se encuentra en el archivo de imagen.


en bitmap.prg
Code (fw): Select all Collapse
METHOD LoadImage( cResName, cBmpFile ) CLASS TBitmap

聽 聽local lChanged := .f.
聽 聽local hBmpOld 聽:= ::hBitmap
聽 聽local hPalOld 聽:= ::hPalette
聽 聽local aBmpPal

聽 聽DEFAULT cResName := ::cResName, cBmpFile := ::cBmpFile

聽 聽if ! Empty( cResName )
聽 聽 聽 聽?cBmpRes, GetResources()
聽 聽 聽 聽aBmpPal 聽 聽= PalBmpLoad( cResName )
聽 聽 聽 聽MsgInfo( GetErrMsg() )
聽 聽 聽 聽::hBitmap 聽= aBmpPal[ 1 ]
聽 聽 聽 聽::hPalette = aBmpPal[ 2 ]
聽 聽 聽 聽lChanged 聽:= .t.
聽 聽 聽 聽cBmpFile 聽:= nil



TBITMAP:LOADIMAGE
BM_ACCESO
4194304
2
0
0
aca MsgInfo( GetErrMsg() ) indica operacion realizada correctamente, lo que pasa es que los valores del array son 0
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Mon Aug 15, 2011 03:09 AM

un dato extra

he pasado mis recursos a una dll y usado set resources to "mifile.dll" y todo funciona bien con fwh + xhb.com
la falla esta con los recursos agregados al exe, los cuales la funciones indicadas no estan detectando segun los mensajes de error (siguiendo las indicaciones de AL)

hay que ver por que lo desconoce, hay que se帽alar que otros recursos que se usan como botones en las toolbar iconos, dialogos, manifest funciona bien, de momento he notado falla en los brush, bitmaps, los cuales usan las funciones LoadBitmap y PalBmpLoad.

salu2
carlos vargas

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Mon Aug 15, 2011 04:53 AM
antonio la funcion FindResource de bajo nivel (en 'c') donde se encuentra?
he llegado rastreando el problema hasta ahi, y no puedo continuar

Code (fw): Select all Collapse
    #ifndef UNICODE
       HRSRC  hRes = FindResource( ( HMODULE ) GetResources(),
                     IF( HB_ISCHAR( 1 ), hb_parc( 1 ), MAKEINTRESOURCE( hb_parni( 1 ) ) ),
                     RT_BITMAP );
    #else


hay una llamada HB_FUNC( FINDRESOURCE), pero ya es una funcion de FWH
Code (fw): Select all Collapse
HB_FUNC( FINDRESOURCE ) // ( hResources, cResourceName, nResType )
{
   OutputDebugStringA("FindResource\n"); //esto nunca se llega amostrar en el depurador
   #ifndef UNICODE
      #ifndef _WIN64
          hb_retnl( ( LONG ) FindResource( ( HINSTANCE ) hb_parnl( 1 ),
                          hb_parc( 2 ), MAKEINTRESOURCE( hb_parni( 3 ) ) ) );
      #else
          hb_retnl( ( LONG ) FindResource( ( HINSTANCE ) hb_parnll( 1 ),
                          hb_parc( 2 ), MAKEINTRESOURCE( hb_parni( 3 ) ) ) );
      #endif
   #else
       LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 2 ) );
      hb_retnl( ( LONG ) FindResource( ( HINSTANCE ) hb_parnl( 1 ),
                       pW, MAKEINTRESOURCE( hb_parni( 3 ) ) ) );
      _xfree( pW );
   #endif
}
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Mon Aug 15, 2011 04:08 PM
baueno :-) continuando con las prueba, ya descarte falla en FindResources, ademas he hecho un cambio
Code (fw): Select all Collapse
聽 聽DEFINE DIALOG oDlg NAME "DLG_ACCESO" ICON GetIcon() FONT oFnt1

聽 聽REDEFINE BITMAP ID 301 OF oDlg NAME "BM_ACCESO"

por
Code (fw): Select all Collapse
聽 聽DEFINE DIALOG oDlg NAME "DLG_ACCESO" ICON GetIcon() FONT oFnt1

聽 聽REDEFINE BITMAP ID 301 OF oDlg NAME "TB_DELETE"


he cambiado el nombre del resource bitmap y aparece al bendito bitmap, lo raro es que ambos bitmap son agregados

TB_DELETE BITMAP ".\\bitmaps\\form_delete.bmp"
BM_ACCESO BITMAP ".\\bitmaps\\logo_acceso.bmp"


ambos son de 24 bits.
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Mon Aug 15, 2011 04:56 PM

para aclarar la falla aun existe, lo que pasa es que cambio la imagen de acceso por una imagen de un boton de borrado y este si aparece loque me llevo a revisar el bitmap de la imagen que no es mostrada, la he eliminado de recursos y la he cargado al rc nuvamente sin resultados positivos, en el caso de la imagen de fondo tengo 6: FONDO0, FONDO1,..FONDO5 y nunguno es mostrada en el fondo de la pantalla como brush.

salu2
carlos vargas

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: falla de brush con xharbour.com
Posted: Mon Aug 15, 2011 05:02 PM

Hola Carlos

Trate de contacterme contigo por medio del msn sin resultado (por el email que tienes asignado), si es posible contactame a ver si juntos podemos resolverlo
si tienes alguna otra via, hazmela saber por mi correo

Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: falla de brush con xharbour.com
Posted: Mon Aug 15, 2011 05:52 PM

ok, estare a partir de este momento en 1 1/2 hora en el msn, aca son las 12, por lo que estar a las 1:30 en linea.
voy saliendo hacia el trabajo..

gracias daniel,

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: falla de brush con xharbour.com
Posted: Thu Aug 18, 2011 08:07 AM
Carlos,

FindResource() es una funcion propia del API de Windows

http://msdn.microsoft.com/en-us/library/ms648042(v=vs.85).aspx
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion