Determine if a VM is running full screen from a process running on the VM

David Downing 741 Reputation points
2021-04-14T20:12:44.563+00:00

I have a service that is running on a VM running Windows and I need to determine if the VM window is running full screen. Is this possible?

I have already tried investigating the following without success:

    [DllImport("user32.dll")]
    static extern IntPtr GetDesktopWindow();

    [DllImport("user32.dll", SetLastError = true)]
    static extern int GetWindowLong(IntPtr hWnd, int nIndex);

    [DllImport("user32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool GetWindowRect(HandleRef hWnd, out RECT lpRect);

    var expStyle = GetWindowLong((IntPtr)5160, (int)GWL.GWL_STYLE);
    var result = GetWindowRect(new HandleRef(GetConsoleWindow(), GetDesktopWindow()), out rect);
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
3,040 questions
{count} votes

Accepted answer
  1. Karlie Weng 8,216 Reputation points Microsoft Employee
    2021-04-23T02:44:52.92+00:00

    Hello David,

    I guess modify rdp file cannot realize this feature. This may still need the help with some code.

    You could try post this in Stack Overflow which is an open community for anyone with codes.

    Best regards
    Karlie

    ----Please "Accept as answer" if the reply is helpful-----

    No comments

0 additional answers

Sort by: Most helpful