im trying to size a game to a specific resolution value, like 1280,720, when the game is fullscreen. The problem is, that my code works perfectly when the game is already in window mode. If the game is in fullscreen then my code doesnt work.
My Code looks like that:
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
Process[] processes = Process.GetProcesses();
foreach (var process in processes)
{
if(process.mainwindowtitle == "game"){ var handle = process.MainWindowHandle;
var form = Control.FromHandle(handle);
if (form == null) continue;
MoveWindow(handle, 0,0,1280,720, true);
}
}```