如何将文本粘贴到其他应用程序的入口点。 [英] How can I paste a text into other application's entry point.
本文介绍了如何将文本粘贴到其他应用程序的入口点。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将文本粘贴到其他应用程序的入口点。
我有一个文本你好!在我的文本框中,如何将此文本粘贴到其他应用程序中,例如word,notepad等。我正在谈论的另一个应用程序是我的程序旁边的应用程序。我在终端中按Alt TAB后会出现的那个。
请帮忙。
TIA
我尝试了什么:
我只是使用sendkeys函数但它没有用。
解决方案
SendKeys只发送到活动应用程序 - 如果你想将它们发送到另一个应用程序,那么你必须先激活它: 使用C#向其他应用程序发送击键 [ ^ ] - VB代码非常相似,或使用PostMessage将其发送到特定窗口:
VB.NET通过Postmessage发送字符串 - 堆栈溢出 [ ^ ]
你可以得到具有GetProcessesByName的窗口句柄:
Dim p As Process()= Process.GetProcessesByName(notepad)
Dim h As IntPtr = p(0).MainWindowHandle
How can I paste a text into other application's entry point.
I have a text "Hi there!" in my text box, how can I paste this text into other application for example word, notepad, etc. The other application I am talking about is the application next to my program. The one that will appear after I press Alt TAB in my terminal.
Please help.
TIA
What I have tried:
I just use the sendkeys function but its not working.
解决方案
SendKeys only sends to the active application - if you want to send them to a different app, then you either have to activate it first: Sending Keystrokes to another Application in C#[^] - the VB code is very similar, or use PostMessage to send it to a particular window:
VB.NET Sending Strings via Postmessage - Stack Overflow[^]
You can get the window handle with GetProcessesByName:
Dim p As Process() = Process.GetProcessesByName("notepad") Dim h As IntPtr = p(0).MainWindowHandle
这篇关于如何将文本粘贴到其他应用程序的入口点。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文