使用c ++的图形用户界面 [英] Graphical user interface using c++
本文介绍了使用c ++的图形用户界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用c ++编写图形用户界面吗?
解决方案
使用C ++创建GUI有几个选项。我猜你正在使用Windows(你应该提到它并且尽可能多地使用它)。因此,最常见的选项是:
1. Win32 API(Windows上所有其他API /库的基础)。
2 .MFC / WTL ..(Windows特定的GUI库)
3. QT / GTK + ...(跨平台GUI库)
4. .Net with C ++(托管C ++)
操作系统由其API为程序员描述。因此在Windows上,连接操作系统和软件的层是Win32 API(还包括创建GUI)。 Windows API(Win32 API的另一个名称)比其他框架(MFC,QT ....)更快,但它的代码比其他可用的框架要多。所以我看到的Win32 API的唯一内容就是需要花费更多的时间和精力来开发。
注意: API是影响程序执行速度的因素中最少的因素。如果你不正确编写代码,一些.Net程序可能比某些Win32程序更快。
所有其他框架和API(MFC,QT,GTK +,。Net) ,WTL,ATL,.....)构建于Win32 API之上。 MFC只是一个厚层,它将Win32 API包装到C ++类中(因为Win32 API是纯C语言),因此编程更容易。
QT和GTK +是跨平台的。在编译不同的平台时,你不需要(在很多情况下并不总是)更改你的代码。
我认为使用C ++并不是那么有效。 NET,因为你可以使用C#和.Net。
如果你先学习Win32 API,你就会更多地了解操作系统的工作原理。通常,如果您要使用MFC和/或WTL,您应该首先学习Win32 API。学习QT和/或GTK +将是最简单的。这些天更推荐Qt。如果您想快速创建GUI,Qt很棒。
资源:
1. Win32 API - 编程Windows - Charles Petzhold (供参考)
2。 MFC - google for tutorials(一旦你理解了Win32中的内容,MFC就很容易了)
3.对于QT / GTK +,他们在网上有很多教程。
是。请参阅 http://msdn.microsoft.com/en-us/library/ dd145203(v = vs.85).aspx [ ^ ]和 http://msdn.microsoft.com/en-us/library/ms533798(v=vs.85).aspx [ ^ ]。
can i code Graphical User Interface using c++?
解决方案
There're a few options for creating GUIs using C++. I guess you are using Windows(you should've mentioned it and as many use it). So the most common options available are;
1. The Win32 API (Base of all other APIs/Libraries on Windows).
2. MFC/WTL.. (Windows specific GUI libraries)
3. QT/GTK+... (Cross-Platform GUI libraries)
4. .Net with C++ (Managed C++)
An operating system is described by its API for the programmer. So on Windows the layer which connects the operating system and a software is the Win32 API (which also includes creating GUIs). Windows API(another name for Win32 API) is faster than other frameworks (MFC, QT....) but it's a lot of code than other frameworks which are available. So the only con of the Win32 API i see is that it takes much more time and effort to develop with.
Note:API is the least of many factors which affects the execution speed of a program. Some .Net programs can be faster than some Win32 programs if you do not write code properly.
All the other frameworks and APIs (MFC, QT, GTK+, .Net, WTL, ATL,.....) are build on top of the Win32 API. MFC is just a thick layer which wraps the Win32 API into C++ classes (since Win32 API is in pure C) making it somewhat easier to program with.
QT and GTK+ are cross-platform. You don't need to (in many cases and not always) change your code when compiling for different platforms.
I think it's not so effective to use C++ with .NET, because you can use C# with .Net.
If you learn the Win32 API first, you'll understand more about how an OS works. Generally if you're going to use MFC and/or WTL you should learn the Win32 API first. Learning QT and/or GTK+ will be the easiest. Qt is more recommended these days. Qt is great if you quickly want to create a GUI.
Resources:
1. Win32 API - Programming Windows - Charles Petzhold (for reference)
2. MFC - google for tutorials (MFC is very easy once you understand something in Win32)
3. For QT/GTK+ they're a lot of tutorials online.
Yes. See http://msdn.microsoft.com/en-us/library/dd145203(v=vs.85).aspx[^], and http://msdn.microsoft.com/en-us/library/ms533798(v=vs.85).aspx[^].
这篇关于使用c ++的图形用户界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文