WinBatch Sample: Acquire and save to BMP file
The following WinBatch script is all that is required to do the following:
; First load our DLL dllhandle=DllLoad("DTWAIN32.DLL")
; Check for Twain Availability isAvailable = DllCall(dllhandle, long:'DTWAIN_IsTwainAvailable')
if isAvailable == 1 ; initialize the DTWAIN library DllCall(dllhandle, long:'DTWAIN_SysInitialize')
; Select a TWAIN source TwainSource = DllCall(dllHandle, long:'DTWAIN_SelectSource') if TwainSource != 0 ; Acquire a file DllCall(dllHandle, long:'DTWAIN_AcquireFile', long:TwainSource, lpstr:'TEST.BMP', long:100, long:17, long:1000, long:1, long:1, long:1, long:0) EndIf ; Close down DTWAIN DllCall(dllHandle, long:'DTWAIN_SysDestroy') EndIf
; unload the DLL DllFree( dllHandle )
In the example above, note that the DllLoad and DllFree commands are used to load and unload the DTWAIN librrary. The DllCall command calls the desired DTWAIN function with the appropriate parameters. Please consult your WinBatch documentation for more information on these functions, plus information on calling external DLL functions with proper parameter types.
In addition, the call to DTWAIN_AcquireFile has numeric arguments (100, 17, 1000, etc.). These are the DTWAIN constant values that correspond to DTWAIN_BMP, DTWAIN_USELONGNAME, etc. For Macro Scheduler, it is required that the literal constants be used when calling DTWAIN functions, instead of the symbolic names. To get the constant's value, please see the DTWAIN32.wbt file for a list of the symbolic names and their constant value.
|