0
왜 작동하지 않는지 알 수 없습니까?SetForegroundWindow가 내 창을 활성화하지 않습니다.
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이 존재한다는 것을 확신합니다.
'Acrobat.exe'을'Acrobat'으로 변경하십시오. –
작동하지 않는다고해서 무엇을 의미합니까? 예외? 콘솔에 "잘못된 것"이 있습니까? 제발 좀 더 자세히 설명해주세요. – jordanhill123
@ByteBlast, jordanhill123 고맙습니다. "잘못된 것"이었습니다. 이제 사라졌지 만, 내 창이 여전히 표시되지 않습니다. 어쩌면 틀렸을 수도 있습니다. 그러나이 방법은 선택한 프로세스의 'Windows를 다른 모든 Windows의 상단, 맞죠? – Ydhem