Rotate Screen
- From: "john" <dsa2468@xxxxxxxxx>
- Date: Sun, 18 Jun 2006 22:29:11 +0200
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/ =-
.
- Follow-Ups:
- Re: Rotate Screen
- From: pons
- Re: Rotate Screen
- Prev by Date: Re: Best development tool for WM5?
- Next by Date: Beep()
- Previous by thread: Best development tool for WM5?
- Next by thread: Re: Rotate Screen
- Index(es):
Relevant Pages
|