Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

c#

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 ?

like image 853
fex Avatar asked May 25 '12 21:05

fex


People also ask

Can I make GUI in C?

Let us comprehend a couple of things from our first GTK code in C. To start with, we incorporate the header file. This incorporates all the file one needs to make a GUI, including the Glib library. Presently, we declare a pointer to GtkWidget, which is only a window for our situation.

Does C have GUI library?

You can use GTK+ on Linux, and the Windows API on Windows. Both are C-based APIs, which allow you to create GUI programs. There's also a library called libui, which abstracts away the APIs of each platform, allowing you to create cross-platform GUI apps in C that run on Windows, Mac OS X, and Linux.

Which language has GUI?

Java seems to have the best built in support for GUI programming, however, C++ using the MFC libraries has more than adequate tools for GUI development and may be a better choice when speed and efficiency are important.


1 Answers

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.

like image 119
Sean U Avatar answered Oct 10 '22 04:10

Sean U