HASANDIZ
asked on
How can I get the list of TWAIN Devices vb.net
I have a xKube Lottery Printer Scanner, how can I connect to that scanner so I can scan a slip and save it as picture file. I am not sure where to start. Pls help
ASKER
I have this dll that I have to use but cannot use it since I have WIN7 x64 keep saying cant use it. How can i add within the code instead of preferences so I can use that dll ? Delphi code is something like this
function VbCePrnInitCeUsbSI(var dwSysErr: Integer): Integer; stdcall; external 'CeSmLm.dll';
but I need to convert that to VB.net 2008
Thanks again
function VbCePrnInitCeUsbSI(var dwSysErr: Integer): Integer; stdcall; external 'CeSmLm.dll';
but I need to convert that to VB.net 2008
Thanks again
Is it a COM DLL?
ASKER
no, it came with the printer xKube driver. When I try to add as comm I couldnt. I am going to try this and see if it works
<DllImport("sss.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Shared Function GetWindowText(ByVal hwnd As IntPtr, _
ByVal lpString As StringBuilder, _
ByVal cch As Integer) As Integer
End Function
<DllImport("sss.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Shared Function GetWindowText(ByVal hwnd As IntPtr, _
ByVal lpString As StringBuilder, _
ByVal cch As Integer) As Integer
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok I got the compile running but still dont get the program to connect I believe. I have imported the dll like
and call it like this
I know I should not get the dwApp= 127 but I do. I have no idea what are the return codes and cannot find any info on the returns on these dll functions.
Any Idea?
Thanks
<DllImport("cesmlm.dll", CallingConvention:=CallingConvention.StdCall)> Shared Function VbCePrnGetInterfaceNumUsb(ByRef prnName As String, ByRef dwApp As Integer) As Integer
End Function
and call it like this
RichTextBox1.Text &= vbNewLine & "Entering InitUsbLayerSw ..."
Dim dwInt As Integer
Dim dwErr As Integer
Dim dwApp As Integer
Dim a As Integer
dwInt = VbCePrnInitCeUsbSI(dwErr)
If dwErr <> 0 Then
RichTextBox1.Text &= vbNewLine & "dwErr Error... dwErr <> 0"
Return False
ElseIf dwInt > 0 Then
RichTextBox1.Text &= vbNewLine & "dwInt > 0 .... dwInt:" & dwInt
a = VbCePrnGetInterfaceNumUsb(m_strPrnName, dwApp)
If dwApp = 127 Then
RichTextBox1.Text &= vbNewLine & "InitUSBLayer Done With Error... dwApp = 127 Error"
Return False
Else
m_intDevSel = dwApp
RichTextBox1.Text &= vbNewLine & "m_strPrnName := " & m_strPrnName
RichTextBox1.Text &= vbNewLine & "InitUSBLayer Done ..."
Return True
End If
End If
RichTextBox1.Text &= vbNewLine & "InitUSBLayer Done ..."
I know I should not get the dwApp= 127 but I do. I have no idea what are the return codes and cannot find any info on the returns on these dll functions.
Any Idea?
Thanks
http://www.codeproject.com/Articles/1376/NET-TWAIN-image-scanner
Which is likely the best solution out there. Good luck!