使用哪种语言创建 Windows 8?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6217394/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which language was used to create Windows 8?
提问by Junior Mayhé
I was seeing a video of Windows 8 demonstration.
我正在观看Windows 8 演示的视频。
So I was wandering which language was used to produce this new appearance: C++ or C#?
所以我在徘徊是使用哪种语言来产生这种新外观:C++ 还是 C#?
Is there a WPF running on that UI?
是否有 WPF 在该 UI 上运行?
回答by Ben Hoffstein
Windows is written in C, C++, and some hand-tuned Assembly. For reasons why it is not written in .NET, see this question.
Windows 是用 C、C++ 和一些手动调整的程序集编写的。关于它不是用 .NET 编写的原因,请参阅此问题。
It is not clear which of those languages was used to develop the latest eye candy in Windows 8.
目前尚不清楚这些语言中的哪一种被用于在 Windows 8 中开发最新的眼睛糖果。
回答by Cody Gray
I can't really say for sure, since I'm not a member of the development team, but it's almost certainlywritten in C++. And, then, since it's not a ground-up rewrite, there's bound to be a bunch of C and assembly code along for the ride, as well. Both legacy code that remains for backwards compatibility as well as important, functioning code like the bootstrapping sequences.
我不能肯定地说,因为我不是开发团队的成员,但几乎可以肯定它是用 C++ 编写的。然后,由于它不是彻底的重写,因此也必然会有一堆 C 和汇编代码。保留向后兼容性的遗留代码以及重要的功能代码,如引导序列。
As for how they've implemented the fancy UI effects, their mere existence doesn't imply that a certain UI framework is in use. Anything that you can do in WPF can be done on a more direct level from C++ code. In fact, it mustbe possible to do such, as WPF is merely calling platform APIs under the hood, like DirectDraw, etc. to do all the work. Of course, it goes without saying that it's far easier to use a wrapper library like WPF, but it's not strictly necessary. And there are plenty of reasonsthat Windows can't move over to the world of managed code, at least not just yet or any time in the realistic future.
至于他们是如何实现精美的 UI 效果的,它们的存在并不意味着使用了某个 UI 框架。您可以在 WPF 中执行的任何操作都可以在更直接的 C++ 代码级别上完成。事实上,这样做肯定是可能的,因为 WPF 只是在幕后调用平台 API,如 DirectDraw 等来完成所有工作。当然,不用说,使用 WPF 之类的包装器库要容易得多,但这并不是绝对必要的。Windows 无法转向托管代码世界的原因有很多,至少现在或在现实未来的任何时候都是如此。
The Windows Shell team has long been known to use their own proprietary controls with the class name DIRECTUIHWND
. Many a programmer has examined the OS widgets with a tool like Spy++ to find the answer to "how did they do that?" and reached the same conclusion. My guess is that they're using the same toolset, extended for some of the new whizbang features. They're keeping it all internal, of course. Once you expose an API for other developers to use, you effectively lose ownership of it because you're bound by the API contract to ensure that it continues to work on all future versions. Radical changes like the ones you're seeing in Windows 8 would be far more difficult if they had to ensure backwards compatibility with the internal UI components of the shell used to implement these features.
众所周知,Windows Shell 团队使用他们自己的专有控件和类名DIRECTUIHWND
。许多程序员使用 Spy++ 之类的工具检查了操作系统小部件,以找到“他们是如何做到的?”的答案。并得出了同样的结论。我的猜测是他们使用相同的工具集,扩展了一些新的 whizbang 功能。当然,他们将所有内容都保留在内部。一旦您公开 API 供其他开发人员使用,您实际上就失去了它的所有权,因为您受到 API 合同的约束,以确保它继续在所有未来版本上工作。如果必须确保与用于实现这些功能的 shell 的内部 UI 组件向后兼容,那么像您在 Windows 8 中看到的那些根本性更改将困难得多。