Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I support C signal handlers in VB?

Status
Not open for further replies.

sgursahaney

Programmer
Jun 11, 2001
57
US
I have a need to develop a VB application that calls C functions get information. One of the functions allows me to specify a handler function that will be called every time a specific event occurs.

For example, in C to register the function I need to call:

sr_enbhdlr(devh, usEvtcd, (long int(*)()) alarm)

where alarm() is a C function that will be invoked when the specific usEvtcd is encountered.

I would like to invoke all of these functions from my VB application and have the handler call a function in my VB application rather than a C function. Does anybody know how I would specify the "alarm" function as a VB function rather than a C function?

Regards,
Suresh
 
Have you looked into making that part of your app an ActiveX.dll? Not 100% sure, but if you can set up a typical COM arcitecture, you should be able to use the VB app's abilities from C or VB like you normally would via COM.

Hope that helps!

-Mike Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
Actually, I stumbled upon a VB function called AddressOf that allows you to do "Callbacks". This looks like exactly what I want to do. Thanks anyway.

Regards,
Suresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top