i am trying to convert c# to vb.net of this project! .NET TWAIN image scanner[^] i did it and it works on select source, and scan preview but not when i click scan then it throws me error "Arithmetic operation resulted in an overflow." in winmsga.x = CShort(pos) much of code! :( here is what i have done: TwainLib[^] Twain[^] GDIPlusLib[^] And my form[^] only two things got errors when i converted code! first one is:
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Friend Structure WINMSG
Public hwnd As IntPtr
Public message As Integer
Public wParam As IntPtr
Public lParam As IntPtr
Public time As Integer
Public x As Integer
Public y As Integer
End Structure
and
Private winmsg As WINMSG
so i just renamed it to winmsga maybe i did something wrong here? and other error was:
Protected Function GetPixelInfo(ByVal bmpptr As IntPtr) As IntPtr
bmi = New BITMAPINFOHEADER()
Marshal.PtrToStructure(bmpptr, bmi)
bmprect.X = InlineAssignHelper(bmprect.Y, 0)
bmprect.Width = bmi.biWidth
bmprect.Height = bmi.biHeight
If bmi.biSizeImage = 0 Then
bmi.biSizeImage = ((((bmi.biWidth \* bmi.biBitCount) + 31) And Not 31) >> 3) \* bmi.biHeight
End If
Dim p As Integer = bmi.biClrUsed
If (p = 0) AndAlso (bmi.biBitCount <= 8) Then
p = 1 << bmi.biBitCount
End If
p = (p \* 4) + bmi.biSize + CInt(bmpptr)
**Return New (p,IntPtr)** 'so i made like this (Return New System.IntPtr(p))
End Function
can annyone help? thanks!
FeRtoll Software.net ------------ E-Mail me