Getting your native code user interfaces into a .NET/C# application
Posted: (EET/GMT+2)
I received a question today from the field asking a question regarding native code and .NET interoperation. The more precise question was, how to take existing native code UIs so that they can be a functional part of an otherwise .NET based application written in C#. In this case, there's a legacy financial application written in Delphi, and new work is set out to be done in C#.
Now, the obvious question is: would it be better to simply transport the logic (calculations) from the native code application into C#, and then use .NET to build all the user interfaces? Although this sounds like a better concept, in native language applications, the original internal architecture might not make this separation of the UI and the logic trivial. Also, the original development environments might not anymore be available for the latest Windows versions, leading developers only to utilize Windows XP based old systems.
No matter the situation, two technologies in the C# toolbox come into mind: Platform Invoke (P/Invoke) and COM (Component Object Model). Both technologies have their benefits (and limitations), and in the case of Delphi, wrapping the original UIs (and logic) into COM objects might be the easiest way to get started.
In addition to getting back to the original requester, I thought I'd share this short answer here. Hope this helps!