C++/CX
C++/CX (or C++ Component Extensions) is a language projection for Microsoft's Windows Runtime platform.[1] It takes the form of a language extension for C++ compilers, and it enables C++ programmers to write programs that call Windows Runtime (WinRT) APIs.[1] C++/CX is superseded by the C++/WinRT language projection, which is not an extension to the C++ language; rather, it is an entirely standard modern ISO C++17 header file-based library.[src] The language extensions borrow syntax from C++/CLI but target the Windows Runtime Universal Windows Platform native code instead of the Common Language Runtime and managed code.[src] It brings a set of syntax and library abstractions that project COM's WRL subset-based WinRT programming model in a way that is intuitive to C++/CLI managed extensions' coders.[1] It is possible to call the Windows Runtime from native ISO C++ via the lower level Windows Runtime C++ Template Library (WRL).[src] However, WRL is also superseded by C++/WinRT.[src]
C++/CX (or C++ Component Extensions) is a language projection for Microsoft's Windows Runtime platform.[1] It takes the form of a language extension for C++ compilers, and it enables C++ programmers to write programs that call Windows Runtime (WinRT) APIs.[1] C++/CX is superseded by the C++/WinRT language projection, which is not an extension to the C++ language; rather, it is an entirely standard modern ISO C++17 header file-based library.[src] The language extensions borrow syntax from C++/CLI but target the Windows Runtime Universal Windows Platform native code instead of the Common Language Runtime and managed code.[src] It brings a set of syntax and library abstractions that project COM's WRL subset-based WinRT programming model in a way that is intuitive to C++/CLI managed extensions' coders.[1] It is possible to call the Windows Runtime from native ISO C++ via the lower level Windows Runtime C++ Template Library (WRL).[src] However, WRL is also superseded by C++/WinRT.[src] WinRT objects are created, or activated, using ref new and assigned to variables declared with the ^ (hat) notation inherited from C++/CLI.[1] Foo^ foo = ref new Foo(); A WinRT variable is simply a pair of a pointer to virtual method table and pointer to the object's internal data.[src] There are special kinds of runtime classes that may contain component extension constructs.[src] These are simply referred to as ref classes because they are declared using ref class .[src] public ref class MyClass { }; A file that is generated and updated by the GUI-designer, and thus should not be modified by the programmer.[src] Note the keyword partial .[src] // Foo.private.h pragma once using Platform::String; partial ref class Foo { private: int id; String^ name; }; The file where the programmer writes user-interface logic.[src] The header in which the compiler-generated part of the class is defined is imported.[src] Note that the keyword partial is not necessary.[src] // Foo.public.h pragma once include "Foo.private.h" using Platform::String; ref class Foo { public: int getId(); String^ getName(); }; This is the file in which the members of the partial class are implemented.[src] // Foo.cpp include "pch.h" include "Foo.public.h" using Platform::String; int Foo::getId() { return id; } String^ Foo::getName() { return name; } generic public ref class Bag { property T Item; }; ifdef __cplusplus_winrt // C++/CX specific code goes here...[1] endif ==References== Visual C++ Language Reference (C++/CX)[src]
26 sentences · 26 cited inline · 1 references stored
References
- [https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt/ Introduction to C++/WinRT] docs.microsoft.com . · retrieved 2026-08-20 · rev 1370446943
Cite this reference
MLA "[https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt/ Introduction to C++/WinRT] docs.microsoft.com ." https://docs. 2026-08-20. https://en.wikipedia.org/w/index.php?oldid=1370446943. Accessed 05 December 2026.
Chicago "[https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt/ Introduction to C++/WinRT] docs.microsoft.com ." https://docs. 2026-08-20. https://en.wikipedia.org/w/index.php?oldid=1370446943.
APA https://docs. (2026). [https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt/ Introduction to C++/WinRT] docs.microsoft.com . Retrieved December 5, 2026, from https://en.wikipedia.org/w/index.php?oldid=1370446943
Cite this article
MLA
"C++/CX." encyclopegia.org, 2026, https://encyclopegia.org/wiki/c-cx. Accessed 05 December 2026.
Chicago
"C++/CX." encyclopegia.org. Accessed December 5, 2026. https://encyclopegia.org/wiki/c-cx.
APA
encyclopegia.org. (2026). C++/CX. Retrieved December 5, 2026, from https://encyclopegia.org/wiki/c-cx
Accessed December 5, 2026 · CC BY-SA 4.0 · citation page · JSON