Solved

Using AddressOf to call function in VC++ DLL from VB

Posted on 2006-06-21
1
475 Views
Last Modified: 2008-02-26
Been given a third party DLL written in Visual C++
This DLL have a method to enable a client to give the address of a callback method.
A DLL's background thread calls the client's callback when some events occur.

I am given the following details, not sure what to make of it since i do not know VC++ :-
int openDevice(int typ, CALLBACKBCOM cbf, void* param=NULL)
where the parameters
cbf specifies the user callback procedure with definition: typedef void (CALLBACKCOM)(int nStatus, int nTracks)

How can i write a VB program to get data making use of the operator AddressOf? I am not familiar with VB's CallBack although i have gone through some samples on this site.

Some sample code would be appreciated.

Thanks,
Joanne
0
Comment
Question by:BSKhoo
1 Comment
 
LVL 26

Accepted Solution

by:
EDDYKT earned 250 total points
ID: 16951190
how about

Public Sub callback_function(ByVal nStatus As Long, ByVal nTracks As Long)
     ' Do your stuff
End Sub

dim Ret as long

Ret = openDevice(1, AddressOf (callback_function))
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now