Exemplo n.º 1
0
 public static UInt64 GetDataSize(UInt16 format)
 {
     using (var clipboard = new ClipboardApi())
     {
         return clipboard.GetDataSize(format);
     }
 }
Exemplo n.º 2
0
 public static Byte[] GetData(UInt16 format)
 {
     using (var clipboard = new ClipboardApi())
     {
         return clipboard.GetData(format);
     }
 }
Exemplo n.º 3
0
 public static void Empty()
 {
     using (var clipboard = new ClipboardApi())
     {
         ClipboardApiException.ThrowIfFailed(!Win32Api.EmptyClipboard(), "EmptyClipboard");
     }
 }
Exemplo n.º 4
0
        public static void Restore(String fileName)
        {
            Clipboard.Empty();

            var reader = new ClipboardFileReader();

            using (var clipboard = new ClipboardApi())
            {
                reader.EntryRead += (s, e) =>
                {
                    var data = reader.ReadData();
                    clipboard.SetData(e.Entry.Id, data);
                };

                reader.Read(fileName);
            }
        }
Exemplo n.º 5
0
        public static UInt16[] GetFormats()
        {
            var formats = new List<UInt16>();

            using (var clipboard = new ClipboardApi())
            {
                var format = (UInt16)clipboard.EnumFormats(0);

                while (format != 0)
                {
                    formats.Add(format);

                    format = clipboard.EnumFormats(format);
                }
            }

            return formats.ToArray();
        }
Exemplo n.º 6
0
        public static void SetText(String text)
        {
            Clipboard.Empty();

            using (var clipboard = new ClipboardApi())
            {
                var data = Encoding.Unicode.GetBytes(text + "\0");
                clipboard.SetData((UInt16)ClipboardFormats.CF_UNICODETEXT, data);
            }
        }
Exemplo n.º 7
0
 public static void SetData(UInt16 format, Byte[] data)
 {
     using (var clipboard = new ClipboardApi())
     {
         clipboard.SetData(format, data);
     }
 }