473,664 Members | 3,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ImageFirstImage Callback(ByVal hWnd As Integer, ByVal iMsg As
Integer, ByVal wParam As Integer, ByVal LParam As Integer) As Integer
'Code here
End Function

Public Function ImageFirstSortC allback(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 fsmScanImageFir st& Lib "FSMFUJI.dl l" (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
strDocumentStat us$, _
ByVal
funcSortCallBac k&, ByVal funcImageCallBa ck&)

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

g_Error = fsmScanImageFir st(vbNullString , lngBatchSize, 1, vbNullString,
vbNullString, vbNullString, vbNullString, 0, strMICRText, strOCRText,
lngPocketRet, lngUnitNum, lngMICRStatus, 7, strDocStatus.Va lue, AddressOf
ImageFirstImage Callback, AddressOf ImageFirstImage Callback) '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 'fsmScanImageFi rst' can be
called with these arguments:
'Declare Ansi Function fsmScanImageFir st Lib "FSMFUJI.dll"(s trFileName
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, strDocumentStat us As String,
funcSortCallBac k As Integer, funcImageCallBa ck As Integer) As Integer':
'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is
not a delegate type.
'Declare Ansi Function fsmScanImageFir st Lib "FSMFUJI.dll"(s trFileName
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, strDocumentStat us As String,
funcSortCallBac k As Integer, funcImageCallBa ck As Integer) As Integer':
'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is
not a delegate type.
'Declare Ansi Function fsmScanImageFir st Lib "FSMFUJI.dll"(s trFileName
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, strDocumentStat us As String, funcSortCallBac k As Long,
funcImageCallBa ck As Long) As Long': 'AddressOf' expression cannot be
converted to 'Long' because 'Long' is not a delegate type.
'Declare Ansi Function fsmScanImageFir st Lib "FSMFUJI.dll"(s trFileName
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, strDocumentStat us As String, funcSortCallBac k As Long,
funcImageCallBa ck As Long) As Long': 'AddressOf' expression cannot be
converted to 'Long' because 'Long' is not a delegate type.
Nov 20 '05 #1
4 1951
"ItsMe" <kk*@yahoo.co m> 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.co m> 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*******@free net.de> wrote in message
news:40******** *************** @news.freenet.d e...
"ItsMe" <kk*@yahoo.co m> 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.co m> 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
4739
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 appreciated. Thanks in advance
6
1465
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 re-populates the table before doing anything; which I don't want. Following is the code. private sub page_load(.......) ' if ispostback = false then populatetable
2
5304
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 Handler code is there, when I create the inherited form I get the error "Object Reference not set to an instance of an object". If it is not I get no error. I have tried leaving this code in the forms Sub New, but it produces the
4
278
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 single sub/function. \\\ Public currentdomain As AppDomain
2
2242
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 Me.bytesDownloadedTextBox.Text = "" Me.totalBytesTextBox.Text = ""
2
2662
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: c:\inetpub\wwwroot\admin\filemanager.aspx.vb(76): Expression is of type 'System.Web.UI.HtmlControls.HtmlInputFile', which is not a collection type.
8
1784
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 StreamWriter = File.AppendText(strInputE) srE.WriteLine(vbCr) srE.WriteLine(vbCr) srE.WriteLine(DateTime.Now)
5
1732
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 MyControl3.Parent.Paint, AddressOf PaintParentHandler AddHandler MyControl4.Parent.Paint, AddressOf PaintParentHandler AddHandler MyControl5.Parent.Paint, AddressOf PaintParentHandler
0
1336
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 error message. I need help with the format of the SQLAdapter.Update(DSet.Tables(0)) command. I have included my code below. The line is in bold text. Imports System Imports System.Reflection Imports System.Text Imports System.Collections...
0
8437
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8861
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.