Click here to Skip to main content
12,623,027 members (37,167 online)

Exchange method between OLE Dispatch C++ object and C# class.

SuperMiQi asked:

Open original thread
Hello Everyone,

I would like to share with you the following question I have in my mind about the migration procedure from the current code implemented in Visual Studio 6 to Visual Studio 201x.

The current VS6 application has a data layer based on OLE IDispatch interface.
This was to allow me to integrate Visual Basic 6 components into my main application and to exchange the data easily between these two languages.

Now come the time for migration and I would like to implement my application in c# under Visual Studio 2010.

All my current data are persist under compound files and under flat stream files.

I wonder if this is a good idea to duplicate the data layer to c# classes and via a translation method grab the data from the dispatch objects ?

What could you advise me about that strategy ?

Let's say I have the following set of ole automation objects:

All of them have a set of properties and methods.
They also have the IPersistStorage and IPersistStream interface available.

If I define c# classes let's say:


They will have maybe after cleanup more or less the same amount of methods and properties.

How would it be better to transmit the data between the objects and the classes in an efficient way ?

Here were my ideas:

1. Keep the current automation data model for the implementation of my c# application. This will avoid data translation. The problem is about the implementation of these automation object in the unmanaged side. Would this have an impact on the performance ?

2. Create based on the direction we want to go an automation object or a class via a data layer c# library where the main data set is persisted in memory. This can invoke certainly some performance issues. What about file loading or saving operations?

3. Implement the c# classes in a library as an envelop to the current ole automation objects. Use these automation objects to invoke properties, methods and to stored the current loaded/created data set. This will open ways to replace later on the required c# classes with their new functionality and data formats.

What do you think about these possible ideas ? Do you see other alternatives to cover that issue in an efficient way ?

Thank you very in advance.
Tags: VB6, C++, C#, .NET, Visual-Studio


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100