WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DllCall Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

FreeImage DllCalls


Use Freeimage to convert an image.

http://freeimage.sourceforge.net/

Notes: Apparently __stdcall "decorates" (mangles) the function name when it is exported, so that in the DLL it becomes:

_MyFunction@4

where the number following the '@' symbol is the stack space used by the function (the parameter count * 4). This prevents DllCall from accessing the function.

FIF_PCX     = 10
FIF_TIFF    = 18
pcxfile = "C:\Temp\Vin7200.pcx"
tifffile = strcat(filepath(pcxfile), fileroot(pcxfile), ".tif")
dllhandle = DllLoad("C:\Temp\Freeimage\FreeImage\FreeImage\Dist\FreeImage.dll")

;use freeimage to convert an image
image = DllCallcDecl(dllhandle, long:"_FreeImage_Load@12", long:FIF_PCX , lpstr:pcxfile, long:0)
x     = DllCallcDecl(dllhandle, long:"_FreeImage_Save@16", long:FIF_TIFF, long:image, lpstr:tifffile, long:0)
x     = DllCallcDecl(dllhandle, void:"_FreeImage_Unload@4", long:image)
DllFree(dllhandle)
Run(tifffile,"")
exit

Article ID:   W16952
File Created: 2007:07:03:14:27:10
Last Updated: 2007:07:03:14:27:10