View Single Post
 
Old 07-14-2017, 06:14 PM
StealthRT's Avatar
StealthRT StealthRT is offline
Contributor
 
Join Date: Aug 2002
Posts: 785
Question VB6 AddressOf and Callbacks in VS 2008

Hey all I am trying to convert some VB6 code to VS 2008 via its automated VB6 code converter. Most does well but there are a few that need a touch up.

The touch up is this piece of code:
Code:
    GrCapStartCapture(myIdSensor, AddressOf GrCapFingerEventHandler, AddressOf GrCapImageEventHandler)
The **AddressOf ...** are the errors in this one:

The GrCapFingerEventHandler:
Code:
    Public Sub GrCapFingerEventHandler(ByVal pidSensor As Integer, ByVal eventRaised As Integer)
		While fireFinger = True
			System.Windows.Forms.Application.DoEvents()
		End While
		
		myPIdSensor = pidSensor
		myEventRaised = eventRaised
		fireFinger = True
		
		While fireFinger = True
			System.Windows.Forms.Application.DoEvents()
		End While
	End Sub
And GrCapImageEventHandler:
Code:
    Public Sub GrCapImageEventHandler(ByVal pidSensor As Integer, ByVal width As Integer, ByVal height As Integer, ByVal pRawImage As Integer, ByVal res As Integer)
		While fireImage = True
			System.Windows.Forms.Application.DoEvents()
		End While
		
		myPIdSensor = pidSensor
		myWidth = width
		myHeight = height
		myRes = res
		myRawImage = pRawImage
		fireImage = True
		
		While fireImage = True
			System.Windows.Forms.Application.DoEvents()
		End While
	End Sub
And the error is:

> Error 44 'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is not a delegate type.

Can anyone help me with converting this code areas over to .net?
Reply With Quote