Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

A DLL for scannre functions...


  • Please log in to reply
1 reply to this topic

#1 Olish

Olish

    Wayfarer

  • Active Members
  • Pip
  • 60 posts

Posted 01 September 2006 - 02:48 PM

Hi everybody !

I'm searching a DLL that will allow me to scan a document.

Does someone know a free DLL by the way please ?

Thank you a lot !
Olivier, from France.Free Wake On LAN script







#2 Olish

Olish

    Wayfarer

  • Active Members
  • Pip
  • 60 posts

Posted 01 September 2006 - 03:11 PM

I've found this source in VBScript. I'll try to translate it into AutoItScript... This needs the Eztw32.dll DLL.

Plain Text         
1.  Declare Function TWAIN_AcquireToClipboard Lib "EZTW32.DLL" (ByVal hwndApp&, ByVal wPixTypes&) As Integer    2.    Declare Function TWAIN_SetHideUI Lib "Eztw32.dll" Alias "TWAIN_SetHideUI" (ByVal ui As Long) As Long    3.    Declare Function TWAIN_OpenDefaultSource Lib "Eztw32.DLL" Alias "TWAIN_OpenDefaultSource" (ByVal hwnd As Long) As Integer    4.    Declare Function TWAIN_SetCurrentResolution Lib "Eztw32.dll" Alias "TWAIN_SetCurrentResolution" (ByVal neufdix As Double) As Long    5.    Declare Function TWAIN_SetCurrentPixelType Lib "Eztw32.dll" Alias "TWAIN_SetCurrentPixelType" (ByVal deux As Long) As Long    6.    Declare Function TWAIN_LoadSourceManager Lib "Eztw32.dll" Alias "TWAIN_LoadSourceManager" () As Long    7.    Declare Function TWAIN_SetCurrentUnits Lib "Eztw32.dll" Alias "TWAIN_SetCurrentUnits" (ByVal zero As Long) As Long    8.    Declare Function TWAIN_SetBitDepth Lib "Eztw32.dll" Alias "TWAIN_SetBitDepth" (ByVal zero As Long) As Long    9.    Declare Function TWAIN_OpenSourceManager Lib "EZTW32.DLL" Alias "TWAIN_OpenSourceManager" (ByVal hwnd As Long) As Long   10.    Declare Function TWAIN_CloseSource Lib "EZTW32.DLL" Alias "TWAIN_CloseSource" () As Long   11.    Declare Function TWAIN_SelectImageSource Lib "EZTW32.DLL" Alias "TWAIN_SelectImageSource" (ByVal hwnd As Long) As Integer   12.    Declare Function TWAIN_State Lib "EZTW32.DLL" Alias "TWAIN_State" () As Integer   13.     14.     15. FONCTION   16.     17.        Dim l_Retour As Long   18.        Dim s_cheminsauv As String   19.        Dim i As Integer   20.     21.        Try   22.     23.            TWAIN_CloseSource()   24.            TWAIN_LoadSourceManager()   25.            TWAIN_OpenSourceManager(frm.Handle.ToInt32)   26.            iRetour = TWAIN_OpenDefaultSource(frm.Handle.ToInt32)   27.            If iRetour = 0 Then   28.                iRetour = TWAIN_SelectImageSource(frm.Handle.ToInt32)   29.                If iRetour = 1 Then   30.                    iRetour = TWAIN_OpenDefaultSource(frm.Handle.ToInt32)   31.                End If   32.            End If   33.     34.            If iRetour = 0 Then   35.                Exit Function   36.            End If   37.     38.            If TWAIN_State() < 4 Then   39.                MsgBox("Impossible de paramêtrer le scanner")   40.                Exit Function   41.            Else   42.                'parametres du scanner   43.                TWAIN_SetCurrentUnits(0) 'DPI   44.                TWAIN_SetCurrentResolution(150) 'en points par pouces   45.                TWAIN_SetCurrentPixelType(2) ' Scan format 0 = B&W, 1 Grey, 2 RGB   46.                TWAIN_SetBitDepth(8) ' Bit Depth 1, 2, 4, 8 but depends on Pixeltype   47.     48.                TWAIN_SetHideUI(True)   49.            End If   50.     51.     52.     53.            'scan du document   54.            iRetour = TWAIN_AcquireToClipboard(frm.Handle.ToInt32, 32)   55.     56.            If iRetour = 0 Then   57.                MsgBox("Le scan du document a échoué.", MsgBoxStyle.Critical, "Scanner")   58.                Exit Function   59.            End If   60.     61.            TWAIN_CloseSource()   62.        Catch ex As Exception   63.            Exit Function   64.        End Try   65.     66.        Try   67.     68.            pbImage.Image = System.Windows.Forms.Clipboard.GetDataObject.GetData(System.Windows.Forms.DataFormats.Bitmap) 'on la met dans une picture box   69.     70.            g_rcdCandidat.Seek(l_iNoCandidat)   71.            s_cheminsauv = "c:\toto.jpg"   72.     73.            i = 1   74.            If System.IO.File.Exists(s_cheminsauv) = True Then   75.                s_cheminsauv = Left(s_cheminsauv, s_cheminsauv.Length - 4)   76.                While System.IO.File.Exists(s_cheminsauv & i & ".jpg") = True   77.                    i = i + 1   78.                End While   79.                s_cheminsauv &= " "   80.                s_cheminsauv &= i   81.                s_cheminsauv &= ".jpg"   82.            End If   83.     84.            pbImage.Image.Save(s_cheminsauv, System.Drawing.Imaging.ImageFormat.Jpeg)   85.     86.        Catch ex As Exception   87.            MsgBox("Le document a bien été scanné," & Chr(13) & "mais une erreur s'est produite lors de la sauvegarde dans le dossier du candidat.", MsgBoxStyle.Critical, "Scanner")   88.        End Try   89.     90. FIN DE LA FONCTION

Olivier, from France.Free Wake On LAN script




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users