Solved

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

Posted on 2010-08-22
2
936 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

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…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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