The message at BUILD was very clear that for building classic desktop applications nothing has changed (use MFC, WinForms, WPF or Silverlight). If you want to use the new toys you have to make a Metro style app.
That was a bit of a disappointment as whilst I like Metro style I don’t want to see Desktop applications relegated to legacy status.
The first thing I wondered when I saw the new Task Manager (C:\Windows\System32\TM.exe) was if it had been written using WPF or WinRT using some undocumented APIs.
Well I was wrong as it’s neither. Just opening it in notepad reveals reams of plain text UI mark-up that show it’s written using the internal-only UI framework “DirectUI” (also used for Windows Media Center and Windows Live Messenger).
..... <element resid="GenericCommandBar" id="atom(GenericCommandBar)" class="TmCommandBar" layoutpos="bottom" sheet="TmCommandBarStyle" layout="borderlayout()" accrole="pane" accessible="true" active="mouse"> <button id="atom(CBExpandoButtonText)" layoutpos="left" active="mouse" accname="resstr(37209)" padding="rect(5rp,0rp,0rp,0rp)" contentalign="middlecenter" visible="true"/> </element> <element id="atom(dashboardBar)" layout="flowlayout(0,2,0,2)" layoutpos="none" padding="rect(8rp,0rp,0rp,0rp)" borderthickness="rect(0rp,0rp,0rp,0rp)" visible="false" accessible="false"> <AccessibleButton id="atom(resmonLaunch)" sheet="TaskManagerCommon" class="link" accessible="true" active="mouse|keyboard" layoutpos="left" padding="rect(5rp,0rp,0rp,7rp)" accrole="link" accname="resstr(34283)" contentalign="middleleft" content="resstr(34283)"/> </element> <element resid="CBTaskButtons" id="atom(CBTaskButtons)" sheet="TmCommandBarStyle" layout="flowlayout(1,2,1,2)" layoutpos="client" padding="rect(0rp,0rp,8rp,8rp)"> <element resid="TmTaskButton" id="atom(TmTaskButton)" sheet="TmCommandBarStyle" layout="BorderLayout()" layoutpos="right" accessible="false"> <AccessibleButton id="atom(CBRestartButton)" class="TmTaskButton" enabled="false" visible="false" margin="rect(4rp,0rp,0rp,0rp)" active="mouse|keyboard" layoutpos="none" contentalign="middlecenter" content="resstr(38002)" shortcut="auto" accessible="true" accrole="pushbutton" accname="resstr(38002)" accdesc="resstr(38002)"> </AccessibleButton> </element> </element> </duixml>
Interesting, but it didn’t get me any closer to disproving that WinRT is only for Metro.
Next I broke out Reflector and had a browse through some of the more interesting Metadata files from the standard WinRT components (C:\Windows\System32\WinMetadata) until I stumbled upon this:
What’s a Window class doing in System.UI.Xaml? Hmm…
I created an empty C# project and after playing with the System.UI.Xaml.Application and System.UI.Xaml.Window classes for a while, managed to get a very basic XAML application to show.
It’s a bit glitchy (responds poorly to Window resize events + never redraws the gradient) and all the default templates are unsurprisingly Metro-style but generally everything works (Data Binding etc.)
I tried accessing some of the Windows Runtime features like the webcam but had no luck. That’s not surprising because this project type doesn’t have the Package.appxmanifest file required to describe what to ask the user for permission.
This all might be removed by the final release but I think it’s much more likely that it’ll either be finished or officially supported post-SP1.
For now they’ll continue to push Metro apps as the way forward. Officially supporting WinRT desktop applications would dilute that message plus give them more work.
One further nod towards desktop WinRT support is that I’ve seen the permission dialog appear on the desktop (e.g. “Do you want this application to access the webcam?”).
It did it after a blue screen (“Do you want to send this report to Microsoft?”) and also does when running a blocked file from explorer.
Download C# WinRT Desktop Sample (WinRTDesktop.zip)
Sample requires Windows Developer Preview and Visual Studio 11 Developer Preview





Pingback: WinRT and Desktop Applications | Kawaii's Blog
Awesome! I always thought that WinRT will support Desktop applications, and it is the reason why WOA absolutely does not support current applications because it is meant to start with a clean slate using the all new APIs. Finall I see some proof that confirms my thoughts.
I recently had an interview with the MS Visual C++ team, I asked one of the senior managers about WinRT and he said it’s a new programming model for Windows to make asynchronous operations simple, etc. He never mentioned Metro once, and from his description it sounded like it is meant for desktop as well.
Pingback: Windows Runtime XAML for the Desktop | Paul Spiteri’s Blog | S.F.Page