Solved

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

Posted on 2006-06-21
1
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Acccess - Update Field in Table when report is printed 6 51
vb6 connector to mongodb 2 141
Child Form in front 4 57
pop out of webbrowser1 control vba6 5 44
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

733 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