简体   繁体   English

获取在Ctrl + C操作后复制到变量的数据

[英]Get the data copied after Ctrl+ C operation to a variable

I have some data in notepad and have performed Sendkeys("Ctrl+C") using keyboard library.I want to get the copied data to a variable in C# code. 我在记事本中有一些数据,并已使用键盘库执行了Sendkeys(“ Ctrl + C”)。我想将复制的数据保存到C#代码中的变量中。

How to get the data to variable programmatically. 如何以编程方式获取数据变量。

I tried clipboard.GetText() API and it is giving empty string. 我尝试了剪贴板.GetText()API,它给出了空字符串。

Your could get any data using Clipboard.GetDataObject(). 您可以使用Clipboard.GetDataObject()获取任何数据。

See the example at msdn 请参阅msdn上的示例

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

相关问题 用于 CTRL+C 和 CTRL+V 手势的键绑定不起作用? - KeyBinding for gestures CTRL+C and CTRL+ V do not work? 如何在Win表单应用程序中检测两个热键,例如CTRL + C,CTRL + W - how to detect two hot key in win form app like CTRL +C , CTRL+ W 当我们使用ctrl +鼠标左键单击wpf时如何取消选择devexpress数据网格行 - how to unselect a devexpress data grid row when we click with ctrl+ mouse left button wpf 从CTRL +“东西”到带有代码示例的字符串 - From CTRL+“something” to a string with a code sample 在UserControl中按CTRL + N键,将焦点对准AutoCompleteBox - Focus into AutoCompleteBox on CTRL+ N key pressed in UserControl 如何从任何地方捕获Ctrl +鼠标滚轮? - How to catch a Ctrl+ mousewheel from any place of code? 在 selenium 按钮单击 C# 中的变量后,如何分配复制到剪贴板的字符串? - How can I assign string copied to clipboard after selenium button click to a variable in C#? 为什么按Ctrl +“+”会在TextBox中产生哔声? - Why does pressing Ctrl+“+” produce a beep in a TextBox? C#Richtextbox-通过滚动并按住ctrl来获取更改后的文本大小 - C# Richtextbox - Get text size after changing it by scrolling and holding ctrl SendInput Ctrl + C然后通过Clipboard.GetText检索复制的内容不起作用 - SendInput Ctrl + C and then retrieve copied content through Clipboard.GetText doesn't work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM