1

I'm trying to attempt to build a UI similar to the ones coming out of Microsoft these days. Particularly those targeting the Windows 10 operating system (a la Office 2016).

Currently I use WinAPI, but all of the controls provided by Windows.h and CommCtrl.h appear to be legacy/old style UI elements. I'm particularly looking for the titlebar/menu/status bar elements (the main clientarea will consist of a GDI/Direct2D context, so nothing special necessary there).

I found some information pointing to XAML, but I don't think that's what I want. WPF seems to be a more likely candidate, but I'm not sure if that's the case either.

I would like for this to be 100% native (WinAPI/C&C++), but if there's absolutely no other option I can use C# for the UI and stub in the native code.

deaddodo
  • 21
  • 1
  • 2
  • Yeah you're right it was VS that uses wpf. The custom chrome code is still useful however. – David Zech Aug 27 '15 at 21:18
  • 1
    The new office 2016 is done in WinRT/Xaml as Windows Universal App – Liero Aug 27 '15 at 21:27
  • 1
    You can't get the "new look" interface in a WinAPI desktop app without emulating it yourself. Luckily it's all just blobs of solid color so this is probably not difficult. – Jonathan Potter Aug 27 '15 at 21:32
  • @JonathanPotter - I was afraid of that. If it's a C# only option, I can definitely just write the logic and Direct2D stuff native and call it from C#. Any pointers on getting started with that UI style? Is it just a modified WPF? – deaddodo Aug 27 '15 at 21:42
  • 1
    It's not just that it's C#, it can only be done from a Metro/Modern/Windows Store/WinRT/Universal/whatever-they're-called-this-week app. It's not just the UI, the whole app has to be written under that framework. – Jonathan Potter Aug 27 '15 at 22:06
  • You can make Universal programs with C++/CX (a specialized dialect of C++); you aren't restricted to .net. In addition, [this](https://msdn.microsoft.com/en-us/library/windows/apps/dn894631.aspx) seems to imply you can use DirectX in place of XAML if you go the C++/CX route. – andlabs Aug 27 '15 at 22:14

1 Answers1

1

You use XAML and either C++, C# or JavaScript to write a Windows Store (previously Metro) app. If you use C++, the app is 100% native, but if you use C# or JavaScript, of course the required virtual machine is used.

The API that your code calls is WinRT, which looks like Silverlight. In addition, your app can also call some, but not all, Win32 API's similar to how .NET apps can call Win32 (e.g. By using P/Invoke). However, even if you use C++ and thus your app is 100% native, it is still sandboxed like a browser. Meaning it cannot do things like access the entire disk or write to HKLM in the registry. This is for security; a Windows Store app needs to be safe, and thus more limited, like a mobile app you buy from the Apple AppStore. This means that you can't call e.g. CreateFile. This says:

Minimum supported client Windows XP [desktop apps only]

When MS mentions 'Desktop Apps' as above, they mean Win32 apps. This excludes Windows Store Apps. But this is confusing, because on Win 8/8.1, these Windows Store apps are full screen, but on Windows 10 they are resizeable and overlapping, appearing next to, and mixed in with traditional Win32 apps like Explorer and Task Manager. So even though they appear on the same desktop as Desktop apps, they are not Desktop apps.

I believe if a Windows Store app also targets Windows Phone 10, Windows IoT, etc. then it is called a Windows Universal app.

David Ching
  • 1,903
  • 17
  • 21
  • After a bit of digging last night, this definitely looks like what I need. Unfortunately the "ribbon"/"command" bars don't appear to be Windows elements and have to be custom managed (or use a third party option like BCGControlBar or DotNetBar). – deaddodo Aug 28 '15 at 16:07
  • There is a [Windows Ribbon framework](https://msdn.microsoft.com/en-us/library/windows/desktop/dd371191(v=vs.85).aspx), but it seems to be desktop only :/ Not sure if UWP has a ribbon as well. – andlabs Aug 28 '15 at 16:46
  • If your app is going to stick with ribbons and other traditional common controls, what advantage is there of making it a Windows Store app? @andlabs: MS provides that Ribbon Framework and also the MFC ribbon from BCGSoft, but yes, those are only for Desktop apps. It took them many years to provide these, so I would think it would take a very long time to make a WinRT version also. There are plenty of third party ones available though. – David Ching Aug 28 '15 at 19:48
  • @DavidChing of course; and that also assumes ribbons fit in the WinRT design model, which [does not seem to be the case](https://msdn.microsoft.com/library/windows/apps/hh465424.aspx) (at least not for UWP; not sure about pre-UWP) – andlabs Aug 28 '15 at 21:39