FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FISAVEIMG() FILOAD() str 0 error
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
FISAVEIMG() FILOAD() str 0 error
Posted: Sat Apr 25, 2015 10:37 AM

Hi !

  1. // comes from image.prg
    static function FISAVEIMG( cSrcFile, cDstFile, nDstFormat, nQuality )

local nSrcFormat, hDib, hDib2, lOk := .f.

DEFAULT nQuality := 0

if LoadFreeImage() > 32

  nSrcFormat = FIGETFILETYPE( cSrcFile, 0 )

  hDib = FILOAD( nSrcFormat, cSrcFile, 0 )
  hDib2 = FICNV24( hDib )
  lOk = FISAVE( nDstFormat, hDib2, cDstFile, nQuality )

  FIUNLOAD( hDib )
  FIUNLOAD( hDib2 )

endif

return lOk

2.myapp.prg

static hLib
...
... buttion action FISAVEIMG( "tmp1.bmp", "tmp1.jpg", 2, 95)

DLL32 FUNCTION FISAVE( nFormat AS LONG, hDib AS LONG, cFileName AS LPSTR, nFlags AS LONG ) AS BOOL ;
PASCAL FROM "_FreeImage_Save@16" LIB hLib
DLL32 FUNCTION FILOAD( nFormat AS LONG, cFileName AS LPSTR, nFlags AS LONG ) AS LONG ;
PASCAL FROM "_FreeImage_Load@12" LIB hLib
...

3.runtime error :
Error description: Error BASE/1099 Argument error: STR
Args:
[ 1] = U
Called from: => STR(0)
Called from: bas.prg =>FIGETFILETYPE(6872)

TKS!
Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FISAVEIMG() FILOAD() str 0 error
Posted: Sat Apr 25, 2015 05:41 PM
I do not thing bas.prg and FIGETFILETYPE() function are not from FWH.
If you just rely on DLL declarations inside Image.prg without any modifications, there should be no problem.

For example, this small sample works well.
Code (fw): Select all Collapse
function test()

   local cSrc := "c:\fwh\bitmaps\pngs\image3.png"
   local cDst := "image3.bmp"

   FIConvertImageFile( cSrc, cDst, 0 )

   ? file( cDst )
   showimage( cdst )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Re: FISAVEIMG() FILOAD() str 0 error
Posted: Mon Apr 27, 2015 03:31 AM

Nageswaragunupudi,
Delete dll declarations , run OK!
TKS!
Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651

Continue the discussion