title: Can I use the Clipboard.SetContent function in a CLI app?
body: <p>The function is executed without error and returns <code>Ok(())</code>, but the text is not pushed into the clipboard:</p>
  <pre><code>pub fn copy_text(text_fragment: winrt::HString) -&gt; winrt::Result&lt;()&gt; {
      let data_package = DataPackage::new()?;
      data_package.set_text(text_fragment)?;
      Clipboard::set_content(data_package)
  }
  </code></pre>
  <p>The documentation about the Windows runtime API has the following statement for the <a href="https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.datatransfer.clipboard.setcontent?view=winrt-19041" rel="nofollow noreferrer"><code>Clipboard.SetContent(DataPackage)</code></a> function:</p>
  <blockquote>
  <p>Use this method after creating and defining a <code>DataPackage</code> with the data you want to put on the clipboard. Call this method only when the application is in the foreground, or when a debugger is attached.</p>
  </blockquote>
  <p>Is there any way I can use that function without a UI?</p>