TWAIN with VB.Net ??? Dump ?

oxbow123

Newcomer
Joined
May 14, 2003
Messages
3
I have found an example of code for VB5 using tawin.

I have try to translate it in vb.net but some object changed.

Does anyone has an idea about the correct code ?

Thanks :p

PHP:
Option Strict Off
Option Explicit On
Module Module1
	' 32-bit EZTWAIN functions for Visual Basic 5.0
	Declare Function TWAIN_AcquireToClipboard Lib "EZTW32.DLL" (ByVal hwndApp As Integer, ByVal wPixTypes As Integer) As Integer
	Declare Function TWAIN_SelectImageSource Lib "EZTW32.DLL" (ByVal hwndApp As Integer) As Integer
End Module




	Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
		Dim r As Object

		r = TWAIN_SelectImageSource(Me.Handle.ToInt32)
	End Sub
	
	Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
		Dim r As Object
		Dim t As Short

		r = TWAIN_AcquireToClipboard(Me.Handle.ToInt32, t)

        Dim iData As IDataObject = Clipboard.GetDataObject
        Picture1.Image = iData.GetData
		
	End Sub
 
Here is :D

PHP:
Attribute VB_Name = "Module1"
' 32-bit EZTWAIN functions for Visual Basic 5.0
Declare Function TWAIN_AcquireToClipboard Lib "EZTW32.DLL" (ByVal hwndApp&, ByVal wPixTypes&) As Long
Declare Function TWAIN_SelectImageSource Lib "EZTW32.DLL" (ByVal hwndApp&) As Long

PHP:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6180
   ClientLeft      =   795
   ClientTop       =   420
   ClientWidth     =   8325
   LinkTopic       =   "Form1"
   ScaleHeight     =   0
   ScaleWidth      =   0
   Begin VB.CommandButton Command2 
      Caption         =   "Acquerir l'image"
      Height          =   495
      Left            =   6000
      TabIndex        =   2
      Top             =   5520
      Width           =   2055
   End
   Begin VB.PictureBox Picture1 
      Height          =   4815
      Left            =   240
      ScaleHeight     =   4755
      ScaleWidth      =   7875
      TabIndex        =   1
      Top             =   120
      Width           =   7935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Selectionnez la source"
      Height          =   495
      Left            =   3720
      TabIndex        =   0
      Top             =   5520
      Width           =   2055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
r = TWAIN_SelectImageSource(Me.hWnd)
End Sub

Private Sub Command2_Click()
r = TWAIN_AcquireToClipboard(Me.hWnd, t%)
Picture1.Picture = Clipboard.GetData(vbCFDIB)

End Sub
 
Back
Top