如何从Windows开发开始?

时间:2022-09-11 19:43:26

I've been a Unix-based web programmer for years (Perl and PHP). I'm also competent with C and C++ (and bash and that sort of sysadmin sort of stuff) in terms of the language itself. I've never had a problem learning a new language (I mucked around with Java a few years ago and whilst I could write it I just didn't like it as a language).

我多年来一直是基于Unix的Web程序员(Perl和PHP)。就语言本身而言,我也能胜任C和C ++(以及bash和那种类型的系统管理员)。我从来没有遇到过学习一门新语言的问题(几年前我用Java捣乱了,虽然我可以写它但我不喜欢它作为一种语言)。

What I don't have any experience with is the vast array of frameworks that exist for writing graphical Windows applications.

我没有任何经验的是用于编写图形Windows应用程序的大量框架。

I have a few ideas for Windows-based applications that I want to work through. I could do this is Perl/TCL/TK but I want something more "native" for a variety of reasons.

我想了解一些基于Windows的应用程序的想法。我能做到这一点是Perl / TCL / TK,但出于各种原因,我想要一些更“原生”的东西。

Through my current company I have access to Microsoft tools (and the licences to use them for "development") so I've decided to teach myself something new.

通过我现在的公司,我可以访问Microsoft工具(以及用于“开发”的许可证),所以我决定自学一些新东西。

So, I've got Visual Studio 2008 installed. I fired it up, cliked "New Project" and then got absolutely confused by the variety of types of new project I could start.

所以,我已经安装了Visual Studio 2008。我解雇了它,匆匆忙忙做了“新项目”,然后对我可以开始的各种类型的新项目感到困惑。

Can someone please help me understand not only the fundemental differences but also any advice on what sort of things each type lends itself to?

有人可以帮助我了解不仅是有趣的差异,还有任何关于每种类型适合自己的东西的建议吗?

Assuming I'm going down the C++ route (I know the language hence not choosing C# - unless this is actually more advisable...) I could use:

