C + +/CX 语言参考C++/CX Language Reference

C + +/CX 是 c + + 语言的一组扩展,使你能够在尽可能接近现代 c + + 的用法中创建 Windows 应用和 Windows 运行时组件。C++/CX is a set of extensions to the C++ language that enable the creation of Windows apps and Windows Runtime components in an idiom that is as close as possible to modern C++. 使用 c + +/CX 编写本机代码中的 Windows 应用和组件,以便与 Visual c #、Visual Basic 和 JavaScript 以及支持 Windows 运行时的其他语言轻松交互。Use C++/CX to write Windows apps and components in native code that easily interact with Visual C#, Visual Basic, and JavaScript, and other languages that support the Windows Runtime. 在那些需要直接访问原始 COM 接口或非异常代码的罕见情况下,你可以使用 Windows 运行时 c + + 模板库 (WRL) In those rare cases that require direct access to the raw COM interfaces, or non-exceptional code, you can use the Windows Runtime C++ Template Library (WRL).

备注

建议使用/WinRT 作为C++/cx 替代方法。 C++C++/WinRT is the recommended alternative to C++/CX. 它是新的标准 c + + 17 语言投影,适用于 Windows 运行时 Api,可从版本1803的最新 Windows 10 SDK 获得。It is a new, standard C++17 language projection for Windows Runtime APIs, available in the latest Windows 10 SDK from version 1803 onward. C + +/WinRT 完全在头文件中实现,旨在为您提供对现代 Windows API 的一流访问。C++/WinRT is implemented entirely in header files, and designed to provide you with first-class access to the modern Windows API.

使用 c + +/WinRT,可以使用任何符合标准的 c + + 17 编译器来使用和创作 Windows 运行时 Api。With C++/WinRT, you can both consume and author Windows Runtime APIs using any standards-compliant C++17 compiler. 与 Windows 运行时的任何其他语言选项相比,c + +/WinRT 的性能更佳,生成的二进制文件更小。C++/WinRT typically performs better and produces smaller binaries than any other language option for the Windows Runtime. 我们将继续支持 C++/CX 和 WRL,但强烈建议新应用程序使用 C++/WinRT。We will continue to support C++/CX and WRL, but highly recommend that new applications use C++/WinRT. 有关详细信息,请参阅 C++/WinRTFor more information, see C++/WinRT.

通过使用 c + +/CX,你可以创建:By using C++/CX, you can create:

链接Link 描述Description
快速参考Quick Reference C + +/CX 的关键字和运算符表Table of keywords and operators for C++/CX.
类型系统Type System 介绍基本 c + +/CX 类型和编程构造,以及如何利用 c + +/CX 来使用和创建 Windows 运行时类型。Describes basic C++/CX types and programming constructs, and how to utilize C++/CX to consume and create Windows Runtime types.
生成应用和库Building apps and libraries 讨论如何使用 IDE 生成应用程序并链接到静态库和 Dll。Discusses how to use the IDE to build apps and link to static libraries and DLLs.
与其他语言互操作Interoperating with Other Languages 讨论使用 c + +/CX 编写的组件如何与用 JavaScript、任何托管语言或 Windows 运行时 c + + 模板库编写的组件一起使用。Discusses how components that are written by using C++/CX can be used with components that are written in JavaScript, any managed language, or the Windows Runtime C++ Template Library.
线程处理和封送处理Threading and Marshaling 讨论如何为你创建的组件指定线程处理和封送行为。Discusses how to specify the threading and marshaling behavior of components that you create.
命名空间引用Namespaces Reference 默认命名空间、平台命名空间、Platform::Collections 和相关命名空间的参考文档。Reference documentation for the default namespace, the Platform namespace, Platform::Collections, and related namespaces.
通用 Windows 平台应用中不支持的 CRT 函数CRT functions not supported in Universal Windows Platform apps 列出 Windows 运行时应用中不可用的 CRT 函数。Lists the CRT functions that are not available for use in Windows Runtime apps.
Windows 10 应用入门Get started with Windows 10 apps 提供有关 Windows 10 应用的深入指导以及详细信息的链接。Provides high-level guidance about Windows 10 apps and links to more information.
C + +/CX 第0部分(共 n 部分) [ ] :简介C++/CX Part 0 of [n]: An Introduction

C + +/CX 第1部分(共 n 部分) [ ] :简单类C++/CX Part 1 of [n]: A Simple Class

C + +/CX 第2部分(共 n 部分) [ ] :磨损头衔的类型C++/CX Part 2 of [n]: Types That Wear Hats

C + +/CX 第3部分(共3部分) [ ] :正在建设C++/CX Part 3 of [n]: Under Construction

C + +/CX 第4部分,共 [ n 个 ] :静态成员函数C++/CX Part 4 of [n]: Static Member Functions
C + +/CX 上的介绍性博客系列An introductory blog series on C++/CX.