How do I create a non managed Windows GUI in Visual C++?
Solution 1
As Reed Copsey, MFC would be the "default" way of creating a native unmanaged GUI on the Windows platform. However, MFC is not included with Visual Studio Express. Consequently, you would either need to upgrade to the full version or you could look into using a freely available C++ GUI library such as wxWidgets.
There is also wxFormsBuilder if you want a GUI editor.
You could also go down to the "bare metal" and code right to the Win32 API, maybe take some help from the common controls library. But you'll be entering a world of pain ;)
Solution 2
Either use MFC, WTL, or straight Win32 API. You can't use forms (or any of .NET) without switching into managed code.
- MFC is Microsoft Foundation Classes - the most common C++ windows library
- WTL is Windows Template library - a better C++ windows library IMO
- Win32 is CreateWindow, DialogBox, etc, everything else is a wrapper around the Win32 api.
Solution 3
This is an answer to the linked question. Unfortunately, that has been closed by Robert Harvey because he thinks it is a duplicate. It is not, sorry Bob.
The best library for creating xll's is http://xll.codeplex.com. You can use that to create rudimentary user interfaces using Excel macros. One example of that can be found in the ALERT.FILTER macro in xll/error.cpp
Solution 4
You just need to avoid the managed libraries. Most likely, this will mean using MFC for the GUI, instead of Windows Forms. For details, see MSDN's MFC pages.
Unfortunately, VC++ Express Edition doesn't support MFC directly, so you'll have be more limited. It is possible to compile MFC projects using the Express Edition, but you lose all of the Wizards, etc. If you are serious about doing non-managed GUI development, you should consider upgrading to a higher level SKU.
Another option would be to use Qt for for GUI. It is now LGPL, so usable, for free, in even commercial C++ projects, and includes a full designer.
Dataflashsabot
Updated on June 04, 2022Comments
-
Dataflashsabot almost 2 years
When I create a 'Windows Forms Application', the resultant program is a managed one. Creating a 'Win32 Application' results in a native one, but when I try to add a form I'm informed that the project will be converted to CLI if I continue. How do I design a native Windows GUI with Visual C++ 2008 Express Edition? I'm probably being very silly here, but I just can't figure it out.
-
Reed Copsey about 14 yearsThe "Wizard" doesn't exist in Express Edition - unfortunately, MFC (and WTL) code is not supported (directly) in VC++ Express.
-
Dataflashsabot about 14 yearsThank you, but MFC isn't included with Express. I suppose I could just use wxWidgets or the like, but then that's not very 'visual'.
-
Jerry Coffin about 14 years@Reed:I'll have to take your word for that. I played with the Express Edition at one point, and seemed to recall it's being able to create an MFC project, but 1) it could be my bad memory, or 2) something arising from my already having another edition installed. My recollection was that it only supported MFC in a DLL rather than statically linked, but that was the primary limitation.
-
Rabeel about 14 yearsIt may not be visual, Reed does tell you how to do write a GUI C++ app with VS 2005 Express.
-
Reed Copsey about 14 years@Dataflashsabot: I'd recommend considering Qt, then. It's very nice for making native C++ GUIs, and does include a designer. I edited my answer to reflect this option, and included a link
-
Dataflashsabot about 14 yearsAh, I see. I was hoping there'd be a non-MFC native designer. I'll look into wxWidgets or qt. Thanks for all replies.
-
Greg Domjan about 14 yearsAdding to the answer - CreateWindow and DialogBox type functions may take a dialog template resource. You can use the resource editor to add new and edit using the graphical window editor.
-
Alex Budovski about 14 yearsThere is a non-MFC native designer. It's called the Resource Editor.
-
Violet Giraffe about 11 yearsWhat about XAML? Any specific reason there's no mention of it neither in this question nor in the other similar ones?
-
T.E.D. over 10 yearsUpvoting just because I absolutely hate it when mods blindly do stuff like this. My personal favorite is downvotes for being off-topic when my answer got merged with another question that was wrongly judged an "exact duplicate" (Hint: if any of the answers magically become off-topic, the question isn't a duplicate, no matter what 5 random SE users think).
-
Keith A. Lewis over 10 yearsTo their credit, they seem to be getting better at this lately. Why they don't allow input on their decisions is a mystery to me.