Click to See Complete Forum and Search --> : C++ code for a VB app. Dll?


SFletch
March 6th, 2009, 12:16 PM
I wrote, some time ago, a C++ dialog app that communicates via sockets with some specialist hardware/software, really just as a demo.

I need to re-write it to act as a comms layer between said hardware and a new VB app.
It needs to be permanantly loaded and receiving comms from the hardware (onto a queue) and pass those messages on to the VB when requested (pop off the queue).

I imagine the VB will..

Startup
Load MyApp
every n seconds MyApp.GetMessages()
UnLoad MyApp
End.


I'm really struggling as to how to even approach this. Any advice / pointers would be gratefully received.

The existing app uses MFC and STL::Queue. I'm assuming all that would be wrapped up in the dll and any app that uses it wouldn't care?

The example dll's I've looked at just seem to be function calls; pass in an int and it passes back double that int, for example. I'm sort of confused about the life of the object.

darwen
March 6th, 2009, 07:03 PM
By VB app what do you mean ? VB.NET ?


I'm assuming all that would be wrapped up in the dll and any app that uses it wouldn't care?


If it's written in .NET then yes no other .NET application will care.

How good is your COM ? You can take the relevant code from your original app, write a COM object to wrap them and then interface with that from VB.NET.

Or turn your relevant code from your original object into a C++ class, create a C++/CLI project and write a wrapper class in .NET so the VB.NET application can access the data.

Either way you're going to have to learn something new it sounds like...

Darwen.

SFletch
March 8th, 2009, 03:22 PM
It's not VB.NET - just VB. Although I said it was a new app, it's actually a re-incarnation of an existing application.

The other approach that has been mentioned is to link it as an 'obj'.

I don't know how to do this, particularly as the existing application is dialog based. Perhaps if I could rewrite it as a command line app....

darwen
March 9th, 2009, 08:26 PM
If this is going to communicate with a VB6 app then write COM objects (see ATL wizard) and stay away from .NET until you know what you're doing.

Darwen.