自动获取剪贴板文本到应用程序 [英] Get Clipboard Text Automatically To An Application

查看:79
本文介绍了自动获取剪贴板文本到应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨开发者

我在C#3.5中开发了一个应用程序,我希望将剪贴板数据放入其中的一个文本框中。



用户在其Web浏览器中复制URL后,此应用程序必须能够从剪贴板将该复制的URL带入该文本框,而无需用户参与粘贴。< br $> b $ b

请给我一个想法或代码来实现这个目标。



谢谢

EdgeCat

Hi Developers
I have developed an application in C# 3.5 which I want to get clipboard data into one of its'' text box.

Once a user copy URL in his web browser, this application must be able to take that copied URL in to that textbox from the clipboard without user involvement to paste.

please give me an idea or code to achieve this.

thanks
EdgeCat

推荐答案

1)您必须监控剪贴板活动 [ ^ ]。正如我所见,你将不得不使用P / Invoke,因为框架中没有工具。

在每次检测到的变化时你都必须遵循:

2)检查剪贴板内容的文本格式

3)获取活动窗口并检查它是否是浏览器 - 你可以省略这个约束

3)验证来自剪贴板的文本用于url语法

4)将值赋给文本框
1) You will have to monitor clipboard activity[^]. As I see, you will have to use P/Invoke, since there are no tool for that in the framework.
On every detected change you have to do following:
2) check the content of the clipboard for text format
3) get the active window and check if it is a browser - you could omit this constraint
3) validate the text from the clipboard for url syntax
4) give the value to the textbox


这篇关于自动获取剪贴板文本到应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