假设我正在走C ++路线(我知道语言因此不选择C# - 除非这实际上更合适......)我可以使用:

  • Windows Forms
  • MFC Application
  • Win32

I also know that away from Microsoft I could use wxWidgets. wxWidgets does appeal to me (cross platform, etc) but how does this compare to the various Microsoft options above? I also know Qt exists.

我也知道远离微软我可以使用wxWidgets。 wxWidgets确实吸引我(跨平台等),但这与上面的各种Microsoft选项相比如何?我也知道Qt存在。

8 个解决方案

#1


4  

It depends on how 'close to the metal' you want to be. Choose .Net/C#/Windows Forms/WPF if you want to quickly write Windows-only applications. Choose C++/MFC if you are determined to learn a platform that is not easy to use and has wards from 15 years of legacy code, but gives you infinite control over every little detail (to be clear: MFC is Windows-only, too).

这取决于你想要的“接近金属”。如果要快速编写仅限Windows的应用程序,请选择.Net / C#/ Windows Forms / WPF。如果您决定学习一个不易使用的平台并且拥有15年遗留代码的病房,请选择C ++ / MFC,但是您可以无限制地控制每一个细节(要明确:MFC也是仅限Windows) 。

MFC is a wrapper around the C win32 api, plus some extra goodies that package standard functionality. It helps a lot to know how the win32 api works. To learn this, I recommend 'Programming Windows' by Charles Petzold (called 'the Petzold' by oldtimers). You can also choose to start with MFC. Have a look at the many samples and tutorials that are included with Visual Studio and on sites like codeproject.com.

MFC是C win32 api的包装器,加上一些包装标准功能的额外好东西。了解win32 api的工作原理有很多帮助。为了解这一点,我推荐Charles Petzold的“编程Windows”(老朋友称之为“Petzold”)。您也可以选择从MFC开始。查看Visual Studio附带的许多示例和教程以及codeproject.com等网站。

.Net / C# is a lot easier to use. It abstracts away a lot of the Win32 api, but it's still a wrapper - so for some things you'll need to 'drop down a level', like you used to have with Visual Basic. IMHO (and I'll probably get modded down for this), C# is the new Visual Basic except that it's not so ugly as a language and that it's statically typed. To be fair, it has some advantages too, like not requiring the strange VB runtime (but it does require .Net, so...)

.Net / C#更容易使用。它抽象了很多Win32 api,但它仍然是一个包装器 - 所以对于某些事情,你需要“降低一个级别”,就像你以前使用Visual Basic一样。恕我直言(我可能会为此修改),C#是新的Visual Basic,除了它不像语言那么难看并且它是静态类型的。公平地说,它也有一些优点,比如不需要奇怪的VB运行时(但它确实需要.Net,所以...)

#2


0  

C# is the language of choice for Windows development, for me. I came from the same kind of background as you, and I found C# incredibly refreshing. I really love this language, and .NET is now my platform of choice. Plus, it's easy to keep in touch with your Unix roots via Mono development. Really, .NET is a great platform and you should explore it.

对我来说,C#是Windows开发的首选语言。我来自与你相同的背景,我发现C#非常令人耳目一新。我真的很喜欢这种语言,.NET现在是我的首选平台。此外,通过Mono开发很容易与您的Unix根源保持联系。真的,.NET是一个很棒的平台,你应该去探索它。

Also, when it comes to Visual Studio, you have to remember that the different projects basically only specify what kind of libraries are included, by default, and the build process. If you want to stay with a Unix style Makefile, you could do windows development with Mono.

此外,对于Visual Studio,您必须记住,不同的项目基本上只指定默认包含的库类型和构建过程。如果你想继续使用Unix风格的Makefile,你可以使用Mono进行Windows开发。

Alex

#3


0  

Windows Forms is by far the nicest of those. However, using windows forms from C++ will just confuse you more if you don't already know what you're doing, because then you're really using C++/CLI, which might just as well be a completely different language. Better off going C# if you want to go that route.

Windows Forms是迄今为止最好的。但是,如果您还不知道自己在做什么,那么使用C ++中的Windows窗体会让您更加困惑,因为那时您实际上使用的是C ++ / CLI,这可能只是一种完全不同的语言。如果你想走那条路,最好离开C#。

MFC is probably closest to what you're familiar with. But, again, Windows Forms is so much nicer.

MFC可能与您熟悉的最接近。但是,Windows Forms再次出类拔萃。

#4


0  

I really would choose C# instead of C++. For Windows client apps, it can't be beat. For C/C++ dude like you, the syntax learning curve will be short. The difficulty will be learning the .NET framework, but that's the cost you'll have to incur one way or the other.

我真的会选择C#而不是C ++。对于Windows客户端应用程序,它无法击败。对于像你这样的C / C ++老兄,语法学习曲线会很短。困难在于学习.NET框架,但这是您必须以某种方式产生的成本。

Once you select C#, just pick either Windows Forms or WPF Application. Both are client-side application types. If you pick WPF Application, you'll also have to learn XAML, which is a fairly new, but massively powerful, concept.

选择C#后,只需选择Windows窗体或WPF应用程序即可。两者都是客户端应用程序类型。如果你选择WPF应用程序,你还必须学习XAML,这是一个相当新的但功能强大的概念。

#5


0  

I've tried doing some C++ programming in .Net (Windows Forms). And while it was possible it was certainly not a pleasurable experience, mostly because you have some extra keywords and such which differ from standarad C++. But if you're willing to learn some more C++ it's an option.

我试过在.Net(Windows Forms)中做一些C ++编程。虽然有可能它肯定不是一种愉快的体验,主要是因为你有一些额外的关键词,这与standarad C ++不同。但是,如果你愿意学习更多的C ++,那么它是一个选择。

Myself I have started working on a project using C# which works really well. It's easy to learn to if you have a background in C++.

我自己已经开始使用C#开展一个非常有效的项目。如果你有C ++背景知识很容易学习。

I wouldn't for the world touch the Win32 API ever again. It's really terrible!

我不会再为世界触摸Win32 API了。这太可怕了!

#6


0  

If you're just interested in writing graphical windows applications, just stick with "Windows Form Application". It will start you out with a blank windows form and a class that contains your main() method.

如果您只想编写图形窗口应用程序,只需坚持使用“Windows窗体应用程序”。它会以一个空白的窗体和一个包含main()方法的类开始。

The "Console Application" project is probably the simplest, it just creates one class file for you with a main() and that's it.

“控制台应用程序”项目可能是最简单的,只需使用main()为您创建一个类文件即可。

The "Class Library" project has scaffolding and default build settings for creating a DLL.

“类库”项目具有用于创建DLL的脚手架和默认构建设置。

There generally aren't any fundamental differences between the different kinds of projects. All they do is set up some default includes for you and generate some scaffolding code (e.g., a blank windows form) to get you started.

不同类型的项目之间通常没有任何根本差异。他们所做的就是为你设置一些默认包含并生成一些脚手架代码(例如,一个空白的窗口表单)来帮助你入门。

I do recommend learning C#. If you know Java it won't be too much of a leap for you. The initial version of C# was actually designed to be exactly like Java, but they have diverged a bit over the years.

我建议学习C#。如果你了解Java,那对你来说不会太过分。 C#的初始版本实际上与Java完全相同,但多年来它们有点不同。

#7


0  

I think what I would suggest has a lot more to do with your objective. If you are looking to build your own application and want to get it to market quickly, and it has to be Windows, then I would go with C# WF as others have suggested.

我认为我的建议与你的目标有很多关系。如果您正在构建自己的应用程序并希望快速将其推向市场,并且它必须是Windows,那么我会像其他人建议的那样使用C#WF。

If you are looking to make yourself more employable then I would go with C#/ASP.Net. This way you are learning C# but are also learning more about web developent, in general, and ASP.Net in particular. I think you will find that Windows Forms is a lot easier, comparatively, and not really be worth spending a lot of time on.

如果你想让自己更有就业能力,那么我会选择C#/ ASP.Net。通过这种方式,您正在学习C#,但一般来说,还要了解更多关于Web开发的内容,特别是ASP.Net。我认为你会发现Windows Forms比较简单,并且不值得花费大量时间。

So if I were you I would build my application so that the majority of it is seperated from the interface. I would first learn how to make that code interact in ASP.Net, and then I would try it in Windows Forms. If you can do that you will learn a lot of really important skills for .Net framework development.

所以,如果我是你,我会构建我的应用程序,以便它的大部分与界面分离。我将首先学习如何使代码在ASP.Net中进行交互,然后我会在Windows窗体中尝试它。如果你能做到这一点,你将学习.Net框架开发的许多非常重要的技能。

#8


0  

IMHO, wxWidgets is better than any of those. For example, I know of many people that converted their projects from MFC to wx. wxWidgets has all the MFC has (in early wx versions, a lot of classes were clones of MFC classes), and a lot more. It is not just a GUI library, but you have wrappers for all kinds of common tasks, like reading/writing XML files, Windows Registry, manipulation of various graphic types and image data, classes for conversion between character sets, etc. There are also a lot of add-on classes at wxCode website that can enhance your applications easily.

恕我直言,wxWidgets比任何一个都好。例如,我知道许多人将他们的项目从MFC转换为wx。 wxWidgets拥有所有MFC(在早期的wx版本中,很多类都是MFC类的克隆),还有更多。它不仅仅是一个GUI库,而且还有各种常见任务的包装器,如读/写XML文件,Windows注册表,各种图形类型和图像数据的操作,字符集之间的转换等等。还有wxCode网站上的许多附加类可以轻松增强您的应用程序。

wxWidgets is also cross-platform, has full Unicode support, and only advances further. If you decide to give it a try, make sure you try wxFormBuilder for easy, WYSIWYG builder of user interface (dialogs, windows, ...).

wxWidgets也是跨平台的,具有完全的Unicode支持,并且只是进一步发展。如果您决定尝试一下,请确保您尝试使用wxFormBuilder轻松实现用户界面的WYSIWYG构建器(对话框,窗口,...)。

#1


4  

It depends on how 'close to the metal' you want to be. Choose .Net/C#/Windows Forms/WPF if you want to quickly write Windows-only applications. Choose C++/MFC if you are determined to learn a platform that is not easy to use and has wards from 15 years of legacy code, but gives you infinite control over every little detail (to be clear: MFC is Windows-only, too).

这取决于你想要的“接近金属”。如果要快速编写仅限Windows的应用程序,请选择.Net / C#/ Windows Forms / WPF。如果您决定学习一个不易使用的平台并且拥有15年遗留代码的病房,请选择C ++ / MFC,但是您可以无限制地控制每一个细节(要明确:MFC也是仅限Windows) 。

MFC is a wrapper around the C win32 api, plus some extra goodies that package standard functionality. It helps a lot to know how the win32 api works. To learn this, I recommend 'Programming Windows' by Charles Petzold (called 'the Petzold' by oldtimers). You can also choose to start with MFC. Have a look at the many samples and tutorials that are included with Visual Studio and on sites like codeproject.com.

MFC是C win32 api的包装器,加上一些包装标准功能的额外好东西。了解win32 api的工作原理有很多帮助。为了解这一点,我推荐Charles Petzold的“编程Windows”(老朋友称之为“Petzold”)。您也可以选择从MFC开始。查看Visual Studio附带的许多示例和教程以及codeproject.com等网站。

.Net / C# is a lot easier to use. It abstracts away a lot of the Win32 api, but it's still a wrapper - so for some things you'll need to 'drop down a level', like you used to have with Visual Basic. IMHO (and I'll probably get modded down for this), C# is the new Visual Basic except that it's not so ugly as a language and that it's statically typed. To be fair, it has some advantages too, like not requiring the strange VB runtime (but it does require .Net, so...)

.Net / C#更容易使用。它抽象了很多Win32 api,但它仍然是一个包装器 - 所以对于某些事情,你需要“降低一个级别”,就像你以前使用Visual Basic一样。恕我直言(我可能会为此修改),C#是新的Visual Basic,除了它不像语言那么难看并且它是静态类型的。公平地说,它也有一些优点,比如不需要奇怪的VB运行时(但它确实需要.Net,所以...)

#2


0  

C# is the language of choice for Windows development, for me. I came from the same kind of background as you, and I found C# incredibly refreshing. I really love this language, and .NET is now my platform of choice. Plus, it's easy to keep in touch with your Unix roots via Mono development. Really, .NET is a great platform and you should explore it.

对我来说,C#是Windows开发的首选语言。我来自与你相同的背景,我发现C#非常令人耳目一新。我真的很喜欢这种语言,.NET现在是我的首选平台。此外,通过Mono开发很容易与您的Unix根源保持联系。真的,.NET是一个很棒的平台,你应该去探索它。

Also, when it comes to Visual Studio, you have to remember that the different projects basically only specify what kind of libraries are included, by default, and the build process. If you want to stay with a Unix style Makefile, you could do windows development with Mono.

此外,对于Visual Studio,您必须记住,不同的项目基本上只指定默认包含的库类型和构建过程。如果你想继续使用Unix风格的Makefile,你可以使用Mono进行Windows开发。

Alex

#3


0  

Windows Forms is by far the nicest of those. However, using windows forms from C++ will just confuse you more if you don't already know what you're doing, because then you're really using C++/CLI, which might just as well be a completely different language. Better off going C# if you want to go that route.

Windows Forms是迄今为止最好的。但是,如果您还不知道自己在做什么,那么使用C ++中的Windows窗体会让您更加困惑,因为那时您实际上使用的是C ++ / CLI,这可能只是一种完全不同的语言。如果你想走那条路,最好离开C#。

MFC is probably closest to what you're familiar with. But, again, Windows Forms is so much nicer.

MFC可能与您熟悉的最接近。但是,Windows Forms再次出类拔萃。

#4


0  

I really would choose C# instead of C++. For Windows client apps, it can't be beat. For C/C++ dude like you, the syntax learning curve will be short. The difficulty will be learning the .NET framework, but that's the cost you'll have to incur one way or the other.

我真的会选择C#而不是C ++。对于Windows客户端应用程序,它无法击败。对于像你这样的C / C ++老兄,语法学习曲线会很短。困难在于学习.NET框架,但这是您必须以某种方式产生的成本。

Once you select C#, just pick either Windows Forms or WPF Application. Both are client-side application types. If you pick WPF Application, you'll also have to learn XAML, which is a fairly new, but massively powerful, concept.

选择C#后,只需选择Windows窗体或WPF应用程序即可。两者都是客户端应用程序类型。如果你选择WPF应用程序,你还必须学习XAML,这是一个相当新的但功能强大的概念。

#5


0  

I've tried doing some C++ programming in .Net (Windows Forms). And while it was possible it was certainly not a pleasurable experience, mostly because you have some extra keywords and such which differ from standarad C++. But if you're willing to learn some more C++ it's an option.

我试过在.Net(Windows Forms)中做一些C ++编程。虽然有可能它肯定不是一种愉快的体验,主要是因为你有一些额外的关键词,这与standarad C ++不同。但是,如果你愿意学习更多的C ++,那么它是一个选择。

Myself I have started working on a project using C# which works really well. It's easy to learn to if you have a background in C++.

我自己已经开始使用C#开展一个非常有效的项目。如果你有C ++背景知识很容易学习。

I wouldn't for the world touch the Win32 API ever again. It's really terrible!

我不会再为世界触摸Win32 API了。这太可怕了!

#6


0  

If you're just interested in writing graphical windows applications, just stick with "Windows Form Application". It will start you out with a blank windows form and a class that contains your main() method.

如果您只想编写图形窗口应用程序,只需坚持使用“Windows窗体应用程序”。它会以一个空白的窗体和一个包含main()方法的类开始。

The "Console Application" project is probably the simplest, it just creates one class file for you with a main() and that's it.

“控制台应用程序”项目可能是最简单的,只需使用main()为您创建一个类文件即可。

The "Class Library" project has scaffolding and default build settings for creating a DLL.

“类库”项目具有用于创建DLL的脚手架和默认构建设置。

There generally aren't any fundamental differences between the different kinds of projects. All they do is set up some default includes for you and generate some scaffolding code (e.g., a blank windows form) to get you started.

不同类型的项目之间通常没有任何根本差异。他们所做的就是为你设置一些默认包含并生成一些脚手架代码(例如,一个空白的窗口表单)来帮助你入门。

I do recommend learning C#. If you know Java it won't be too much of a leap for you. The initial version of C# was actually designed to be exactly like Java, but they have diverged a bit over the years.

我建议学习C#。如果你了解Java,那对你来说不会太过分。 C#的初始版本实际上与Java完全相同,但多年来它们有点不同。

#7


0  

I think what I would suggest has a lot more to do with your objective. If you are looking to build your own application and want to get it to market quickly, and it has to be Windows, then I would go with C# WF as others have suggested.

我认为我的建议与你的目标有很多关系。如果您正在构建自己的应用程序并希望快速将其推向市场,并且它必须是Windows,那么我会像其他人建议的那样使用C#WF。

If you are looking to make yourself more employable then I would go with C#/ASP.Net. This way you are learning C# but are also learning more about web developent, in general, and ASP.Net in particular. I think you will find that Windows Forms is a lot easier, comparatively, and not really be worth spending a lot of time on.

如果你想让自己更有就业能力,那么我会选择C#/ ASP.Net。通过这种方式,您正在学习C#,但一般来说,还要了解更多关于Web开发的内容,特别是ASP.Net。我认为你会发现Windows Forms比较简单,并且不值得花费大量时间。

So if I were you I would build my application so that the majority of it is seperated from the interface. I would first learn how to make that code interact in ASP.Net, and then I would try it in Windows Forms. If you can do that you will learn a lot of really important skills for .Net framework development.

所以,如果我是你,我会构建我的应用程序,以便它的大部分与界面分离。我将首先学习如何使代码在ASP.Net中进行交互,然后我会在Windows窗体中尝试它。如果你能做到这一点,你将学习.Net框架开发的许多非常重要的技能。

#8


0  

IMHO, wxWidgets is better than any of those. For example, I know of many people that converted their projects from MFC to wx. wxWidgets has all the MFC has (in early wx versions, a lot of classes were clones of MFC classes), and a lot more. It is not just a GUI library, but you have wrappers for all kinds of common tasks, like reading/writing XML files, Windows Registry, manipulation of various graphic types and image data, classes for conversion between character sets, etc. There are also a lot of add-on classes at wxCode website that can enhance your applications easily.

恕我直言,wxWidgets比任何一个都好。例如,我知道许多人将他们的项目从MFC转换为wx。 wxWidgets拥有所有MFC(在早期的wx版本中,很多类都是MFC类的克隆),还有更多。它不仅仅是一个GUI库,而且还有各种常见任务的包装器,如读/写XML文件,Windows注册表,各种图形类型和图像数据的操作,字符集之间的转换等等。还有wxCode网站上的许多附加类可以轻松增强您的应用程序。

wxWidgets is also cross-platform, has full Unicode support, and only advances further. If you decide to give it a try, make sure you try wxFormBuilder for easy, WYSIWYG builder of user interface (dialogs, windows, ...).

wxWidgets也是跨平台的,具有完全的Unicode支持,并且只是进一步发展。如果您决定尝试一下,请确保您尝试使用wxFormBuilder轻松实现用户界面的WYSIWYG构建器(对话框,窗口,...)。