Open paoloambrosio opened 2 years ago
Tried this but it didn't work reliably.
Dependency:
<ItemGroup>
<PackageReference Include="PInvoke.User32" Version="0.7.124" />
</ItemGroup>
Code:
using System.Diagnostics;
using PInvoke;
// ...
if (Process.GetProcessesByName("AC2-Win64-Shipping").Take(1)
.Where(process => User32.GetForegroundWindow() != process.MainWindowHandle)
.Any(process => !User32.SetForegroundWindow(process.MainWindowHandle)))
{
Console.WriteLine("FAILED TO SET FOREGROUND WINDOW");
}
Relates to #50.
Focus game window before applying pit strategy.