PDA

View Full Version : LoadImage



Petr Schreiber
01-01-2006, 16:42
Hi,

I'm bit lost.
The original declaration of LoadImage is


DECLARE FUNCTION LoadImage LIB "USER32.DLL" ALIAS "LoadImageA" (BYVAL hInst AS DWORD, lpsz AS ASCIIZ, BYVAL uType AS DWORD, BYVAL cxDesired AS LONG, BYVAL cyDesired AS LONG, BYVAL fuLoad AS DWORD) AS DWORD


As TB still doesn't support strings, I tried the strptr trick, but still no success :(



DECLARE FUNCTION LoadImage LIB "USER32.DLL" ALIAS "LoadImageA" (BYVAL hInst AS DWORD, lpsz AS dword, BYVAL uType AS DWORD, BYVAL cxDesired AS LONG, BYVAL cyDesired AS LONG, BYVAL fuLoad AS DWORD) AS DWORD

%IMAGE_BITMAP = 0
%LR_LOADFROMFILE = &H0010
DIM hImg AS DWORD
DIM picture AS STRING = App_SourcePath+"mybmp.bmp"
picture += chr$(0)

hImg = LoadImage ( %NULL, strptr(picture), %IMAGE_BITMAP, 0, 0, %LR_LOADFROMFILE)
msgbox 0,"Handle obtained: "+FORMAT$(hImg)+$CRLF+"ImageFile: "+picture



Any ideas ?

Thanks,
Psch

ErosOlmi
01-01-2006, 20:26
Psch,

I'm checking.......
It should word as your example.
I've reproduced your sample script into Power Basic code and it works.

I will let you know.

Ciao
Eros

ErosOlmi
01-01-2006, 21:12
Psch,

I've found the problem: it is a bug!
Internal function used to call windows API was not returning any value to the script :oops:
Return value was just ignored. Your script example with STRPTR trick was right.

Fix will be present into version 1.0.8.2

Thanks a lot
Eros