I need to start process steam.exe. Wait open it and child window with auth code. Paste code and press Enter using winapi. Now my code look like
public static void StartSteamProcess(AccountData account, Argument argument)
{
var startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = false;
startInfo.Arguments = $"-login {account.AccountDetail.SteamLogin} {account.AccountDetail.SteamPassword} {argument.Value}";
startInfo.FileName = Program.SteamPath;
var process = new Process();
process.StartInfo = startInfo;
process.EnableRaisingEvents = true;
process.Start();
process.Exited += delegate
{
ProcessExited(process.Id);
};
process.Disposed += delegate
{
ProcessDisposed(process.Id);
};
Thread.Sleep(5000);
SetForegroundWindow(process.MainWindowHandle);
Clipboard.SetText("1111");
SendKeys.Send("^V");
}
But due to lack of knowledge, i have to block the thread for 5 seconds (To wait for the window to open) bring this window to the foreground and only then manipulate it :( Can I use winapi to wait for a window to open by its name? And using winapi insert the code Without bringing it to the foreground?