You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: windows-apps-src/cpp-and-winrt-apis/clipboard-to-winrt-from-csharp.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ ms.localizationpriority: medium
11
11
12
12
This topic presents a case study of porting one of the [Universal Windows Platform (UWP) app samples](https://github.com/microsoft/Windows-universal-samples) from [C#](/visualstudio/get-started/csharp) to [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). You can gain porting practice and experience by following along with the walkthrough and porting the sample for yourself as you go.
13
13
14
-
Also see [Move to C++/WinRT from C#](/windows/uwp/cpp-and-winrt-apis/move-to-winrt-from-csharp), which presents a number of sections that address specific technical details involved in porting from C# to C++/WinRT.
14
+
For a comprehensive catalog of the technical details involved in porting to C++/WinRT from C#, see the companion topic [Move to C++/WinRT from C#](/windows/uwp/cpp-and-winrt-apis/move-to-winrt-from-csharp).
15
15
16
16
## Download and test the Clipboard sample
17
17
@@ -134,7 +134,9 @@ And you'll recall that **MainPage.Scenarios** is a collection of **Scenario** ob
134
134
135
135
Now let's add to the `MainPage.idl` file the new types and the new member of **Mainpage** that we've decided to declare in IDL. At the same time, we'll remove from the IDL the placeholder members of **Mainpage** that the Visual Studio project template gave us.
136
136
137
-
So, in your C++/WinRT project, open `MainPage.idl`, and edit it so that it looks like the listing below. Note that one of the edits is to change the namespace name from **Clipboard** to **SDKTemplate**. If you like, you can just delete the current contents of your `MainPage.idl`, and paste in the listing below. Another tweak to note is that we're changing the name of **Scenario::ClassType** to **Scenario::ClassName**.
137
+
So, in your C++/WinRT project, open `MainPage.idl`, and edit it so that it looks like the listing below. Note that one of the edits is to change the namespace name from **Clipboard** to **SDKTemplate**. If you like, you can just replace the entire contents of `MainPage.idl` with the following code. Another tweak to note is that we're changing the name of **Scenario::ClassType** to **Scenario::ClassName**.
138
+
139
+
138
140
139
141
```idl
140
142
// MainPage.idl
@@ -1122,7 +1124,7 @@ There's value in consolidating your runtime classes into a single IDL file (see
Copy file name to clipboardExpand all lines: windows-apps-src/cpp-and-winrt-apis/faq.md
+2
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,8 @@ If you have a runtime class that frees resources in its destructor, and that run
78
78
- If you can't guarantee that you have the last remaining reference to an object (because you passed it to other APIs, which could be keeping a reference), then calling **IClosable::Close** is a good idea.
79
79
- When in doubt, it's safe to call **IClosable::Close** manually, rather than waiting for the wrapper to call it on destruction.
80
80
81
+
So, if you know that you have the last reference, then you can let the wrapper destructor do the work. If you need to close before the last reference vanishes, then you need to call **Close**. To be exception-safe, you should **Close** in a resource-acquisition-is-initialization (RAII) type (so that close happens on unwind). C++/WinRT doesn't have a **unique_close** wrapper, but you can make your own.
82
+
81
83
## Can I use LLVM/Clang to compile with C++/WinRT?
82
84
We don't support the LLVM and Clang toolchain for C++/WinRT, but we do make use of it internally to validate C++/WinRT's standards conformance. For example, if you wanted to emulate what we do internally, then you could try an experiment such as the one described below.
Copy file name to clipboardExpand all lines: windows-apps-src/cpp-and-winrt-apis/index.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -57,8 +57,8 @@ C++/WinRT performs better and produces smaller binaries than any other language
57
57
|[Move to C++/WinRT from C++/CX](move-to-winrt-from-cx.md)| This topic describes the technical details involved in porting the source code in a [C++/CX](/cpp/cppcx/visual-c-language-reference-c-cx) project to its equivalent in [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). |
58
58
|[Interop between C++/WinRT and C++/CX](interop-winrt-cx.md)| This topic shows two helper functions that can be used to convert between [C++/CX](/cpp/cppcx/visual-c-language-reference-c-cx) and [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt) objects. |
59
59
|[Move to C++/WinRT from WRL](move-to-winrt-from-wrl.md)| This topic shows how to port [Windows Runtime C++ Template Library (WRL)](/cpp/windows/windows-runtime-cpp-template-library-wrl) code to its equivalent in [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). |
60
-
|[Porting the Clipboard sample to C++/WinRT from C#—a case study](clipboard-to-winrt-from-csharp.md)| This topic presents a case study of porting one of the [Universal Windows Platform (UWP) app samples](https://github.com/microsoft/Windows-universal-samples) from [C#](/visualstudio/get-started/csharp) to [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). |
61
-
|[Move to C++/WinRT from C#](move-to-winrt-from-csharp.md)| This topic describes the technical details involved in porting the source code in a [C#](/visualstudio/get-started/csharp) project to its equivalent in [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). |
60
+
|[Porting the Clipboard sample to C++/WinRT from C#—a case study](clipboard-to-winrt-from-csharp.md)| This topic presents a case study of porting one of the [Universal Windows Platform (UWP) app samples](https://github.com/microsoft/Windows-universal-samples) from [C#](/visualstudio/get-started/csharp) to [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). You can gain porting practice and experience by following along with the walkthrough and porting the sample for yourself as you go. |
61
+
|[Move to C++/WinRT from C#](move-to-winrt-from-csharp.md)| This topic comprehensively catalogs the technical details involved in porting the source code in a [C#](/visualstudio/get-started/csharp) project to its equivalent in [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt). |
62
62
|[Interop between C++/WinRT and the ABI](interop-winrt-abi.md)| This topic shows how to convert between application binary interface (ABI) and C++/WinRT objects. |
63
63
|[Strong and weak references in C++/WinRT](weak-references.md)| The Windows Runtime is a reference-counted system; and in such a system it's important for you to know about the significance of, and distinction between, strong and weak references. |
64
64
|[Agile objects](agile-objects.md)| An agile object is one that can be accessed from any thread. Your C++/WinRT types are agile by default, but you can opt out. |
0 commit comments