wince系统的GDI提供了支持液晶翻转的接口,需要在驱动层实现。在应用层只需修改注册表[HKEY_LOCAL_MACHINE\System\GDI\ROTATION]即可。
代码段如下:
-
HKEY hRegKey;
-
DWORD status;
-
DWORD ValType;
-
DWORD ValLen;
-
-
DWORD Rotation = 0;
-
DEVMODE devmode = {0};
-
devmode.dmSize = sizeof(DEVMODE);
-
devmode.dmFields = DM_DISPLAYORIENTATION;
-
ChangeDisplaySettingsEx(NULL, &devmode, 0, CDS_TEST, NULL);
-
-
switch(devmode.dmDisplayOrientation)
-
{
-
case DMDO_0:
-
devmode.dmDisplayOrientation = DMDO_90; //????
-
Rotation = 90;
-
break;
-
case DMDO_90:
-
devmode.dmDisplayOrientation = DMDO_180;
-
Rotation = 180;
-
break;
-
case DMDO_180:
-
devmode.dmDisplayOrientation = DMDO_270;
-
Rotation = 270;
-
break;
-
case DMDO_270:
-
devmode.dmDisplayOrientation = DMDO_0;
-
Rotation = 0;
-
break;
-
default :
-
devmode.dmDisplayOrientation = DMDO_0;
-
Rotation = 0;
-
}
-
-
devmode.dmFields = DM_DISPLAYORIENTATION;
-
ChangeDisplaySettingsEx(NULL, &devmode, NULL, 0, NULL);
-
-
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-
TEXT("System\\GDI\\Rotation"),
-
0, 0, &hRegKey);
-
-
if (ERROR_SUCCESS == status)
-
{
-
ValLen = sizeof(DWORD);
-
if (ERROR_SUCCESS == RegSetValueEx (hRegKey, TEXT("Angle"), NULL, REG_DWORD, (PBYTE)&Rotation, ValLen))
-
RegCloseKey(hRegKey);
-
}
-
RegFlushKey(HKEY_LOCAL_MACHINE);
关于驱动中如何去支持,得因处理器而异了,AM3517上使能液晶翻转需要操作vrfb模块,具体操作可参见:http://blog.csdn.net/savage_sdj/article/details/8975927
阅读(792) | 评论(0) | 转发(0) |