使用什么函数来选择文本?
我在互联网上搜索了很多,但没有找到一些好的 Windows 7 复制粘贴管理器。我想做一些可以轻松复制多个文本的东西。所以我的问题是在 C++ 中使用什么函数来选择一些将要复制的文本。计划是,每次按下 CTRL+C 时,所选文本都会复制到某个 txt 文件,而当按下 CTRL+V 时,应用程序会显示该文件中的内容,您可以使用所需的文本。主要问题是如何选择文本,使用什么函数?平台赢7.
I search a lot of on internet but didn't find some good copy-paste manager for windows 7. I want to make something to easy copying multiple texts. So my question is what function to use in c++ to select some text that will be copy. The plan is that every time when is pressed CTRL+C selected text copy to some txt file, and when is pressed CTRL+V application show you what is in that file, and you can use what text you need. The main question is how to select text, what function to use? Platform win 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该稍微了解一下 Windows 剪贴板的工作原理。系统中的每个应用程序都可以将不同格式的对象(包括文本)放置在剪贴板上。从任何应用程序中获取内容的最简单方法可能是以某种方式监视剪贴板并从那里获取数据。
对于粘贴部分,如果我没记错的话,剪贴板上有一种特殊的“所有者处理”数据。使用它,数据实际上并不发布在剪贴板上,只是对当前具有剪贴板数据的应用程序的引用。每当粘贴数据时,应用程序都会收到通知,告知其应将数据发送给收件人。应该可以利用该功能让您的应用程序弹出一个窗口,用户可以在其中选择要粘贴的数据。
You should read up a bit on how the Windows clip board works. Every application in the system can place objects of different formats (including text) on the clip board. The easiest way to grab the content out of any applications is probably to somehow monitor the clip board and get the data from there.
For the pasting part, if I remember correctly, there is a special kind of "owner-handled" data on the clip board. Using that, the data isn't actually published on the clip board, only a reference to the application currently having the clip board data. Whenever the data is pasted the application gets notified that it should send the data to the recipient. It should be possible to exploit that functionality to get your application to pop up a windows where the user can select what data to paste.
请参阅我关于剪贴板查看器实现的文章,包括常见陷阱:
http://www.clipboardextender.com/developing-clipboard-aware -programs-for-windows/6
http://www.clipboardextender.com/developing -clipboard-aware-programs-for-windows/common-general-clipboard-mistakes
Please see my articles on clipboard viewer implementation, including common pitfalls:
http://www.clipboardextender.com/developing-clipboard-aware-programs-for-windows/6
http://www.clipboardextender.com/developing-clipboard-aware-programs-for-windows/common-general-clipboard-mistakes