using windows controls with unmanaged code

We have a legacy application, written in C++ and ADO, that requires constant care.  Rather than continue to apply band-aids to this application, I would like to write new pieces in C# and ADO.Net.

I am not experienced with inter-operabilty issues regarding .Net and other legacy code.  My question is, what hurdles should I expect, or look for, when trying to develop applications that will call a .Net module   Are there any inter-operability issues that I need to design for

It appears that .Net handles calling legacy apps from .Net well but, is there a web site (or articles, knowledgebase, etc) that addresses calling .Net from legacy apps

thanks


Answer this question

using windows controls with unmanaged code

  • DKramer

    Yes I'm sure they are out there, though I can tell you I didn't find much.

    Your lucky in that there is a bit more on how to do it with C# then vb.net. Though you can do it with either.

    The issue is, in order to call .Net code from unmanaged C++ you must make the .net code in a com component. 

    Then you just use it like you would any com component.

    With C# you can pass the variables to it and use pointers and casting to get the values.

    In VB.Net they have a special marshal class to handle this.

    Hope this info helps.

    Pain in the butt if you ask me. Any time you add new features to the COm I had to delete the Isn (think that's it, the intelisense database) of my c++ project. Then reopen the project and it would recreate the file in question. I had to do this so that the new routines would show up in intelesense in c++.

    Of course I was using Vs.Net C++ in Unmanaged Mode.


  • using windows controls with unmanaged code