Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I start MFC with empty project? [closed]

Tags:

c++

c

mfc

I'm learning about MFC.

Now I want to develop simple GUI Application, but there's a problem

First, How can I create empty MFC project? Visual Studio 2013 always give me a sample project, but I don't want it. I don't want to understand sample codes and edit it. I just want to write a simple project code by self from hello world.

Second, Is there a difference between starting with a empty mfc project, starting with a WIN32 application mode?

Third, I want develop a program with custom UI design, then Can't I use 'Dialog-based Mode'? Someone said me that "In dialog-base mode, It's hard to use Custom Design". Is it really?

like image 867
user3867261 Avatar asked Nov 22 '22 15:11

user3867261


1 Answers

A completely empty MFC project would be somewhat pointless because you would need to add back in the things that the sample code already has. For instance, every MFC program has a CWinApp-derived class and usually some kind of main window class (whether dialog or frame window). It might be easier to start learning the framework when you already have something working that you can edit, rather than trying figure out how to put the basic pieces together from scratch. But either way, you probably would want to get ahold of a good book to help explain the framework.

A Win32 Application sets up basic example code that only uses the raw Windows API (which is what MFC is built on top of and wraps). The WinAPI is very C-like. Out of the box, there are no classes or such things to make life easier. You would have to learn how to make them yourself... or use something like MFC since that's exactly what it is - classes the wrap the Windows API to make it easier.

"Custom UI design" is a rather vague phrase. Just what all are you trying to customize? Layout? Colors? Animations? Fundamental control logic? A dialog-based program is one of the simpler kinds, so if nothing else it's at least easier to start learning with. But as far as customization goes, it really just depends on what you're aiming to do.

Really though, MFC or the Windows API itself isn't all that great when you want to customize a lot of stuff. Sometimes you end up having to take over and re-implement more functionality that you would expect just to customize one little piece. Furthermore, even sticking to the stock controls and behaviors there's a lot left to be desired, such as a good sizing/layout framework. MFC was created a long time ago and in some ways hasn't been enhanced to keep up with the features people need/want/expect from the GUI framework these days.

Personally, I would recommend investigating other newer and more-feature rich GUI frameworks. In the C++ world, Qt is a notable one. In C#, WPF has a lot a nice things about it. For myself, even though I work in MFC all day long at my job, I usually do my personal projects in C#/WPF.

like image 152
TheUndeadFish Avatar answered Nov 25 '22 06:11

TheUndeadFish