FISAVEIMG() FILOAD() str 0 error

FISAVEIMG() FILOAD() str 0 error

Postby ShumingWang » 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
ShumingWang
 
Posts: 460
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: FISAVEIMG() FILOAD() str 0 error

Postby nageswaragunupudi » Sat Apr 25, 2015 5: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: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FISAVEIMG() FILOAD() str 0 error

Postby ShumingWang » Mon Apr 27, 2015 3: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
ShumingWang
 
Posts: 460
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests