Making GUIs?

Ok, while trying to figure out how to make a GUI with C++ I came across a few terms that I needed to know. I tried looking them up, but the definitions were too complicated for me to understand. Please give answers that aren't dictionary definitions or I won't understand:

MFC
API
Windows Forms Application
.Net
CLI

If you could help me understand what each of those things are, I would greatly appreciate it!
closed account (z05DSL3A)
gsingh2011,

If you did not understand the answers given in your last post, (http://www.cplusplus.com/forum/beginner/2500/) It would have been better to say that you do not understand the answer there rather than start a fresh new thread.
Grey Wolf: sorry about that, I just thought there it would be more clear if I did it like this. I won't do it again.

Zaita: I'm not so lazy as too not even try to understand them on my own. In fact, wikipedia was the first place I tried. But the answers don't make complete sense to me.

Ok, I'm just going to say what I think each term means, and correct me if I'm wrong.

MFC and Windows Forms Application - When you use these a window is already made for you. I don't see the difference though... Are there any functions specific to each one? Is that the difference?

API - As far as I know, certain functions that draw stuff... So are these functions used in MFC and Windows Forms Applications?

.NET and CLI - I've looked but I really have no clue... could someone explain these in simple terms?

All of these could be wrong, so don't be mad when they are, I tried...
I'm afraid you are wrong on these.
Basically there are a number of different ways of creating the visual side of your application on Windows.
MFC is the 'old' way of doing things, pre .NET
.Net (=CLI) is a 'new' way of doing things that makes a bunch of changes to how C++ works
Both involve including a set of libraries and then using them to create the relevant classes for your forms and invoking the relevant methods where required.
Follow the links Zaita has provided and you'll get more detail.
Note that the above are all using MS - if you are using a different compiler you might need a different library again!
So which you choose may be dictated by the compiler - if it's VC++ 2008 Express then you are stuck with CLI & .NET for GUI work, fi you have Visual Studio 2005 or 2008 you have more choices, if it's Visual Studio pre 2005 then the .Net will be using'Managed Extensions' instead of CLI (probably best not to go there), etc.
closed account (z05DSL3A)
gsingh2011,

I just thought there it would be more clear if I did it like this. I won't do it again.

It's not a major problem, it just helps other to see where you are coming from, the other thing you could have done it to put a link back the other thread.

API
An application programming interface (API) is a set of declarations of the functions (or procedures) that an operating system, library or service provides to support requests made by computer programs.

So in it's simpelest terms, the API is the functions that you can call as a programmer. So when we talk about Windows API, we are just talking about the group of functions that Microsoft has made available for us to use for our programs to get Windows to do what we want. If you download a library to handle file compression, the API for that library is the set of functions that allow you to use the library in your code.

.Net
The Microsoft .NET Framework...How do you describe the .NET Framework easily? The .NET Framework is not a single entity; it is a conglomeration of different parts. It is similar to Java in its concept. When you compile a program with one of the .NET languages the code is compiled into an intermediate Language called Common Intermediate Language (CIL). When the program is run buy the common runtime engine this CIL is compiled into Native code using Just-in-time compilation (JIT). The combination these concepts is referred to as the Common Language Infrastructure (CLI), and finally the implementation of the CLI, by Microsoft, is called the Common Language Runtime (CLR). NB. Don’t get confused between C++/CLI and CLI, C++/CLI is a programming language.

Another pat of the .NET framework is the Framework Class Library (FCL) for now just think of it as being similar to STL, It is full of classes that encapsulate common functions and activities, such as rendering graphics, working with files…

Another part of .NET is Windows Forms. Basically when it come to user interface development in .NET you have two choices ASP.net and Windows Forms. ASP.net is your web based stuff and Windows Forms is your local machine. So a Windows Forms Application is one that used the .NET framework and is design to run on a PC with a user interacting with the screen interface.


MFC
Microsoft Foundation Class Library (MFC) is not .NET, basically it is a framework of classes that is design to group together various Windows API calls into logical units of abstraction, so all the functions to do with managing a window on the screen are grouped together into a class to represent a window.

____
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 .NET / Managed Development  │ Native / unmanaged Development
                             │
╔════════╗╔════════════════╗ │
║  .net  ║║.Net Dev Tools  ║ │
║   App  ║║ C#, C++/CLI,...║ │
╚════════╝╚════════════════╝ │
╔══════════════════════════╗ │ ╔═══════════════════════╗
║       .NET Framework     ║ │ ║ Widows development    ║
║┌──────────────┐┌────────┐║ │ ╚═════════════╗ tools   ║
║│Windows forms ││ ASP.net│║ │ ╔═══════════╗ ║C++,...  ║
║└──────────────┘└────────┘║ │ ║  MFC App  ║ ║         ║
║┌────────────────────────┐║ │ ╚═══════════╝ ║         ║
║│Framework Class Library │║ │ ╔═══════════╗ ║         ║
║└────────────────────────┘║ │ ║Microsoft  ║ ╚═════════╝
║┌────────────────────────┐║ │ ║Foundation ║ ╔═════════╗
║│Common Language Runtime │║ │ ║Class (MFC)║ ║ ‘Pure’  ║
║└────────────────────────┘║ │ ║Library    ║ ║ API App ║
╚══════════════════════════╝ │ ╚═══════════╝ ╚═════════╝
╔══════════════════════════════════════════════════════╗
║                       Windows API                    ║
║                  (windows XP, Vista…)                ║
╚══════════════════════════════════════════════════════╝
╔══════════════════════════════════════════════════════╗
║                      PC Hardware                     ║
╚══════════════════════════════════════════════════════╝


I think that about covers it…welcome to the world of Microsoft and the TLA...

When Microsoft first started talking about .NET, I drew a mind map[1] of how all the bits fitted together. Maybe doing somthing similar (drawing a diagram) would help you.

HTH

[1] http://en.wikipedia.org/wiki/Mindmap
Last edited on
Ok, I think I have a better handle on it. Let me just check.

API is any and every function a programmer can call?

MFC is a bunch of classes grouping certain API functions together? Your example
so all the functions to do with managing a window on the screen are grouped together into a class to represent a window.
, there are more groupings than that, right? That's just an example of one way MFC groups these API functions.

.NET is written with a language called C++/CLI. I'm assuming that this is similar to C++ but with a few differences, correct? This can be used to make ASP.net for web based stuff, and Windows forms for stuff on your comp.

Thanks so far, once these things are cleared up I think I'll understand the basics.

I just remembered two more questions: Is .NET the preferred way of making GUI's in C++? When you say Windows API does that mean there are certain functions in C++ that only work on different operating systems?
MFC I wouldn't worry about learning. It was used pre .NET with Microsoft Visual C++ 6.0. Chances are you shouldn't be using that.

.NET is a platform environment for running applications compiled into CLI. It's very similar to Java's Runtime Environment that runs Java Compiled Byte-Code. The Microsoft .NET Compiler will compile C++/C#/VB.NET or J# into CLI.

Windows has it's own API set. You can use some of these API calls to create windows and forms manually. If you are working in Visual Studio, you can use Windows Forms (.NET V1 and V2) or WPL (.NET V3).

Windows API calls only work on Windows.

If you wanted to use another compiler or run it on something like Linux, you will need to get an independent GUI Toolkit (e.g. WxWidgets, GTK, QT, FLTK)
Last set of questions (hopefully). Thanks so far.

1. Are API calls the functions specific to making programs on an operating system, like windows? So in general not every function, but a set of them that you can only use when making a windows app for example?

2. So you use API calls in C++ when doing anything in windows correct? So when you're doing something in .Net, you're using C++/CLI and using API calls here?

3. So is it correct that .Net is the most common way of making GUI's in C++ or is there a more preferred way?
1) Yes. But when you interact with any library you are using that libraries API to call functions. API is a schematic (design) of the functions you can call on a library/object/component.

2) Yes they are. Not just windows, but any library etc

3) NO. .NET is a Microsoft Framework that "in theory" allows for multi-platform development. It has nothing to do with making a GUI. Visual C++ (Microsoft's C++ implementation) allows you access to Microsoft's Visual Components (Windows Forms and WPL).

In C++, there really isn't a "most common" way to make a GUI. This is one of the problems with it (some ppl will say choice makes blah blah but in reality, even the inventor of C++ would like a standard GUI if they had time).

Some ones you can look at are:
FLTK - Fast Light Toolkit
WxWidgets - Multiplatform GUI
GTK - Multiplatform GUI
QT - Same as above.
Visual C++ - Only on Windows

It's really upto you and what your comfortable with.
Topic archived. No new replies allowed.