title: C++ Changing Screen Orientation Issue -- DEVMODE dmDisplayOrientation DMDO_90 undefined
body: <p>I can't seem to get some C++ code to compile.  I am flip the orientation of the display, but VS2008 is telling me the DMDO_90 and DMDO_270 are unidentified:</p>
  
  <pre><code>error C2065: 'DMDO_90' : undeclared identifier
  error C2065: 'DMDO_270' : undeclared identifier
  </code></pre>
  
  <p>Am I missing something-- an include or something? 
  According to the MSDN <a href="http://msdn.microsoft.com/en-us/library/dd183565%28v=vs.85%29.aspx" rel="nofollow">DEVMODE</a> structure DMDO should be defined (under the dmDisplayOrientation section)--<br>
  Here is the code I have:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;windows.h&gt;
  using namespace std;
  
  DISPLAY_DEVICE GetPrimaryDevice()
  {
      int index=0;
      DISPLAY_DEVICE dd;
      dd.cb = sizeof(DISPLAY_DEVICE);
  
      while (EnumDisplayDevices(NULL, index++, &amp;dd, 0))
      {
          if (dd.StateFlags &amp; DISPLAY_DEVICE_PRIMARY_DEVICE) return dd;
      }
      return dd;
  }
  
  BOOL SetDisplayResolution(long degrees)
  {
      DISPLAY_DEVICE dd = GetPrimaryDevice();
      DEVMODE dm;
      ZeroMemory(&amp;dm, sizeof(dm));
      dm.dmSize = sizeof(DEVMODE);
      if (!EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &amp;dm))
      {
          printf("EnumDisplaySettings failed:%d\n", GetLastError());
          return FALSE;
      }
      switch(degrees)
      {
      case 90:
          dm.dmDisplayOrientation = DMDO_90; //error C2065: 'DMDO_90' : undeclared identifier
          break;
      case 270:
          dm.dmDisplayOrientation = DMDO_270; //error C2065: 'DMDO_90' : undeclared identifier
          break;
      default:
          break;
  
      }
      DWORD dwTemp = dm.dmPelsHeight;
      dm.dmPelsHeight = dm.dmPelsWidth;
      dm.dmPelsWidth = dwTemp;
  
      dm.dmFields = (DM_PELSWIDTH | DM_PELSHEIGHT);
      if (ChangeDisplaySettings(&amp;dm, CDS_TEST) !=DISP_CHANGE_SUCCESSFUL)
      {
          printf("\nIllegal graphics mode: %d\n", GetLastError());
          return FALSE;
      }
  
      return (ChangeDisplaySettings(&amp;dm, 0)==DISP_CHANGE_SUCCESSFUL);
  }
  
  int main()
  {
      if (SetDisplayResolution(90))
      { 
          return true;
      }
      else
      {
          return false;
      }
  
  }
  </code></pre>