title: Fullscreen management with WinAPI
body: <p>How to well use the WinAPI to manage the fullscreen mode on windows's window ?</p>
  
  <p>Here is my problem :</p>
  
  <p>I have an application which has to be fullscreen.
  I use ChangeDisplaySettings() function (winuser.h) with the CDS_FULLSCREEN value to put my window to fullscreen mode when receiving a <code>WM_ACTIVATE</code> with <code>(wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE)</code> :</p>
  
  <pre><code>DEVMODE dmScreenSettings;
  memset (&amp;dmScreenSettings, 0, sizeof (dmScreenSettings));
  dmScreenSettings.dmSize = sizeof (dmScreenSettings);   
  dmScreenSettings.dmPelsWidth = 1280;
  dmScreenSettings.dmPelsHeight = 720;    
  dmScreenSettings.dmBitsPerPel = 32;      
  dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
  ChangeDisplaySettings(&amp;dmScreenSettings, CDS_FULLSCREEN);
  </code></pre>
  
  <p>I use the same function with the CDS_RESET value to put it back in "normal" mode when receiving a <code>WM_ACTIVATE</code> with <code>(wParam == WA_INACTIVE)</code> :</p>
  
  <pre><code>ChangeDisplaySettings(&amp;dmScreenSettings, CDS_RESET);
  </code></pre>
  
  <p>When I first launch my application, it is in fullscreen.
  I use ALT+TAB to switch to another application on my computer. My application minimized itself. It works well.
  Then, I switch back to my application, and it comes up in fullscreen mode. Again, it works well.
  But if I want to switch back to another application one more time, my application statys in fullscreen mode, hiding all others applications on my computer.</p>
  
  <p>NB : My window is created using CreateWindowEx() function with the following parameters :</p>
  
  <pre><code>DWORD dwExStyle = WS_EX_TOPMOST;
  DWORD dwStyle = WS_VISIBLE | WS_POPUP;
  </code></pre>
  
  <p>1) Is there another way than using ChangeDisplaySettings() to change the fullscreen mode ?</p>
  
  <p>2) Am I using it the good values ?</p>
  
  <p>3) Is there anything to do that I forgot ?</p>
  
  <p>Thanks in advance for all your answers.
  Best regards,</p>