2

I was seeing a video of Windows 8 demonstration.

So I was wandering which language was used to produce this new appearance: C++ or C#?

Is there a WPF running on that UI?

Junior Mayhé
  • 16,144
  • 26
  • 115
  • 161
  • WPF isn't even a language ... I'm going to go out on a limb and say "Windows is [primarily] written in C, C++ and Assembly". The extra doodads (and applications) on top are extra doodads (and applications) on top. –  Jun 02 '11 at 16:37

2 Answers2

10

Windows is written in C, C++, and some hand-tuned Assembly. For reasons why it is not written in .NET, see this question.

It is not clear which of those languages was used to develop the latest eye candy in Windows 8.

Community
  • 1
  • 1
Ben Hoffstein
  • 102,129
  • 8
  • 104
  • 120
7

I can't really say for sure, since I'm not a member of the development team, but it's almost certainly written 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.

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 must be 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 reasons that Windows can't move over to the world of managed code, at least not just yet or any time in the realistic future.

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.

Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • But c++ uses a while loop to wait for windows messages, which is ridiculous. Moreover starting a C++ windows program is horribly slow. I can't believe modern OS's can be written in C++. – Hoy Cheung Apr 17 '13 at 20:18
  • 2
    @user1978421 ...what? What is "ridiculous" about using a loop to process messages? That's what all Windows applications do, regardless of which language they're written in. And starting a C++ application is anything but slow on my machine. That's one of the big advantages I see of native apps compared to managed apps—faster cold start. Almost all modern operating systems ***are*** written in C++. I cannot understand why you find that hard to believe. – Cody Gray - on strike Apr 18 '13 at 17:41
  • modern languages should have event handlers. I just started a new empty c++ application. Comparatively, it takes twice the time a c# application requires to start up I read on wikipedia that photoshop and illustrator are programmed in C++. Well, both of them starts so slow. But most windows applications have very quick response and glamorous appearance. that's why I think they are not written in c++. – Hoy Cheung Apr 18 '13 at 21:50
  • BTW, I am a C# programmer. i want to produce some program to shrink wtv files which requires using COM. C++ syntax is really difficult, mostly caused by its naming convention. I know I can use tlbimp.exe to import COM libraries. But all samples are written C++. Having no knowledge about the C++ language, I can't learn how to program with COM library. Any idea how i can skip the meaningless study? – Hoy Cheung Apr 18 '13 at 22:00
  • 1
    @user1978421 That's an incorrect assumption. Photoshop and Illustrator are some of the biggest, most complicated programs on the planet. The only reason they are even *usable* is because they're written in extremely efficient C++ code. And sorry to burst your bubble, but event handlers are just an abstraction. Syntactic sugar, if you will. Under the covers, they're implemented using some sort of polling mechanism, probably a regular old while loop. You can easily write your own event handlers in C++; that's the way I write C++ Windows apps—I have my own framework that raises events for... – Cody Gray - on strike Apr 19 '13 at 01:43
  • all of the common window messages and other notifications. As far as glamorous appearance, you can create that in any language. It has nothing to do with the language, it has to do with the designer you've hired to work on your app. C++ doesn't even come with any kind of GUI framework. You have to write it all yourself. The syntax of the C++ language is virtually identical to C#, so I don't know what you're talking about. C# was intentionally designed to look and work much like C++ so that C++ programmers could use it easily. But you can use COM with C#, if that's what you'd prefer to work in. – Cody Gray - on strike Apr 19 '13 at 01:44
  • @CodyGray Excellent Answer. +1. 100% agree with you. However There's a lot of buzz about the "[XAML Team being now part of WinDiv](http://www.riagenic.com/archives/683)" So I wonder whether there's a chance that some XAML is now part of the Windows 8 UI? What do you think? – Federico Berasategui Apr 19 '13 at 03:32
  • how about C? people say C does low level stuff too. Why people use c++ but not C? C is a lower level language with which you can tweak anything. Some people say C is more powerful and more efficient than c++. What do you say? – Hoy Cheung Apr 19 '13 at 05:31
  • I want to know an important answer that, if i am going to use C# to program my media application, what will be only implementable by using C++, but not C#? – Hoy Cheung Apr 19 '13 at 05:44
  • C is not really any lower level than C++. C++ is generally a superset of C (although not strictly so), with a bunch of additional nice object-oriented features tacked on. Most anything you can do in C can also be done in C++, and vice versa (although expressing higher-level C++ constructs like classes in C is not nearly as elegant). C programmers argue in favor of C, C++ programmers argue in favor of C++. Does that answer your question? That second question is impossible to answer. I can't give you a list of things that can be done in C++ but not in C#. – Cody Gray - on strike Apr 19 '13 at 06:14