CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2008
    Posts
    111

    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?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: VB6 AddressOf and Callbacks in VS 2008

    How is the GrCapStartCapture method declared (i.e. what are its parameters)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured