简体   繁体   English

非托管的C ++ Win32 API或C#?

[英]Unmanaged C++ Win32 API or C#?

Good afternoon, 下午好,

I thought about writing an application which I may or may not commercialize, depending on how good the final application is. 我考虑过要编写一个我可以或不可以商业化的应用程序,这取决于最终应用程序的质量。 It is like a personal project, with which I hope to learn many more things about programming, for currently I only know most about C and C#. 这就像一个个人项目,我希望借此学习更多有关编程的知识,因为目前我对C和C#的了解最多。 That's why I thought about starting this project as an unmanaged C++ Win32 application. 这就是为什么我考虑将这个项目作为不受管理的C ++ Win32应用程序启动的原因。 The problem is that it is most dificult to even show a simple window when compared to C#... 问题是,与C#相比,甚至很难显示一个简单的窗口。

How many people/companies use the Win32 API & C++ in today's business world? 在当今的商业世界中,有多少人/公司使用Win32 API和C ++? How does it perform in comparison with C#? 与C#相比,它的性能如何?

The application in question may eventually be an IDE for a specific language but whith features like command recognition and spell checking already built in. 有问题的应用程序最终可能是特定语言的IDE,但是内置了命令识别和拼写检查等功能。

Thank you very much. 非常感谢你。

It seems that when performance is needed people are willing to give up C# for C++. 似乎当需要性能时,人们愿意放弃使用C#的C#。 Have a look at this "success" story Lessons from Evernote's flight from .NET . 看看这个“成功”的故事, 从Evernote从.NET的飞行中学到的教训

On our test hardware, Evernote 4 starts five times faster, and uses half the memory of Evernote 3.5. 在我们的测试硬件上,Evernote 4的启动速度提高了五倍,并且使用了Evernote 3.5的一半内存。

Evernote chose WTL and Chromium Embedded Framework . Evernote选择了WTLChromium嵌入式框架 Basically they've reused Google's Chrome in their application. 基本上,他们已经在应用程序中重用了Google的Chrome。

对于您的第一个项目,并且没有C ++和Win32的先前经验,我强烈建议您使用C#,因为它可以使您更轻松地完成工作,从而在使用过程中获得信心和技能。

I'm a huge fan of C++ under windows, I've been doing it most of my adult life. 我是Windows下C ++的忠实拥护者,在我成年后的大部分时间里,我一直在这样做。 That said, if you have no experience of C++, and you want to write a windows application, I'd suggest going with the C# route under .NET. 就是说,如果您没有C ++的经验,并且想编写Windows应用程序,则建议使用.NET下的C#路由。 Whilst I love native C++, I really disliked C++/CLI, and the horrid ^ suffix for references. 尽管我喜欢本机C ++,但我确实不喜欢C ++ / CLI和令人讨厌的^后缀作为参考。

Given this is a personal project, I wouldn't worry too much about whether businesses use C++ or C#, but I will say that it is easier to find a C# developer these days than it is a C++ developer. 鉴于这是一个个人项目,所以我不会为企业使用C ++还是C#担心太多,但是我会说,如今,找到C#开发人员要比C ++开发人员容易。 And no, I am not favouring one language over the other here, it just appears to be the reality (at least in my experience). 不,在这里我不喜欢一种语言,这似乎是现实(至少以我的经验)。 As for C++/CLI developers? 至于C ++ / CLI开发人员? They're kind of thin on the ground :) 他们有点薄:)

You'll definitely be up and running faster with C# than you would with Visual C++/MFC/some-other-gui, but remember there are certain things you may not be able to do in C# (and have to import the native win32 calls via DllImport ), but I doubt you'll come across these fringe cases just yet. 使用C#肯定会比使用Visual C ++ / MFC / some-other-gui更快地启动并运行,但是请记住,某些事情您可能无法在C#中完成(并且必须导入本机win32调用)通过DllImport ),但我怀疑您还会遇到这些附带情况。

C# is the easy route, and the route most-often pushed by Microsoft. C#是简单的路线,也是Microsoft最常推的路线。 What they don't tell you, though, is that all of their headline products (parts of Visual Studio excepted) are written in C/C++. 但是,他们没有告诉您的是,它们的所有标题产品(Visual Studio的某些部分除外)都是用C / C ++编写的。 I'd say, in fact, that most major software packages you are familiar with are written in C/C++. 实际上,我要说的是,您熟悉的大多数主要软件包都是用C / C ++编写的。

I'd go with c# too, as it is far more common in a business world (on GUI side at least), than unmanaged c++/win32. 我也将使用c#,因为它在商业世界中(至少在GUI方面)比非托管c ++ / win32更普遍。 You'll also get your desired results faster, especially if you don't know c++. 您还将更快地获得所需的结果,尤其是在您不懂c ++的情况下。

On the other hand, c++ performs better (if written properly) - so if you are planning some intensive work in your app - maybe c# just won't handle it (but I strongly doubt this is the case). 另一方面,c ++的性能更好(如果编写正确)-因此,如果您打算在应用程序中进行一些繁重的工作-也许c#不能处理它(但我强烈怀疑是这种情况)。

At last, but not the least - if you are planning for clients, that for some reason do not have and can not get .NET framework (or any other framework, ie Java) - then native code is your only solution. 最后,但并非最不重要的一点-如果您正在为客户端计划,由于某种原因而没有并且无法获得.NET框架(或任何其他框架,例如Java),则本机代码是您唯一的解决方案。

I have only been using C++ for quite a few years, but I have never had to write any programs which required a User Interface. 我使用C ++才有几年了,但是我从来不需要编写任何需要用户界面的程序。 When I did, I tried to learn to use Qt, but found it to be somewhat of a pain and eventually gave up. 当我这样做时,我尝试学习使用Qt,但发现它有些痛苦,最终放弃了。 I recently just started taking a class on C# .NET and in the first week I have already started developing a pretty advanced application for my companies billing system. 我最近刚开始在C#.NET上课,在第一周,我已经开始为我的公司计费系统开发一个相当高级的应用程序。

If you were already a seasoned C++ veteran and preferred it over C# .NET, then I would say by all means go for it. 如果您已经是一位经验丰富的C ++老手,并且比C#.NET更喜欢它,那么我会说一定要这么做。 In this case however, I would strongly recommend you go with C# .NET for quite a few reasons. 但是,在这种情况下,出于很多原因,我强烈建议您使用C#.NET。

1) The time is takes to do something in C# will probably be at the very least about 10x faster than doing it in C++ regardless of the API you used. 1)无论您使用什么API,在C#中执行操作所需的时间至少比在C ++中执行操作至少快10倍。

2) The learning curve of C++ on top of already trying to write an application with a UI (which is already very difficult in C++) will make this take an extremely long time. 2)在已经尝试使用UI编写应用程序(在C ++中已经非常困难)的基础上,C ++的学习曲线将使这花费非常长的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM