如何在另一个程序中选择所有? [英] How to select all in another program?
本文介绍了如何在另一个程序中选择所有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过使用SendKeys选择其他程序中的所有文本。
我为记事本文件做了这个:
I want to Select all a text in another program, by using "SendKeys".
I did it for a Notepad file:
IntPtr appHandle = FindWindow(null, "Untitled - Notepad");
if (appHandle == IntPtr.Zero)
{
MessageBox.Show("Specified app is not running.");
return;
}
SetForegroundWindow(appHandle);
System.Threading.Thread.Sleep(500);
SendKeys.SendWait("^a");
但是在我想要选择所有文本的程序中,ctrl + a被认为是其他命令。
我该怎么办?
but in the program that I want to select all its text, ctrl+a is considered for other command.
What should I do?
推荐答案
这取决于其他程序以及它如何响应键盘输入 - 没有系统范围选择所有功能,许多程序不要;甚至有一个 - 或需要一个 - 所以你可以;只是假设你可以做到这一点。
如你所做的那样发送CTRL + A可能会起作用 - 或者它可能什么也不做,或者根据谁编码它完全不同。
在Windows应用程序中没有通用的全选方法,保证适用于所有应用程序。
It will depend on the "other program" and how it responds to keyboard input - there is no "system wide" Select All function, many programs don;t even have one - or need one - so you can;t just assume that you can do this.
Sending CTRL+A as you have done may work - or it may do nothing, or something totally different depending on who coded it.
There is no generic way to "Select All" in a windows application that is guaranteed to work for all applications.
这篇关于如何在另一个程序中选择所有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文