Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / help me with decision, .NET or MFC Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

March 05, 2005, 03:17 AM

i have to make an window application with with multiple windows. i want the delphi like GUI (one main window and multiple other windows floating around). is it MDI application or not?

i am deciding between .NET and MFC for GUI. those windows will contain an openGL accelerated window a and the app must have high performance (mainly the rendering). and i want to use STL.

in .NET i am not sure if it is possible to place an STL container into a managed class and other such things.

help me please with this decesion. post pros and cons of .NET and MFC for this kind of app.

thank you

ps: i am familiar with ogl


March 05, 2005, 04:13 AM

I'm guessing that you don't want to wait around until Visual Studio.NET 2005, where STL.NET is implemented. Using STL with managed extensions can be tricky today, a few pointers on how to do it is found at

That seems like like a lot of hassle to me, so I'd either use the classes already in the framework, since they do most of the things you normally use STL for, or I'd go with MFC.

Your choice :)


March 05, 2005, 04:23 AM

Oh, and no, what you're describing isn't MDI. It sounds more like a standard dialog-based application. MDI is something that looks like for example MS Word. Several documents placed in one windows.


March 05, 2005, 04:25 AM

Personally I still avoid .NET because it isn't that widespread yet...
Not everyone has the framework installed yet, or can be bothered to install it.
That's why I still use MFC at this point, at least I know that my applications will run on virtually all Windows installations as-is.

But I hope to move to .NET eventually.


March 05, 2005, 04:27 AM

thanks for that link.

and i have ontoher question and that is about performance of that solution, because i need it for fast openGL rendering.


March 05, 2005, 04:29 AM

i know, that MDI applications look different, i just asked if that thing could be achieved with MDI app.


March 05, 2005, 05:19 AM

Well, the performance of the GUI-code isn't really that important, it's a drop in the ocean. .NET and MFC has pretty much the same performance, and .NET will evwentually outperform MFC, due to hotspot optimizations during JIT'ing and so on.
MDI will always look like MS Word, you don't really have a choice ;)
MDI is a jungle aswell, you'd probably want to stick with a dlg-based application.


March 05, 2005, 05:30 AM

i know that GUI performance will be nearly the same, but i need openGL rendering. so how is it to combine managed C++ with opengl. i will render only when needed and it could be tousands of lines (yes, only lines). i want to use at least vertex arrays, but better will be VBO.


March 05, 2005, 05:40 AM

Well, you could always use native code for the most performance-critical parts of the application... OpenGL itself is unmanaged anyway, so you'd need native code there, you could pull the performance-critical part into that unmanaged part...
Other than that I'd say that .NET code will get 10% to about 90% performance of native code, depending on what you do, and how you write it (and once the VM matures, we may even see 100% or more... I hope :)).


March 05, 2005, 07:38 AM

another question. i don't know how to initialize an openGL windows. i'am trying to derive from panel but i am unsuccessfull. don't you know about any tutorials on MC++ and ogl? there are only C# and ogl tutorials that i have found :(


March 05, 2005, 08:29 AM

after two hours i did it :D (the ogl accelerated panel)

sorry for bothering.


March 05, 2005, 10:16 AM

Using a VBO isn't a problem. Or shouldn't be, it's not with D3D.
Make your GL-wrapping class unmanaged, and there won't be any performance hits.


March 05, 2005, 10:59 AM

how to make it unmanaged? (.NET programming is totally new to me, i am playing with it just for less then a week) now i derive glPanel form ...Forms::Panel. and it is managed class. i made test render with 1000 polygons in immediate mode and the render time is from 16 to 32 milliseconds, so its quiet satisfing (for now at least).


March 05, 2005, 11:47 AM

Im actually not sure how you declare it as unsafe :)
I just know it's possible, but I've never had the need for it.


March 05, 2005, 01:08 PM

We have an engine written in cpp and packaged into a DLL that we link with our .NET tools. These are written in managed C++ (not C#). Performance has never been a problem since the DLL code is still unmanaged, but we've had quite a few .NET issues.

Sometimes controls disappear from .NET forms, projects will build on one machine and not others, and every once and a while the compiler fails to give the line number that an error occured on. .NET applications also run *really* slowly in the debugger (sometimes it takes almost a second to step between two lines of code). This all adds up to a pretty frustrating experience.

MFC on the other hand is pretty good once you've learned all of the quirks (maybe that's still where I am with .NET), but it definitely has a big learning curve. Why don't you take a look at one of the freely available widget libraries out there?



March 05, 2005, 01:31 PM

i have wxWidgets (wxWindows), but i didn't try it. maybe i'll give it a try. there is also Qt, which, unlucky, is commercial for windows :(

now i have my glPanel derived from Panel and is runnig relatively fast. i'll see the real performance when i load some test data.

i have som provlems. i place a panel on my form and in the code i change its type to glPanel. everything runs fine, but visual studio is complainig about something and when i add anything on that form with form designer the gLpanel will go away :((


March 06, 2005, 01:17 AM

Probably a problem with the .NET form designer.
The form designer will call the code of your derived form class from the designer too. And in some cases that will have some trouble as depending code is not started.

There's a way to check if your form is started from the designer so you can opt to not initialize OpenGL for that case.


March 06, 2005, 04:09 AM

Do you just need a window to render OpenGL into? or do you need a full fledged Forms GUI (outside your OGL window) if it is the first you could just use the Windows API. Actually, you could use it either way, but once you get to a point that is not much fun.


March 06, 2005, 04:40 AM

i need GUI, if i didn't then i won't bother with .NET or MFC. for programs where i don't need GUI i use winAPI.

and this is what visual studia tells me:

The variable 'glPanel' is either undeclared or was never assigned.
Could not find 'managedOpenGL.GlControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project. make sure that the project has been successfully built.

the project was successfully built and is runnig fine, but when i add something in forms designer, then my glPanel goes away, from designer and from code, there just stays the declaration. i add it like this: a place in the designer a Panel a and then in the code i change its type to GlPanel. any suggestions what is wrong?

Brandon Bloom

March 06, 2005, 12:42 PM

MFC blows. If you want to use standard, cross-platform C++. Use

If you are building an in house tool or something like that. Use C#. C# is increadably well suited for GUI applications.


March 06, 2005, 01:16 PM

MFC blows, in the opinion of people who doesn't understand it.
Perhaps 5% of the people nagging about crossplatform ever compiles their application on another platform and uses it there, and considering he most likely uses other Win32 stuff, it won't be crossplatform even if he uses wxwidgets.
C# isn't more suited to GUI applications than C++.NET. It has the exact same components through the .NET Framework.


March 06, 2005, 03:45 PM

is there a free form designer for wxWidgets and what is the performance of it.

This thread contains 22 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.