Ruby、Windows 剪贴板错误?

发布于 2024-12-04 14:34:07 字数 224 浏览 0 评论 0原文

问题:Ruby TK GUI 应用程序在退出时清空 Windows 剪贴板是否正常?

问题:我有一个 TkText,其中包含一些文本,如果我按 Ctrl + C 然后关闭应用程序,剪贴板为空,如果我在应用程序仍打开时粘贴,则一切正常,粘贴一次后即使关闭应用程序也没关系,它仍然保留在剪贴板中。

这是有意发生的吗?

Question: Is it normal for a Ruby TK GUI app to empty the windows clipboard on exit?

Problem: I have a TkText with some text in it, if I Ctrl + C then close the application the clipboard is empty, if I paste while the application is still open everything works fine, after pasting once it doesn't even matter to close the application, it still remains in the clipboard.

Is this intended to happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅浅淡淡 2024-12-11 14:34:08

听起来延迟渲染可能正在生效。您可能已经在 Excel、Word、Outlook 或任何大型绘图程序等应用程序中看到过这种情况。您进行复制,当您关闭应用程序时,系统会显示类似“您已在剪贴板上放置了大量数据,您希望将其提供给其他程序吗?”之类的信息。这是因为复制是通过“延迟渲染”完成的,并且数据实际上并不在剪贴板上。剪贴板只有空句柄,如果/当确实需要粘贴某些内容(特别是异国情调或昂贵的格式,如 WKS1、SYLK、EMF、HTML 等)时,应用程序需要当场生成它。因此,在关闭时,这些应用程序实际上只是在处理这些未履行的责任,因为它们在消失后将无法回答 WM_RenderFormat 消息。
我希望您的 ruby​​ 环境即使对 CF_TEXT 这样的简单格式也使用延迟渲染,而不是用完全填充的数据更新剪贴板(许多应用程序都会默默地这样做),它们只是将其吹走。或者也许他们确实留下了空句柄。运行旧的 XP 剪贴板查看器将向您展示真正的空剪贴板和认为它有文本(文本显示在可用格式列表中)但实际上只有空句柄的剪贴板之间的区别。

It sounds like Delayed Rendering may be in effect. You've probably seen this with apps like Excel, Word, Outlook, or just about any large drawing program. You copy, and when you close the app is says something like "you've placed a large amount of data on the clipboard, would you like to make it available to other programs?". That's because the copy was done with "delayed rendering" and the data isn't really on the clipboard. The clipboard just has empty handles, and if/when something actually requests to paste (especially exotic or expensive formats like WKS1, SYLK, EMF, HTML, etc..), the app is required to produce it on the spot. So upon shutdown, these apps are really just taking care of these unfulfilled liabilities because they won't be around to answer the WM_RenderFormat messages after they're gone.
I expect that your ruby environment is using delayed rendering for even simple formats like CF_TEXT, and rather than updating the clipboard with fully-populated data (which lots of apps do, silently), they just blow it away. Or maybe they DO leave null handles out there. Running the old XP clipboard viewer would show you the difference between a truly empty clipboard, and one that thinks it has text (TEXT shows up in the list of available formats) but really just has null handles.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文