Hello,
i developped a scan function in lotus script with TWAIN dll.
Now, i would like to convert my bmp file into an Jpg File.
I wtire a function SaveAsJpg using the dll IMGDLL but it doens’t work.
I use Kernell32.dll functions (globallock, unlock, free) and maybe the problem is there…
If someone have already used this kind of functions, thanks for help.
I give you the code of my sub SaveAsJpg :
Sub SaveAsJpg(FileBmp As String,FileJpg As String)
Dim HpRgb As Long
Dim PRgb As Long
Dim widthr As Integer
Dim height As Integer
Dim var As Variant
Call ImgDLLStringInitDLL(“{4EF99980-8EAE-11d2-922D-00104B307E04}”)
HpRgb=ImgDLLReadRGBFromBMP(FileBmp,lWidth,lheight)
PRgb=GlobalLock(HpRgb) 'DLL KERNEL32.DLL
retour = ImgDLLSaveRGBToJPG(FileJpg,PRgb,width,height,75,1,0)
Var = GlobalUnlock(HpRgb) 'DLL KERNEL32.DLL
GlobalFree(HpRgb) 'DLL KERNEL32.DLL
→ here is the code of the declarations :
Declare Function GlobalLock Lib “Kernel32.dll” (Byval hMem As Long) As Long 'DLL KERNEL32.DLL
Declare Function GlobalUnlock Lib “Kernel32.dll” (Byval hMem As Long) As Long 'DLL KERNEL32.DLL
Declare Private Function GlobalFree Lib “Kernel32.dll” (Byval hMem As Long) As Long 'DLL KERNEL32.DLL
Declare Sub ImgDLLStringInitDLL Lib “IMGDLL.DLL” (initString As String )
Declare Function ImgDLLReadRGBFromBMP Lib “IMGDLL.DLL” (Byval fileName As String, Byval widths As Integer, Byval height As Integer) As Long
Declare Function ImgDLLSaveRGBToJPG Lib “IMGDLL.DLL” ( fileName As String, Byval pBuf As Long, uWidthPix As Integer, uHeight As Integer, uQuality As Integer, bColor As Integer, bProgressive As Integer) As Integer