473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting error in AddressOf Operator, Plz help

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.
Nov 20 '05 #1
4 1933
"ItsMe" <kk*@yahoo.com> schrieb
Declaration for function:
------------------------

[...]


Errors in the function declaration. It's for the wrong language (VB6).
Convert it to VB.NET. Mind the basic data types. Use Delegates for passing
function pointers. See docs for more.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
* "ItsMe" <kk*@yahoo.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
thanks a lot armin, i got it

Cheerz
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"ItsMe" <kk*@yahoo.com> schrieb
Declaration for function:
------------------------

[...]


Errors in the function declaration. It's for the wrong language (VB6).
Convert it to VB.NET. Mind the basic data types. Use Delegates for passing
function pointers. See docs for more.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
ok herfried, thanks a lot...

Cheerz
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c5************@ID-208219.news.uni-berlin.de...
* "ItsMe" <kk*@yahoo.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
6
by: RA | last post by:
btnAdd_Click does not get hit; if I have IsPostBack check in Page_load. If I don't have IsPostBack check; I am able to debug through btnAdd_Click. If I don't look for IsPostBack then it...
2
by: Giovanni Bassi | last post by:
Hello All, I have encountered a problem. I am using visual inheritance and my base form adds an event handler on Form Load using the AddHandler Keyword. The problem is that if the Event...
4
by: Issac | last post by:
Hi, I am working on error handling for my project. I got the following code from the web which declare that it can catch all exceptions in my project rather that using TRY CATCH in everything...
2
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True...
2
by: Sean Carey | last post by:
I converted a C# Upload app to VB.NET and am down to one error and was hoping someone could help me with te error. I would greatly appreciate help from anyone. Here is the error: ...
8
by: jcrouse | last post by:
I am using the following code to trap errors in a sub routine: Try Executable code Catch ex As Exception Dim strInputE As String = Application.StartupPath & "\Error.txt" Dim srE As...
5
by: Carlo \(mcp\) | last post by:
Good morning I have this lines: AddHandler MyControl1.Parent.Paint, AddressOf PaintParentHandler AddHandler MyControl2.Parent.Paint, AddressOf PaintParentHandler AddHandler...
0
by: JimN1 | last post by:
Error: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. This is a continuation of my previous table element update question. I am now getting the above...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.