FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in GDIP_IMAGEFROMFILE()?
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in GDIP_IMAGEFROMFILE()?
Posted: Thu Oct 22, 2015 03:22 PM
The following sample freezes for some seconds and then terminates. It should return zero instead.

Code (fw): Select all Collapse
#include "Fivewin.ch"


EXTERNAL GDIBMP


FUNCTION MAIN()

    ? GDIP_IMAGEFROMFILE( "NOTEXIST.JPG", .T. )

    RETURN NIL


EMG
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bug in GDIP_IMAGEFROMFILE()?
Posted: Thu Oct 22, 2015 05:10 PM

Creo que no se inicializa el sistema gdi+ con esa function ( GDIP_IMAGEFROMFILE() es a nages function :-) y no podria decirlo con seguridad )
Mira asi :

include "Fivewin.ch"

EXTERNAL GDIBMP

FUNCTION MAIN()

GDIPLUSSTARTUP()   // inicialice gdi+
? GDIP_IMAGEFROMFILE( "NOTEXIST.JPG", .T. )

RETURN NIL

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in GDIP_IMAGEFROMFILE()?
Posted: Thu Oct 22, 2015 05:17 PM

Sorry, same result. :-(

EMG

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Bug in GDIP_IMAGEFROMFILE()?
Posted: Thu Oct 22, 2015 05:54 PM

Enrico :

This sample is ok for me , msginfo() return 36514824 ( hbitmap )

include "FiveWin.ch"

function Main()
local ogdi:= Gdibmp():new("..\gifs\halo.gif")

  msginfo( GDIP_IMAGEFROMFILE( "..\gifs\halo.gif", .T. ) )

return nil

GDIP_IMAGEFROMFILE() no mira si existe o no la imagen , por lo que falla .

seria mejor ...

if file("..\gifs\halo.gif" )
msginfo( GDIP_IMAGEFROMFILE( "..\gifs\halo.gif", .T. ) )
endif

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in GDIP_IMAGEFROMFILE()?
Posted: Thu Oct 22, 2015 06:19 PM
mastintin wrote:GDIP_IMAGEFROMFILE() no mira si existe o no la imagen , por lo que falla .


Exactly what I'm saying: it's a bug. It should check if the open operation has succeded

Code (fw): Select all Collapse
FILE * hFile      = fopen (  hb_parc(1) , "rb" ) ;


and return 0 if not.

EMG

Continue the discussion