?
Solved

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

Posted on 2006-06-21
1
Medium Priority
?
492 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

777 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