在Windows中,剪贴板到底是什么?
In Windows, what actually is the clipboard?
这听起来像是一个愚蠢的问题,但剪贴板到底是什么?
当我注意到剪贴板的使用方式比我最初想象的要复杂得多后,我的好奇心激增了。我认为剪贴板基本上会跟踪一串文本、图像或文件,然后只要上下文匹配,就会将任何内容粘贴到用户指定的位置。
但是,使用 Microsoft Word 等文字处理软件,我注意到您可以直接从网站复制和粘贴样式,并且在 Skype 等程序中,您可以复制在记事本文档中看似普通文本的引号,但是实际上是 Skype 中格式化的笔记 UI.
我查看了一个伪造的 Skype 报价生成器的源代码,似乎有多个剪贴板。还是剪贴板布局成key-value类型的map?
有多种clipboard data formats and when you SetClipboardData you specify which format the data is. You can set multiple clipboard formats simultaneously because the clipboard is cleared explicitly with EmptyClipboard,您还可以注册自己的自定义格式,以便在您的应用程序之间使用。
对方打开剪贴板,查看当前有哪些格式,选择最合适的,然后进行相应处理。
要添加到@ybungalobill 的答案,请阅读 Windows 开发中心 here 上可用的其余信息。 CUT/COPY 操作的快速摘录是 -
To place information on the clipboard, a window first clears any previous clipboard content by using the EmptyClipboard function. This function sends the WM_DESTROYCLIPBOARD message to the previous clipboard owner, frees resources associated with data on the clipboard, and assigns clipboard ownership to the window that has the clipboard open. To find out which window owns the clipboard, call the GetClipboardOwner function.
After emptying the clipboard, the window places data on the clipboard in as many clipboard formats as possible, ordered from the most descriptive clipboard format to the least descriptive. For each format, the window calls the SetClipboardData function, specifying the format identifier and a global memory handle. The memory handle can be NULL, indicating that the window renders the data on request. For more information, see Delayed Rendering.
如果愿意,您可以在 API 参考中跟进函数定义 choose.But SetClipboardData 是神奇发生的函数。
这听起来像是一个愚蠢的问题,但剪贴板到底是什么?
当我注意到剪贴板的使用方式比我最初想象的要复杂得多后,我的好奇心激增了。我认为剪贴板基本上会跟踪一串文本、图像或文件,然后只要上下文匹配,就会将任何内容粘贴到用户指定的位置。
但是,使用 Microsoft Word 等文字处理软件,我注意到您可以直接从网站复制和粘贴样式,并且在 Skype 等程序中,您可以复制在记事本文档中看似普通文本的引号,但是实际上是 Skype 中格式化的笔记 UI.
我查看了一个伪造的 Skype 报价生成器的源代码,似乎有多个剪贴板。还是剪贴板布局成key-value类型的map?
有多种clipboard data formats and when you SetClipboardData you specify which format the data is. You can set multiple clipboard formats simultaneously because the clipboard is cleared explicitly with EmptyClipboard,您还可以注册自己的自定义格式,以便在您的应用程序之间使用。
对方打开剪贴板,查看当前有哪些格式,选择最合适的,然后进行相应处理。
要添加到@ybungalobill 的答案,请阅读 Windows 开发中心 here 上可用的其余信息。 CUT/COPY 操作的快速摘录是 -
To place information on the clipboard, a window first clears any previous clipboard content by using the EmptyClipboard function. This function sends the WM_DESTROYCLIPBOARD message to the previous clipboard owner, frees resources associated with data on the clipboard, and assigns clipboard ownership to the window that has the clipboard open. To find out which window owns the clipboard, call the GetClipboardOwner function.
After emptying the clipboard, the window places data on the clipboard in as many clipboard formats as possible, ordered from the most descriptive clipboard format to the least descriptive. For each format, the window calls the SetClipboardData function, specifying the format identifier and a global memory handle. The memory handle can be NULL, indicating that the window renders the data on request. For more information, see Delayed Rendering.
如果愿意,您可以在 API 参考中跟进函数定义 choose.But SetClipboardData 是神奇发生的函数。