I recently remembered I posted this and never gave an update.
So for anyone who needs to do this I got the SetWindowPos function I mentioned before to work using C#
Here’s an example that moves the window back on start:
using Godot;
using System;
using System.Runtime.InteropServices;
public partial class ctest : Node
{
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
const short SWP_NOZORDER = 0X4;
const short SWP_NOMOVE = 0X2;
const short SWP_NOSIZE = 1;
const int SWP_SHOWWINDOW = 0x0040;
//Get the windows handle of the game window
var handle = new IntPtr(DisplayServer.WindowGetNativeHandle(DisplayServer.HandleType.WindowHandle));
//Move window to back
SetWindowPos(handle, 1, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
}