Alex Rivera | Logout

Is it possible? GUI in c# , app in C++

Asked 2012-05-25T21:39:57.613
8

Is it even possible to create GUI layer in C# and rest of application in C++? If I am not wrong one of antyvirus software had GUI made in Delphi. How it could be done ?

Edit
Report

2 Answers

6

You have several options for doing it, including:

  1. Use P/Invoke to call into the C++ DLL from C#.
  2. Expose a COM interface from the native code, and call it from C# using COM interop.
  3. Write a native Windows service and call into it from managed code.
  4. Use C++/CLI to write a managed library in C++, which you can easily link to from C#.

If you're starting from scratch, option 4 is probably your best option. (Aside from just writing the whole thing in C#, that is.) The first three options all involve some additional wrangling and overhead, and probably aren't worth the hassle if you don't have a compelling reason such as needing to interact with an existing native library or having some need for a service-oriented architecture.

answered 2012-05-25T21:58:39.400
3

write the app logic in c++ dll, then use pinvoke from c# to talk to the dll.

answered 2012-05-25T21:42:21.793

Your Answer