2

Is there anyway to know if a certain game is running on full screen or running as a window?

I need this because my application is for a game that can toggle between fullscreen and window mode and I need to act differently to each situation.

something like :

if (Fullscreen) {Act For Fullscreen} else {Act For Window Mode}

*The game isn't mine, it's another game. A real game.

user779444
  • 1,365
  • 4
  • 21
  • 38
  • 1
    It might be worth clarifying whether the game is yours or an external application. A few answers assume the former, where i think you mean the latter. – George Duckett Jul 05 '11 at 15:03
  • Please try this. I've tried it on games. http://stackoverflow.com/a/35582683/168345 – sjlewis Feb 23 '16 at 16:22

4 Answers4

2

I assume that game is not written by you. You can use Win32 api http://www.pinvoke.net/default.aspx/user32.GetWindowPlacement

Tomas Voracek
  • 5,886
  • 1
  • 25
  • 41
1

won't this do?

if(WindowState == WindowState.Maximized)
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
  • @user779444: What do you mean? If you are inside a method of your form class then exactly as I wrote (or `this.WindowState`). If not, then you have to have a form object - say it's myForm. Then you write `myForm.WindowState` – Armen Tsirunyan Jul 05 '11 at 15:53
1

It will probably depend on specific graphics technology you will be using rather than on WinForms API.

For example XNA (DirectX):

GraphicsDeviceManager graphics = new GraphicsDeviceManager(...); 

graphics.IsFullScreen = true; 
Den
  • 1,827
  • 3
  • 25
  • 46
0

Have you looked at the WindowState and FormWindowState enumeration?

http://msdn.microsoft.com/en-us/library/system.windows.forms.formwindowstate.aspx

A Full Screen application is a maximized window without borders.

George Johnston
  • 31,652
  • 27
  • 127
  • 172