Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you write normal Windows applications with C++/CX?

Or are you restricted to the "Metro-style" applications and Windows Store apps?

At first, I thought C++/CX would be a good alternative to C++/CLI as it has some nifty C#-esque keywords ('sealed', 'partial') and it also compiles to native code, rather than using .NET. But reading online, all I can find is information regarding Windows Store apps and Metro-styled applications...

Also, is WinRT for Windows 8 and above only?

like image 766
Noah Roth Avatar asked Feb 25 '15 22:02

Noah Roth


1 Answers

Yes, you can write desktop apps in C++/Cx and can use some Windows Runtime API (those marked in the documentation and headers as available for desktop apps) in desktop apps. See Windows Runtime APIs for desktop apps. The Enumerate app packages sample on MSDN demonstrates using C++/Cx to call Windows Runtime API in a desktop app.

The Windows Runtime Xaml classes are not available to desktop apps, but since you can mix-and-match C++ and C++/Cx you can call typical desktop UI API (Win32, MFC, DirectX, etc.) from an app which also uses C++/Cx.

C++/Cx isn't really an alternative to C++/CLI. Other than using some similar syntax they have quite different goals. As you note, C++/Cx is not a managed language and so it cannot be used to call managed code. The primary reason to choose C++/CLI is for interop with managed code. C++/Cx is a good option if you need to call into the Windows Runtime from your desktop app.

The Windows Runtime is available only on Windows 8 and later.

like image 97
Rob Caplan - MSFT Avatar answered Sep 28 '22 02:09

Rob Caplan - MSFT