Loading...

Option Strict On errors

Support for GdTwain ActiveX and GdTwain Pro ActiveX/SDK.

Option Strict On errors

Postby JmunsonII » Mon Aug 04, 2008 6:16 pm

Namaste!

I'm writing a VB program that uses scanning support.

When utilizing the sample program as a basis for my application, I encounter the following errors in the subroutine "DisplayNativeImage":

Option Strict On disallows implicit conversions from "Long" to "System.IntPtr"
Option Strict On disallows implicit conversions from "Long" to "Integer"

The code for the subroutine is:

Code: Select all
Private Sub DisplayNativeImage()
        Dim hBitmap As Long = AxTwain1.GetHBitmap

        If bDisplayedImage Then picImage.Image.Dispose()
        picImage.Image = Image.FromHbitmap(hBitmap)
        AxTwain1.DeleteHBitmap(hBitmap)
        bDisplayedImage = True
    End Sub

The lines in error are:

Code: Select all
picImage.Image = Image.FromHbitmap(hBitmap)
        AxTwain1.DeleteHBitmap(hBitmap)


I am using Visual Basic 2008 Express, w/ .NET framework 3.x. I haven't been to "cast" the type with available casts.

Looking forward to the help!

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II
JmunsonII
 
Posts: 8
Joined: Mon Aug 04, 2008 6:09 pm

Re: Option Strict On errors

Postby JmunsonII » Mon Aug 04, 2008 6:31 pm

Never mind solved that one...I'm liking VB 2008 very much as compared to VB5 of 7 years ago!

The correction is:

Code: Select all
        picImage.Image = Image.FromHbitmap(CType(hBitmap, IntPtr))
        AxTwain1.DeleteHBitmap(CInt(hBitmap))


Peace, Love, and Light,

/s/ Jon C. Munson II
JmunsonII
 
Posts: 8
Joined: Mon Aug 04, 2008 6:09 pm


Return to GdTwain [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 2 guests