Code : Tout sélectionner
Global curpath.s
curpath=Space(256)
GetCurrentDirectory_(256,@curpath)
Procedure.l LoadNViewImage(ImageNumber,FileName$)
;
; Load JPG, JIF, GIF, BMP, DIB, RLE, TGA and PCX images with PB and NViewLib.DLL
; NViewLib 1.1.4 is free: http://www.programmersheaven.com/file.asp?FileID=2045
;
;
; SYNTAX
; ImageHandle = LoadNViewImage(#Image, FileName$)
;
; DESCRIPTION
; Load the specified image.
; The image format can be a JPG, JIF, GIF, BMP, DIB, RLE, TGA or PCX file.
; If the function fails, 0 is returned, Else all is fine.
; This command requires the NVIEWLIB.DLL in the Path.
;
res=OpenLibrary(0, curpath + "NViewLib.dll")
If res
AddrImage = CallFunction(0, "NViewLibLoad",Filename$,0)
Width = CallFunction(0,"GetWidth")
Height = CallFunction(0,"GetHeight")
newImage = CreateImage(ImageNumber,Width,Height)
StartDrawing(ImageOutput(0))
DrawImage(AddrImage,0,0)
StopDrawing()
DeleteObject_(AddrImage)
;save = CallFunction(0,"NViewLibSaveAsJPG",80,"test.jpg")
CloseLibrary(0)
Else
MessageRequester("ERROR","Cant find NVIEWLIB.DLL in Path",0):End
EndIf
ProcedureReturn newImage
EndProcedure
File$ = OpenFileRequester("Load Image", "", "All supported images | *.jpg;*.jpeg;*.jif;*.gif;*.bmp;*.dib;*.rle;*.tga;*.pcx | All files *.* | *.*", 0)
If File$ <> ""
If LoadNViewImage(1,File$)
OpenWindow(0,200,200,ImageWidth(0),ImageHeight(0),"Nviewload test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
SetForegroundWindow_(WindowID(0))
Repeat
event=WaitWindowEvent()
If event=#WM_PAINT
StartDrawing(WindowOutput(0))
DrawImage(ImageID(0),0,0)
StopDrawing()
EndIf
Until event = #PB_Event_CloseWindow
EndIf
EndIf
End
Pourtant cela devrait marcher sans problème, savez vous quel est le problème et cette erreur de Filename$ ? Comment fixer cela ?[11:41:23] [COMPILER] Line 27: Bad parameter type, number expected instead of string.
PS: voici la DLL ==>> Nviewlib https://www.dropbox.com/s/uxjeonnba45fb ... b.dll?dl=0
Merci.