Upgrade VB6 Error

M

Michael Turner

Hi guys I am having the following problem upgrading a vb6 application, I
have click the link as it suggested and I have search the net only to become
even more confussed! HELP!!!

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

Code

Declare Function lineInitializeEx Lib "tapi32.dll" Alias "lineInitializeExA"
(ByRef lphLineApp As Integer, ByVal hInstance As Integer, ByVal lpfnCallback
As Integer, ByVal lpszFriendlyAppName As String, ByRef lpdwNumDevs As
Integer, ByRef lpdwAPIVersion As Integer, ByRef lpLineInitializeExParams As
LINEINITIALIZEEXPARAMS) As Integer



'UPGRADE_WARNING: Add a delegate for AddressOf mTAPIvb.LineCallbackProc
Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1048"'

rc = lineInitializeEx(m_hLineApp, VB6.GetHInstance.ToInt32, AddressOf
mTAPIvb.LineCallbackProc,
System.Reflection.Assembly.GetExecutingAssembly.GetName.Name, m_numLines,
m_HiAPI, lip)
 
K

Ken Tucker [MVP]

Hi,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbup1048.asp

Ken
---------------------
Hi guys I am having the following problem upgrading a vb6 application, I
have click the link as it suggested and I have search the net only to become
even more confussed! HELP!!!

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

Code

Declare Function lineInitializeEx Lib "tapi32.dll" Alias "lineInitializeExA"
(ByRef lphLineApp As Integer, ByVal hInstance As Integer, ByVal lpfnCallback
As Integer, ByVal lpszFriendlyAppName As String, ByRef lpdwNumDevs As
Integer, ByRef lpdwAPIVersion As Integer, ByRef lpLineInitializeExParams As
LINEINITIALIZEEXPARAMS) As Integer



'UPGRADE_WARNING: Add a delegate for AddressOf mTAPIvb.LineCallbackProc
Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1048"'

rc = lineInitializeEx(m_hLineApp, VB6.GetHInstance.ToInt32, AddressOf
mTAPIvb.LineCallbackProc,
System.Reflection.Assembly.GetExecutingAssembly.GetName.Name, m_numLines,
m_HiAPI, lip)
 
M

Michael Turner

Hi Ken

Thanks I have already looked at this article and it has confused me even
more is there any more advice that I can be given?

Thanks,
Mike.
 
I

Imran Koradia

You need to define a delegate for the Callback procedure lineCallbackProc.
Here's how your declaration would look like:

Public Delegate Function lineCallbackProc( _
ByVal dwDevice As Integer,
ByVal dwMsg As Integer, _
ByVal dwCallbackInst As Integer, _
ByVal dwParam1 As Integer,
ByVal dwParam2 As Integer, _
ByVal dwParam3 As Integer) As Integer

Declare Function lineInitializeEx Lib "tapi32.dll" _
Alias "lineInitializeExA" (ByRef lphLineApp As Integer, _
ByVal hInstance As Integer, _
ByVal lpfnCallback As lineCallbackProc, _
ByVal lpszFriendlyAppName As String, _
ByRef lpdwNumDevs As Integer, _
ByRef lpdwAPIVersion As Integer, _
ByRef lpLineInitializeExParams As LINEINITIALIZEEXPARAMS) _
As Integer


hope that helps..
Imran.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top