Thanks there! I found it the other day too, but in the platform options pulldown, it showed 420
... In any case, I did a work around for the rotation app I
was writing.
Unfortunately, the system's returned value indicates that build 4.1 for SL4 only supports standard 0deg angle and *cannot* be rotated.
// rotate.cpp : Defines the entry point for the application.
//
// #include "stdafx.h"
/**********************************************************************
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright
(c
) 1999 Microsoft Corporation. All Rights Reserved.
MODULE:
rotation.cpp
ABSTRACT:
This application code demonstrates the how you can set up the DEVMODE structure and use the ChangeDisplaySettingsEx function to rotate the screen.
Each time you run the executable for this code, the screen will rotate clockwise by 90 degrees.
**********************************************************************/
#include "C:\Program Files\Windows CE Tools\wce420\STANDARDSDK_420\Include\Armv4\windows.h"
#include "C:\Program Files\Windows CE Tools\wce420\STANDARDSDK_420\Include\Armv4\wingdi.h"
// Snappy!
// Function prototype for ChangeDisplaySettingsEx
typedef LONG (*MYPROC)(
LPCTSTR,
LPDEVMODE,
HWND,
DWORD,
LPVOID);
// Snappy!
// 1. ProcAdd replaces the original api "ChangeDisplaySettingsEx" by loading the dll coredll.dll directly at runtime above.
// 2. The function address pointer is then retrieved with a call to GetProcAddress and assigned to ProcAdd
// 3. All function call to ChangeDisplaySettingsEx is simply replaced by ProcAdd
int
WINAPI
WinMain
(
HINSTANCE,
HINSTANCE,
#ifdef UNDER_CE
LPWSTR,
#else
LPSTR,
#endif
int
)
{
DEVMODE DevMode;
HINSTANCE hCoreDLL = LoadLibrary(L"coredll.dll" // Snappy!
// Snappy!
if (hCoreDLL == NULL)
{
printf("Library load error!"
return (-1);
}
MYPROC ProcAdd = (MYPROC) GetProcAddress(hCoreDLL, L"ChangeDisplaySettingsEx"
if (!ProcAdd)
{
printf("Function not found!"
return (-1);
}
int RotationAngles;
int CurrentAngle;
int NewAngle;
//
// Check for rotation support by getting the rotation angles supported.
//
memset
(&DevMode, 0, sizeof
(DevMode
)
);
DevMode.dmSize = sizeof
(DevMode
);
DevMode.dmFields = DM_DISPLAYQUERYORIENTATION;
if
(DISP_CHANGE_SUCCESSFUL ==
ProcAdd(NULL, &DevMode, NULL, CDS_TEST, NULL
)
)
{
RotationAngles = DevMode.dmDisplayOrientation;
printf
("ChangeDisplaySettingsEx supports these rotation angles %d", RotationAngles
);
}
else
{
printf
("ChangeDisplaySettingsEx failed to get the supported rotation angles."
;
RotationAngles = -1;
}
//
// Get the current rotation angle.
//
memset
(&DevMode, 0, sizeof
(DevMode
)
);
DevMode.dmSize = sizeof
(DevMode
);
DevMode.dmFields = DM_DISPLAYORIENTATION;
if
(DISP_CHANGE_SUCCESSFUL ==
ProcAdd(NULL, &DevMode, NULL, CDS_TEST, NULL
)
)
{
CurrentAngle = DevMode.dmDisplayOrientation;
printf
("ChangeDisplaySettingsEx reports the current rotation as %d", CurrentAngle
);
}
else
{
printf
("ChangeDisplaySettingsEx failed to get the current rotation angle."
;
CurrentAngle = -1;
}
//
// Rotate to the "next" angle.
//
if
(CurrentAngle >= 0 && RotationAngles >= 0
)
{
NewAngle = CurrentAngle;
do
{
NewAngle <<= 1;
if
(NewAngle == DMDO_0
)
{
NewAngle = DMDO_90;
}
if
(NewAngle > DMDO_270
)
{
NewAngle = DMDO_0;
}
} while
(!
(NewAngle & RotationAngles
) &&
(NewAngle != DMDO_0
)
);
memset
(&DevMode, 0, sizeof
(DevMode
)
);
DevMode.dmSize = sizeof
(DevMode
);
DevMode.dmFields = DM_DISPLAYORIENTATION;
DevMode.dmDisplayOrientation = NewAngle;
if
(DISP_CHANGE_SUCCESSFUL ==
ProcAdd(NULL, &DevMode, NULL, CDS_RESET, NULL
)
)
{
printf
("ChangeDisplaySettingsEx changed rotation angle to %d", NewAngle
);
}
else
{
printf
("ChangeDisplaySettingsEx failed to change the rotation angle to %d", NewAngle
);
}
}
// Snappy!
memset(&DevMode, 0, sizeof (DevMode));
DevMode.dmSize = sizeof (DevMode);
DevMode.dmFields = DM_DISPLAYORIENTATION;
DevMode.dmDisplayOrientation = DMDO_270;
ProcAdd(NULL, &DevMode, NULL, 0, NULL);
return 0;
}