Getting error in AddressOf Operator, Plz help

I

ItsMe

Hi Guyz,

I'm unable to understand this (AddressOf) error???

In VB6 I have two functions:
----------------------------

Public Function ImageFirstImageCallback(ByVal hWnd As Integer, ByVal iMsg As
Integer, ByVal wParam As Integer, ByVal LParam As Integer) As Integer
'Code here
End Function

Public Function ImageFirstSortCallback(ByVal hWnd As Integer, ByVal iMsg As
Integer, ByVal wParam As Integer, ByVal LParam As Integer) As Integer
'Code here
End Function

Declaration for function:
------------------------

Public Declare Function fsmScanImageFirst& Lib "FSMFUJI.dll" (ByVal
strFileName$, ByVal iNumDocs&, ByVal iOutPocket&, _
ByVal
strEncodeData$, ByVal strPrintData1$, _
ByVal
strPrintData2$, ByVal strPrintData3$, _
ByVal
iStampOn&, ByVal strMICR$, _
ByVal
strOCR$, ByRef piPocket&, _
ByRef
piUnitNumber&, ByRef piMICRStatus&, ByVal iDoubleFeed&, _
ByVal
strDocumentStatus$, _
ByVal
funcSortCallBack&, ByVal funcImageCallBack&)

Implementation:
---------------

g_Error = fsmScanImageFirst(vbNullString, lngBatchSize, 1, vbNullString,
vbNullString, vbNullString, vbNullString, 0, strMICRText, strOCRText,
lngPocketRet, lngUnitNum, lngMICRStatus, 7, strDocStatus.Value, AddressOf
ImageFirstImageCallback, AddressOf ImageFirstImageCallback) 'I'm getting
error in this line

Do you think that i'm doing any mistake in sytax.???

Plz help


Error Description is :
---------------------
Overload resolution failed because no accessible 'fsmScanImageFirst' can be
called with these arguments:
'Declare Ansi Function fsmScanImageFirst Lib "FSMFUJI.dll"(strFileName
As String, iNumDocs As Integer, iOutPocket As Integer, strEncodeData As
String, strPrintData1 As String, strPrintData2 As String, strPrintData3 As
String, iStampOn As Integer, strMICR As String, strOCR As String, ByRef
piPocket As Integer, ByRef piUnitNumber As Integer, ByRef piMICRStatus As
Integer, iDoubleFeed As Integer, strDocumentStatus As String,
funcSortCallBack As Integer, funcImageCallBack As Integer) As Integer':
'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is
not a delegate type.
'Declare Ansi Function fsmScanImageFirst Lib "FSMFUJI.dll"(strFileName
As String, iNumDocs As Integer, iOutPocket As Integer, strEncodeData As
String, strPrintData1 As String, strPrintData2 As String, strPrintData3 As
String, iStampOn As Integer, strMICR As String, strOCR As String, ByRef
piPocket As Integer, ByRef piUnitNumber As Integer, ByRef piMICRStatus As
Integer, iDoubleFeed As Integer, strDocumentStatus As String,
funcSortCallBack As Integer, funcImageCallBack As Integer) As Integer':
'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is
not a delegate type.
'Declare Ansi Function fsmScanImageFirst Lib "FSMFUJI.dll"(strFileName
As String, iNumDocs As Long, iOutPocket As Long, strEncodeData As String,
strPrintData1 As String, strPrintData2 As String, strPrintData3 As String,
iStampOn As Long, strMICR As String, strOCR As String, ByRef piPocket As
Long, ByRef piUnitNumber As Long, ByRef piMICRStatus As Long, iDoubleFeed As
Long, strDocumentStatus As String, funcSortCallBack As Long,
funcImageCallBack As Long) As Long': 'AddressOf' expression cannot be
converted to 'Long' because 'Long' is not a delegate type.
'Declare Ansi Function fsmScanImageFirst Lib "FSMFUJI.dll"(strFileName
As String, iNumDocs As Long, iOutPocket As Long, strEncodeData As String,
strPrintData1 As String, strPrintData2 As String, strPrintData3 As String,
iStampOn As Long, strMICR As String, strOCR As String, ByRef piPocket As
Long, ByRef piUnitNumber As Long, ByRef piMICRStatus As Long, iDoubleFeed As
Long, strDocumentStatus As String, funcSortCallBack As Long,
funcImageCallBack As Long) As Long': 'AddressOf' expression cannot be
converted to 'Long' because 'Long' is not a delegate type.
 
H

Herfried K. Wagner [MVP]

* "ItsMe said:
I'm unable to understand this (AddressOf) error???

'&' stands for 'Long' in VB.NET, you need an 'Int32'. Make sure you
store a reference to the delegate you pass to the API function in a
variable to avoid problems.
 
I

ItsMe

ok herfried, thanks a lot...

Cheerz


Herfried K. Wagner said:
'&' stands for 'Long' in VB.NET, you need an 'Int32'. Make sure you
store a reference to the delegate you pass to the API function in a
variable to avoid problems.
 

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