How do I create a non managed Windows GUI in Visual C++?

12,376

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.

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.

Share:
12,376
Dataflashsabot
Author by

Dataflashsabot

Updated on June 04, 2022

Comments

  • Dataflashsabot
    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
    Reed Copsey about 14 years
    The "Wizard" doesn't exist in Express Edition - unfortunately, MFC (and WTL) code is not supported (directly) in VC++ Express.
  • Dataflashsabot
    Dataflashsabot about 14 years
    Thank 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
    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
    Rabeel about 14 years
    It may not be visual, Reed does tell you how to do write a GUI C++ app with VS 2005 Express.
  • Reed Copsey
    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
    Dataflashsabot about 14 years
    Ah, 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
    Greg Domjan about 14 years
    Adding 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
    Alex Budovski about 14 years
    There is a non-MFC native designer. It's called the Resource Editor.
  • Violet Giraffe
    Violet Giraffe about 11 years
    What about XAML? Any specific reason there's no mention of it neither in this question nor in the other similar ones?
  • T.E.D.
    T.E.D. over 10 years
    Upvoting 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
    Keith A. Lewis over 10 years
    To 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.