Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET General (http://www.xtremevbtalk.com/-net-general/)
-   -   VB6 AddressOf and Callbacks in VS 2008 (http://www.xtremevbtalk.com/-net-general/328677-vb6-addressof-callbacks-vs-2008-a.html)

StealthRT 07-14-2017 06:14 PM

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?

Goggy 08-09-2017 02:55 AM

How is the sub "GrCapStartCapture" Declared?
I'm suspect there should be some delegates involved to get it to work.....


All times are GMT -6. The time now is 07:28 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.