剪贴板在 Windows 中如何工作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1994056/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does the clipboard work in Windows?
提问by proGress
What is its data structure? Is it XML-based? How can it distinguish between different content types, for example text, image, files etc.?
它的数据结构是什么?它是基于 XML 的吗?它如何区分不同的内容类型,例如文本、图像、文件等?
回答by Lothar
It is a system wide bit bucket, which means it just holds a sequence of bytes and an integer value (a windows atom) which describes it's format - but does not ensure that the byte sequence is really this format.
它是一个系统范围的位桶,这意味着它只保存一个字节序列和一个描述其格式的整数值(一个 Windows 原子)——但不能确保字节序列确实是这种格式。
The only feature other then this is that an application can decide if it wants the system to store the byte sequence or if the application keeps the data itself and only provide it when someone is requesting it.
除此之外的唯一功能是应用程序可以决定它是否希望系统存储字节序列,或者应用程序是否保留数据本身并仅在有人请求时才提供它。
So as you see it is an API and not a data structure.
正如你所看到的,它是一个 API 而不是数据结构。
回答by ta.speot.is
If you're using the Win32 API, here is the reference: http://msdn.microsoft.com/en-us/library/ms649014(VS.85).aspx
如果您使用的是 Win32 API,请参考:http: //msdn.microsoft.com/en-us/library/ms649014(VS.85).aspx
回答by Joey Adams
Quick, lazy Google search got this; hope it helps a bit:
快速,懒惰的谷歌搜索得到了这个;希望它有点帮助:
http://msdn.microsoft.com/en-us/library/system.windows.clipboard.aspx
http://msdn.microsoft.com/en-us/library/system.windows.clipboard.aspx