Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Windows GUI .exe application

I have a C/C++ algorithm that I want to create a GUI application for. I would prefer a .exe application that I can pass around to people. I would preferably want to create a dll of my c/c++ algorithm and then bundle it into the Windows GUI application which is basically just a wrapper around the main c/c++ application. How can I create this GUI in VC++ all with a couple of buttons, a text box and a file chooser/browser/opener?

Can someone throw some light on this problem?

Thanks,

Abhishek

like image 520
Abhishek Avatar asked Dec 05 '25 07:12

Abhishek


1 Answers

There's a number of different options. First we have the microsoft-supported libraries:

  • MFC - The most heavy-weight library for the windows api.
  • ATL - A somewhat smaller, lightweight library.
  • Windows API - Use the Windows API directly.

Beyond that there's a number of third party GUI toolkits, notably:

  • GTK+
  • WxWidgets

If you want to make it as small as compact as possible and avoid external DLLs, you should use the Windows API directly or possibly ATL. This also gives you additional flexibility, but it's a bit more complicated. Take a look at for example theForger's tutorial. It's a bit old, but the api has remained more or less the same for the last ten years anyway.

Here's some additional pointers for using the API directly:

  • What is usually known as controls is called "windows" and are created using CreateWindowEx(). This function creates different things depending on the specified "window class", such as edit, button and static (described below). You create a regular window by registering a custom class.
  • You can use a function called GetOpenFileName() to invoke an open dialog.
  • The common text box is known as the edit control in the API.
  • Buttons are simply called button controls.
  • Labels are called static controls.
  • If it's enough for your purposes, you can also create a dialog window using CreateDialog(). This is possibly a bit easier, since dialogs can be designed using the resource editor, while you have to create all the controls in a regular window programmatically.
like image 113
Emil H Avatar answered Dec 07 '25 19:12

Emil H



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!