22 lines
446 B
C#
22 lines
446 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace AxCopilot.Services;
|
|
|
|
internal static class WindowTracker
|
|
{
|
|
public static nint PreviousWindow { get; private set; } = IntPtr.Zero;
|
|
|
|
[DllImport("user32.dll")]
|
|
private static extern nint GetForegroundWindow();
|
|
|
|
public static void Capture()
|
|
{
|
|
nint foregroundWindow = GetForegroundWindow();
|
|
if (foregroundWindow != IntPtr.Zero)
|
|
{
|
|
PreviousWindow = foregroundWindow;
|
|
}
|
|
}
|
|
}
|