我不知道它为什么不起作用?
static void ActivateApp(string processName)
{
Process[] p = Process.GetProcessesByName(processName);
// Activate the first application we find with this name
if (p.Any()) SetForegroundWindow(p[0].MainWindowHandle);
else
{
Console.WriteLine("Something wrong");
}
}
[STAThread]
static void Main(string[] args)
{
ActivateApp("Acrobat.exe");
}产出:
出了点问题
但我确信Acrobat.exe是存在的。
发布于 2013-04-18 09:42:19
对于SetForegroundWindow()是否真正起作用,有一些奇怪的规则。
下列至少一项必须是正确的:
是这种情况吗?
有关详细信息,请参阅MSDN文档。
https://stackoverflow.com/questions/16079440
复制相似问题