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

David Downing 741 Reputation points

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:

    static extern IntPtr GetDesktopWindow();

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

    [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

    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

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

    No comments

0 additional answers

Sort by: Most helpful