gpt4 book ai didi

c++ - 使用不支持超链接的文本编辑器的替代文本将超链接复制到剪贴板

转载 作者:行者123 更新时间:2023-11-28 05:05:44 25 4
gpt4 key购买 nike

是否可以在剪贴板上存储一个超链接,其中包含一些文本,这些文本将被粘贴到不支持超链接的文本编辑器中?例如记事本。

我已经有了 code that generates hyperlinks对于资源管理器中的文件。目前,如果我将超链接复制到剪贴板,记事本中的粘贴选项将被禁用,但我可以将我的超链接复制到 Outlook 或 Word 中。就我而言,我想将文件路径粘贴到记事本中。

我认为如果没有文本编辑器端的特定处理程序,这是不可能的。但如果可能的话,我将感谢一些文章或示例的链接。

最佳答案

只需打开剪贴板,然后多次调用 SetClipboardData,为您要提供的每种格式调用一次。您可以同时将 CF_HTMLCF_TEXT(按此顺序)放入剪贴板。这是记录在案的行为:

Multiple Clipboard Formats

A window can place more than one clipboard object on the clipboard, each representing the same information in a different clipboard format. When placing information on the clipboard, the window should provide data in as many formats as possible. To find out how many formats are currently used on the clipboard, call the CountClipboardFormats function.

Clipboard formats that contain the most information should be placed on the clipboard first, followed by less descriptive formats. A window pasting information from the clipboard typically retrieves a clipboard object in the first format it recognizes. Because clipboard formats are enumerated in the order they are placed on the clipboard, the first recognized format is also the most descriptive.

For example, suppose a user copies styled text from a word-processing document. The window containing the document might first place data on the clipboard in a registered format, such as RTF. Subsequently, the window would place data on the clipboard in a less descriptive format, such as text (CF_TEXT).

When the content of the clipboard is pasted into another window, the window retrieves data in the most descriptive format it recognizes. If the window recognizes RTF, the corresponding data is pasted into the document. Otherwise, the text data is pasted into the document and the formatting information is lost.

关于c++ - 使用不支持超链接的文本编辑器的替代文本将超链接复制到剪贴板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44847939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com