How do I safely and correctly create a backup of the Windows clipboard?

前端 未结 1 1893
抹茶落季
抹茶落季 2021-02-15 19:19

I\'m trying to create a backup of the Windows clipboard. Basically what I\'m doing is using EnumClipboardFormats() to get all of the formats that exist on the clipb

1条回答
  •  青春惊慌失措
    2021-02-15 20:09

    This is folly, as you cannot 100% backup/restore the clipboard. Lots of apps used delayed rendering, and the data is not actually on the clipboard. When you request to paste, they get notified and produce the data. This would take several minutes and hundreds of MB for large amounts of data from apps like Excel. Take a look at the number of formats listed on the clipboard when you copy from Excel. There will be more than two dozen, including Bitmap, Metafile, HTML. What do you think will happen if you select 255x25000 cells in Excel and copy that? How large would that bitmap be? Tip: save any open documents before attempting this, as you're likely going to have to reboot.

    0 讨论(0)
提交回复
热议问题