Birazcık üşüdüm. Önce UE açtım, yetmedi; FurMark ısıtacak inşallah odayı.
// Mesaj sınırını aştığım için gerekli API'leri AI'den alabilirsiniz.
public static void Main(string[] __)
{
_ = BringAFADToFront();
while (Console.ReadKey().Key is ConsoleKey.C)
bringToFront = false;
Console.ReadLine();
}
static async Task BringAFADToFront()
{
var hWnd = FindAFADhWnd();
while (bringToFront)
if (hWnd is not 0)
{
_ = BringToFrontAsync(hWnd);
Console.WriteLine("AFAD penceresi öne getirildi.");
await Task.Delay(321);
}
else
return;
}
static nint FindAFADhWnd()
{
nint foundHwnd = 0;
foreach (var process in Process.GetProcessesByName("chrome"))
EnumWindows((hWnd, lParam) =>
{
if (IsWindowVisible(hWnd))
{
StringBuilder windowText = new(GetWindowTextLength(hWnd) + 1);
_ = GetWindowText(hWnd, windowText, windowText.Capacity);
if (windowText.ToString().Contains("AFAD"))
foundHwnd = hWnd;
}
return true;
}, nint.Zero);
return foundHwnd;
}
static bool BringToFrontAsync(nint hWnd, int x = 0, int y = 0, int cx = 0, int cy = 0) => SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
static bool RestoreToBackgroundAsync(nint hWnd, int x = 0, int y = 0, int cx = 0, int cy = 0) => SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
Bu sitenin çalışmasını sağlamak için gerekli çerezleri ve deneyiminizi iyileştirmek için isteğe bağlı çerezleri kullanıyoruz.

İfadeler: Mustafa.Kaan ve Bayram Reis