

Tips used for Top Tips come from the ExtremeTech forum and are written by our community.

Question from cmmig

“What is the best way to write a GUI for C++. I am using Dev-C++ as an IDE. Would something like MS Visual C++ help for GUIs?”

Answer from DeadeyeFlint

“Nope. The best way to write a GUI for windows-only app is to use the win32 API, or if you don’t like to code the GUI too much, use Visual Basic.

Personally, I prefer win32 coz I like to get my hands dirty, so to speak. BUT it takes some time to get the hang of it. If you just want a quick (I wanted to say “and clean”, but I’m not so sure how clean it is…) way to just make a GUI with no regards for performance (generally its not noticeable anyways) and the need to install VB run-time on user computer, then just use Visual Basic.”

Answer from solutn_searchr

“So long as you are not writing a game, your best bet is to use Visual Basic to develop the GUI and Visual C++ for the engine.

Visual Basic will let you create a GUI quickly. It isn’t super fast, so if your application requires a lot of calculations, you’ll need C++. Also, VB GUIs are stable and responsive without all the effort needed when doing it exclusively through the Win API. The GUIs are plenty fast enough to be interactive, but if you are trying to find the 10 trillionth digit of PI, you’d let someone enter the desired precision and then click a VB button that calls a C++ Dll function to do the computation.

The C++ component can be a Dll or a COM component.

The Win API should be a last resort. It is complicated. That’s why MS developed VB, to make it palatable to people who aren’t into self torture if they don’t have to.”

Got a better answer? Post it in the discussion that generated this tip.