Rotate Screen



Hi,

I'm trying to write a simple little program to rotate in landscape mode the screen of my mio168 PDA.
This option is not available in the display setting of my windows 2003 V4.20.0 (Build 14053).
If I try this kind of code it says that rotation is supported on my system but when it comes
to it, it fails saying "The graphics mode is not supported.".
Does anyone know what to do ?
John

// Check if display supports rotation
devMode.dmSize = sizeof(DEVMODE);
devMode.dmFields = DM_DISPLAYQUERYORIENTATION;
ret = ChangeDisplaySettingsEx((const TCHAR *) NULL, &devMode, (HWND) NULL, CDS_TEST, NULL);
if (ret == DISP_CHANGE_BADMODE)
{
MessageBox (NULL, TEXT("Not supported."), TEXT("Not Cool"), MB_OK);
}
else if (ret == DISP_CHANGE_SUCCESSFUL)
{
MessageBox (NULL, TEXT("Rotation supported"), TEXT("Cool"), MB_OK);
// Current angle of rotation ?
devMode.dmFields = DM_DISPLAYQUERYORIENTATION;
ret = ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_TEST, NULL);
switch (ret)
{
case DISP_CHANGE_SUCCESSFUL :
MessageBox (NULL, TEXT("The settings change was successful."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_BADFLAGS :
MessageBox (NULL, TEXT("An invalid set of values was used in the dwFlags parameter."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_BADMODE :
MessageBox (NULL, TEXT("The graphics mode is not supported."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_BADPARAM :
MessageBox (NULL, TEXT("An invalid parameter was used. This error can include an invalid value or combination of values."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_FAILED :
MessageBox (NULL, TEXT("The display driver failed the specified graphics mode."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_NOTUPDATED :
MessageBox (NULL, TEXT("ChangeDisplaySettingsEx was unable to write settings to the registry."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_RESTART :
MessageBox (NULL, TEXT("The user must restart the computer for the graphics mode to work."), TEXT("Rotation"), MB_OK);
break;
default :
break;
}
switch (devMode.dmDisplayOrientation)
{
case DMDO_0 :
MessageBox (NULL, TEXT("Screen not rotated."), TEXT("Rotation"), MB_OK);
devMode.dmDisplayOrientation = DMDO_90;
break;
case DMDO_90 :
MessageBox (NULL, TEXT("90°"), TEXT("Rotation"), MB_OK);
devMode.dmDisplayOrientation = DMDO_180;
break;
case DMDO_180 :
MessageBox (NULL, TEXT("180°"), TEXT("Rotation"), MB_OK);
devMode.dmDisplayOrientation = DMDO_270;
break;
case DMDO_270 :
MessageBox (NULL, TEXT("270°"), TEXT("Rotation"), MB_OK);
devMode.dmDisplayOrientation = DMDO_0;
break;
default :
break;
}

// Rotate screen
devMode.dmOrientation = DMORIENT_PORTRAIT; //DMORIENT_LANDSCAPE
devMode.dmFields = DM_DISPLAYORIENTATION;
devMode.dmDisplayOrientation = DMDO_180;
ret = ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_RESET, NULL);
switch (ret)
{
case DISP_CHANGE_SUCCESSFUL :
MessageBox (NULL, TEXT("The settings change was successful."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_BADFLAGS :
MessageBox (NULL, TEXT("An invalid set of values was used in the dwFlags parameter."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_BADMODE :
MessageBox (NULL, TEXT("The graphics mode is not supported."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_BADPARAM :
MessageBox (NULL, TEXT("An invalid parameter was used. This error can include an invalid value or combination of values."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_FAILED :
MessageBox (NULL, TEXT("The display driver failed the specified graphics mode."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_NOTUPDATED :
MessageBox (NULL, TEXT("ChangeDisplaySettingsEx was unable to write settings to the registry."), TEXT("Rotation"), MB_OK);
break;
case DISP_CHANGE_RESTART :
MessageBox (NULL, TEXT("The user must restart the computer for the graphics mode to work."), TEXT("Rotation"), MB_OK);
break;
default :
break;
}



--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

.



Relevant Pages

  • Re: Newbie looking for info on basic graphics with Delphi.
    ... The wireframe itself is of course three-dimensional; for rendering ... \y/ over an angle phi is done by ... Even knowing *why* it can't really do anything else than rotate ... since rotation is about the model's origin, ...
    (comp.lang.pascal.delphi.misc)
  • Re: translation and rotation in Euclidean space
    ... In the second place a single rotation only requires a 2x2 matrix. ... do and wish to rotate and translate a scene it is helpful if you process ... a 2d rank tensor, say Lij, a vector is a 1st rank tensor say Xi and ...
    (sci.physics.relativity)
  • Re: newbie: rotating meshes
    ... The problems I noticed, were if you for example rolled the ship, then tried ... not the rolled x axis, which says to me that the math for matrix ... concatenation doesnt rotate the values of the matrix correctly is some ... which meant the y roation rotated the models x axis whereas the z rotation ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: translation and rotation in Euclidean space
    ... In the second place a single rotation only requires a 2x2 matrix. ... do and wish to rotate and translate a scene it is helpful if you process ... a 2d rank tensor, say Lij, a vector is a 1st rank tensor say Xi and ...
    (sci.physics.relativity)
  • Re: Object rotation
    ... > need to translate back to the origin first, then rotate, then translate to ... For example rotations are ALWAYS around an axis so if you ... then moves on the new x axis after the Z rotation. ...
    (microsoft.public.win32.programmer.directx.managed)