Yasemin YILMAZ

Using ExtEscape to get DRVESC_GETSCREENROTATION on i.MX23 EVK WinCE 6.0 platform

Discussion created by Yasemin YILMAZ on Mar 12, 2011

Hi all,

I want to get current display orientation information by using DRVESC_GETSCREENROTATION so I have tried the following code but it returns error -1 and GetLastError gives 12 (ERROR_INVALID_ACCESS). The messages QUERYESCSUPPORT and DISPLAY_GET_OUTPUT_MODE are succeeded.  Where can the problem arise from?

#define DRVESC_GETSCREENROTATION 6302
#define QUERYESCSUPPORT    8
#define CUSTOMESCAPECODEBASE    100100
#define DISPLAY_GET_OUTPUT_MODE (CUSTOMESCAPECODEBASE + 7)


  DISPLAY_DEVICE devDisplay;
  devDisplay.cb = sizeof(devDisplay);
  while (EnumDisplayDevices (NULL, nDisplayDevices, &devDisplay, 0))
  {
    RETAILMSG(1, (L"YYINFO:DeviceID:%d:DeviceKey:%s:DeviceName:%s:DeviceString:%s..\n\r", devDisplay.DeviceID, devDisplay.DeviceKey, devDisplay.DeviceName, devDisplay.DeviceString));
    nDisplayDevices++;
  }
  RETAILMSG(1, (L"YYINFO:EnumDisplayDevices: ERROR: %d..\n\r", GetLastError()));

  HDC nDC = CreateDC (L"ddraw_mx23.dll", NULL, NULL, NULL);
  if (nDC == NULL)
  {
    RETAILMSG(1, (L"YYINFO:CreateDC: NULL ERROR..\n\r"));
  }
  else
  {
    if ((retVal = ExtEscape(nDC, DRVESC_GETSCREENROTATION, 0, NULL, sizeof(DWORD), (LPSTR)&outVal)) > 0)
    //DWORD inVal = DRVESC_GETSCREENROTATION;
    //if ((retVal = ExtEscape(nDC, QUERYESCSUPPORT, sizeof(DWORD), (LPSTR)&inVal, 0, NULL)) > 0)
    //if ((retVal = ExtEscape(nDC, DISPLAY_GET_OUTPUT_MODE, 0, NULL, sizeof(DWORD), (LPSTR)&outVal)) > 0)
      RETAILMSG(1, (L"YYINFO:ExtEscape:DISPLAY_GET_OUTPUT_MODE: retval=%d outval=%d\n\r..", retVal, outVal));
    else
      RETAILMSG(1, (L"YYINFO:ExtEscape: retval=%d, ERROR=%d\n\r..", retVal, GetLastError()));
  }

Thanks a lot for your helps and clarifications,

Yasemin

Outcomes