WPF C# Copy Audio File To Clipboard

audio, c#, clipboard, wpf

Solution

No need to read the contents of the file. You can add the file directly to the clipboard using the SetFileDropList

StringCollection files = new StringCollection();
files.Add(fileLocation);
Clipboard.SetFileDropList(files);

Problem

I am trying to copy an audio file to the clipboard in C# using a file path. The issue I am running into is that it is either not copying, or not copying correctly because it can not be pasted outside of the application. Here is how I am trying to copy it to the clipboard: ``` b_array = File.ReadAllBytes(fileLocation); Clipboard.Clear(); Clipboard.SetAudio(b_array); ``` the variable fileLocation in my testing equals something like: C:\Users\ben\Music\Samples\kick_05.wav

Original source

Related problems