0

experts! I'm a WinXP user in a Virtual Machine. I have installed MinGW and an IDE for develop C/C++ applications. Today I encountered a code snippet, at MSDN as you can see,

DEVMODE dm;
   // initialize the DEVMODE structure
   ZeroMemory(&dm, sizeof(dm));
   dm.dmSize = sizeof(dm);

   if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm))
   {
      // swap height and width
      DWORD dwTemp = dm.dmPelsHeight;
      dm.dmPelsHeight= dm.dmPelsWidth;
      dm.dmPelsWidth = dwTemp;

      // determine new orientaion
      switch (dm.dmDisplayOrientation)
      {
      case DMDO_DEFAULT:
         dm.dmDisplayOrientation = DMDO_270;
         break;
      case DMDO_270:
         dm.dmDisplayOrientation = DMDO_180;
         break;
      case DMDO_180:
         dm.dmDisplayOrientation = DMDO_90;
         break;
      case DMDO_90:
         dm.dmDisplayOrientation = DMDO_DEFAULT;
         break;
      default:
         // unknown orientation value
         // add exception handling here
         break;
      }
      long lRet = ChangeDisplaySettings(&dm, 0);
      if (DISP_CHANGE_SUCCESSFUL != lRet)
      {
         // add exception handling here
      }
   }

When I compile that snippet in my sample, I got this error message,

error: 'DMDO_DEFAULT' undeclared

error: 'DMDO_270' undeclared

..

error: 'DMDO_90' undeclared

I know that these constants included in "wingdi.h" file, in my case this file contains this code, i think that it is correct.

#if(WINVER >= 0x0501)
..
#define DMDO_DEFAULT 0x00000000
#define DMDO_90 0x00000001
#define DMDO_180 0x00000002
#define DMDO_270 0x00000003

So where is the problem, can anyone explain to me? "ver" command gave me that output,

$ ver
Microsoft Windows XP [Version 5.1.2600]

Sorry for my English grammar, thank you for help me.

Community
  • 1
  • 1

0 Answers0