简体   繁体   English

如何在 Windows 上使用 C++ 轻松读取剪贴板中的文本并将文本写入剪贴板?

[英]How to easily read text from the clipboard and write text to the clipboard with C++ on Windows?

I'm asking for a C++ example of a command-line program that puts "Hello" in front of the existing text in the clipboard.我要求一个命令行程序的 C++ 示例,它将"Hello"放在剪贴板中现有文本的前面。

Example: Highlight the word World , then press Ctrl+C , then start the program, then press Ctrl+V .示例:突出显示单词World ,然后按Ctrl+C ,然后启动程序,然后按Ctrl+V Hello World should now be inserted.现在应该插入Hello World

I would like to create a few lines of small program that converts links between Windows and Linux style.我想创建几行小程序来转换 Windows 和 Linux 风格之间的链接。 The finished .exe can be started using a key combination.完成的.exe可以使用组合键启动。 This saves me the tedious manual rewriting of links.这为我省去了繁琐的手动重写链接。

It seems that in this programming language (C++) it is impossible to read and write text from & to the clipboard.似乎在这种编程语言 (C++) 中,不可能从 & 到剪贴板读取和写入文本。 Nobody knows how to do it.没有人知道该怎么做。 I uninstalled the C++ compiler and created the tiny program in Java script.我卸载了 C++ 编译器并用 Java 脚本创建了这个小程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM