Windows 8、C++ 和 Metro GUI 示例?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7418400/
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
Windows 8, C++ and Metro GUI samples?
提问by Rella
So I look at this(Windows build keynote 1:42:56)And I just do not get it - what I can use to create GUI from C++ and/or GUI language that will be capable to call functions from my C++ code? HTML, XAML or what? And where to see code sample of doing
markup call code
and code create GUI
sample with C++ for Windows 8 Metro apps?
所以我看看这个(Windows 构建主题演讲 1:42:56)我只是不明白 - 我可以用什么来从 C++ 和/或 GUI 语言创建能够从我的 C++ 代码调用函数的 GUI?HTML、XAML 还是什么?在哪里可以看到使用 C++ 进行 Windows 8 Metro 应用程序的代码示例
markup call code
和code create GUI
示例?
回答by Kate Gregory
Sample code in C++ and other languages is at http://code.msdn.microsoft.com/windowsapps. You can take a look at how it's done.
C++ 和其他语言的示例代码位于http://code.msdn.microsoft.com/windowsapps。你可以看看它是如何完成的。
回答by Ron Warholic
If you want to call C++ code the easiest way will be to use C++ with Component Extensions. This is just plain C++ that compiles to native code however it has a few extensions (reminiscent of C++/CLI) that let you use the WinRT COM components without worrying quite so much about the COM plumbing.
如果您想调用 C++ 代码,最简单的方法是使用带有组件扩展的 C++。这只是编译为本机代码的普通 C++,但它有一些扩展(让人想起 C++/CLI),让您可以使用 WinRT COM 组件而不必太担心 COM 管道。
With C++ and WinRT you can actually use XAML like the managed languages to define your user interface. It's pretty neat, see the documentation here:
使用 C++ 和 WinRT,您实际上可以像托管语言一样使用 XAML 来定义您的用户界面。它非常整洁,请参阅此处的文档:
I haven't looked into it but you may still be able to use P/Invoke or COM interop in the managed languages to call C++ code for a Metro style app however this is unconfirmed. Obviously a desktop app can do all the things it normally would.
我还没有研究过它,但您可能仍然可以在托管语言中使用 P/Invoke 或 COM 互操作来调用 Metro 风格应用程序的 C++ 代码,但这是未经证实的。显然,桌面应用程序可以做它通常会做的所有事情。
回答by ReinstateMonica Larry Osterman
You can use C++ code to write metro style applications. You can also write applications in Javascript/HTML/CSS and call APIs that you write in C++ or C#/VB from those JavaScript applications.
您可以使用 C++ 代码编写 Metro 风格的应用程序。您还可以使用 Javascript/HTML/CSS 编写应用程序,并从这些 JavaScript 应用程序调用您使用 C++ 或 C#/VB 编写的 API。