发新话题
打印

[翻译]剪贴板消息

[翻译]剪贴板消息

译文作者:灰狐(grayfox)
原始出处:灰狐's Blog(www.huihu32.cn)

开篇注明:本文是我第一次进行英文翻译,本人英文太菜,四级考了两次也没过,所以在本篇文章中如果出现错误的话,请各位大虾不吝赐教,多多指正。
原文作者为crazyjava,版权归其所有。

译文:

剪贴板消息



以下是所有基于 Windows API 的剪贴板消息。
如果你使用的是BCB(译者注:Borland C++ Builder),很显然每一个消息都被映射向了相应的窗体函数。
比如:WM_DRAWCLIPBOARD 早先就作为涉及到的heman被映射向 TForm1::OnDrawClipboard 函数。

(数据资料来源于 MSDN ,由 crazyjava 编辑)

WM_ASKCBFORMATNAME
被剪贴板查看者窗口发送向剪贴板拥有者的内容需要一个名为 CF_OWNERDISPLAY 的剪贴板内容格式。

WM_CHANGECBCHAIN
当一个窗口将要被从剪贴板查看者链条中移走时此消息被发送向该链条中的第一个窗口。

WM_CLEAR
一个应用实例将会向一个编辑框或组合框发送 WM_CLEAR 消息以从编辑内容中删除(清除)当前选中的内容,如果有内容被选中的话。

WM_COPY
一个应用实例将会向一个编辑框或组合框发送 WM_COPY 消息将当前选中的内容以 CF_TEXT 格式复制到剪贴板中。

WM_CUT
一个应用实例将会向一个编辑框或组合框发送 WM_CUT 消息以从编辑内容中将当前选中的内容删除(剪切),如果有内容被选中的话,然后以 CF_TEXT 格式将其复制到剪贴板中。

WM_DESTROYCLIPBOARD
当 EmptyClipboard 函数被调用以清空剪贴板的时候此消息将会被发送向剪贴板拥有者。

WM_DRAWCLIPBOARD
当剪贴板中的内容改变时此消息将会被发送给剪贴板查看链的第一个窗口。它将使一个剪贴板查看者窗口显示出更新后的剪贴板内容。

WM_HSCROLLCLIPBOARD
此消息将会被一个剪贴板查看窗口发送向剪贴板拥有者。
它发生在当剪贴板中包含这 CF_OWNERDISPLAY 格式的数据时且在剪贴板查看者的水平滚动条中有事件发生时。这个拥有者应该滚动剪贴板图片和更新滚动条的数值。

WM_PAINTCLIPBOARD
当剪贴板包含有 CF_OWNERDISPLAY 格式数据且剪贴板查看窗口的客户区需要重绘是此消息将会被该剪贴板查看窗口发送向剪贴板拥有者。

WM_PASTE
一个应用实例发送 WM_PASTE 消息以将剪贴板中的当前内容复制到编辑框或组合框中当前光标所在的位置。只有当剪贴板包含了 CF_TEXT 格式的内容时数据会被插入。

WM_RENDERALLFORMATS
如果剪贴板拥有者要定时地舍弃一些或更多的剪贴板格式时,在它被毁坏之前此消息将会被发送向剪贴板查看者。当剪贴板中的内容对于其他实例仍然有用时,剪贴板拥有者必须在有能力的情况下以所有的格式保留数据,并且通过调用SetClipboardData 函数将其安置在剪贴板上。

WM_RENDERFORMAT
如果一个剪贴板查看者要推迟舍弃一个特殊的剪贴板格式并且如果一个应用程序实例需要这种格式的数据时此消息将会被发送向剪贴板查看者。这时剪贴板拥有者必须保留此特殊格式的数据并通过调用 SetClipboardData 函数将其安置在剪贴板上。

WM_SIZECLIPBOARD
当剪贴板包含有 CF_OWNERDISPLAY 格式的内容并且剪贴板查看者的客户区改变了大小的时候此消息将会被剪贴板查看窗口发送向剪贴板拥有者。

WM_VSCROLLCLIPBOARD
当剪贴板包含有 CF_OWNERDISPLAY 格式数据并且在剪贴板查看者的垂直滚动条中有事件发生时此消息将会被一个剪贴板查看窗口发送向剪贴板拥有者。此拥有者需要滚动剪贴板图片且更新滚动条的数值。

原文:

Clipboard Messages



The following is all of clipboard messages based on Window API.
If you use BCB, it is sure that each msg is mapped to each form function.
eg. WM_DRAWCLIPBOARD is mapped to TForm1::OnDrawClipboard as heman mentioned earlier.

(data sources come from MSDN, edited by crazyjava)
WM_ASKCBFORMATNAME
it is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.

WM_CHANGECBCHAIN
it is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.

WM_CLEAR
An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.

WM_COPY
An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.

WM_CUT
An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format .

WM_DESTROYCLIPBOARD
it is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard

WM_DRAWCLIPBOARD
it is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.

WM_HSCROLLCLIPBOARD
it is sent to the clipboard owner by a clipboard viewer window.
This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the
clipboard image and update the scroll bar values.


WM_PAINTCLIPBOARD
it is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting

WM_PASTE
An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted
only if the clipboard contains data in CF_TEXT format.

WM_RENDERALLFORMATS
it is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.

WM_RENDERFORMAT
it is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the
specified format and place it on the clipboard by calling the SetClipboardData function.

WM_SIZECLIPBOARD
it is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.

WM_VSCROLLCLIPBOARD
it is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll
bar. The owner should scroll the clipboard image and update the scroll bar values.

PS:本文中作者对这些地方不甚理解:clipboard owner、clipboard viewer 、heman、clipboard viewer chain、clipboard image、render等,希望各位大侠多多指教。
Welcome to My Blog :  http://www.huihu32.cn 金麟岂是池中物,一遇风云便化龙!

TOP

WM_ASKCBFORMATNAME
it is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.

通过一个剪贴板查看程序窗口发给剪贴板所有者(即用户),以请求一个CF_OWNERDISPLAY的格式名。

WM_CHANGECBCHAIN
it is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.

当一个窗口被移出一连串的窗口剪贴板查看程序时,它被发向一连串剪贴板查看程序的第一个窗口。

至于heman,在金山词霸中被译为“专横的大汉”,当用在计算机术语,尤其是这篇文章中时,就只有凭借自己对BCB的经验及API的理解程度来翻译了,实在没办法就略过,不一定每一个词都要翻译的,只要不影响关键意思,不影响读者理解,就可以不翻译。

chain,作名次使用时为铁链,链条,一连串,一系列。我想,只要你在这篇文章中所提到的技术方面稍微有些经验应该就不难理解,只是不好表达出来。或许一个词可以形容这种情况:只可意会,不可言传 :)

clipboard image:剪贴板图像

render:作动词使用时可译为递交,归还,放弃,实施,翻译(rendering)。此文中只有靠你自己去理解了,由于文中所提到的API我没有怎么使用和接触过,所以没办法帮你指明。我给你的建议是,去找本API手册查找关于这些API的中文介绍,然后再对比着理解 :)

TOP

发新话题