Solved

C++ DLL which raises events in VB or C#/C++

Posted on 2010-08-22
2
925 Views
Last Modified: 2012-05-10
I'm looking for suggestions / tips on creating an oop c++ dll with a worker thread which will loop, do request info from a serial port and the trickiest part is raising an event from within a class object to a client application written in either VB or C#/C++. I've found examples of callbacks classes and understand how they work, an example of functors and I've got working examples of simple callbacks.

I'm looking for best practices with or without examples and suggestions on implementation to make this as flexible for clients as possible.
0
Comment
Question by:PmiDeveloper
2 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 125 total points
ID: 33508404
One simple way in which you can do it is using Atoms. I've written an article just on that. Please, read it and I hope that it will be useful to you.

Here's the link to the article:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/A_233-Inter-communicate-applications-with-Atoms.html?sfQueryTermInfo=1+30+atom

Hope that helps.
0
 
LVL 24

Assisted Solution

by:alexey_gusev
alexey_gusev earned 125 total points
ID: 33539646
depending on the nature of that 'port info' you can:

- pass callbacks to c++ dll and just call them whenever required
- send WM_COPY message from dll to the clients
- create COM c++ dll (ActiveX actually) with can fire events, and then handle these events in c#/vb.net
- use named events so clients can wait on their handles, but this doesn't give you any way to pass the data
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

948 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

20 Experts available now in Live!

Get 1:1 Help Now