关于横屏后LButtonDown事件接收不到的感悟

今日在手机上测试时,发现屏幕480-720之间的点击效果无效,经过跟踪发现原因出在横屏代码上

原始横屏代码:

bool rotateScreen(DWORD dwRotaion)
{
 DEVMODE settings;
 memset(&settings, 0, sizeof(DEVMODE));
 settings.dmSize = sizeof(DEVMODE);

 settings.dmFields = DM_DISPLAYORIENTATION;
 ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL);
 DWORD rotation = settings.dmDisplayOrientation;
 if (dwRotaion == rotation)
  return false;

 settings.dmDisplayOrientation = dwRotaion;

 

////////
 return (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettingsEx(NULL, &settings, NULL, 0, NULL));
}

 

这样看起来是横屏了,但是坐标区域还没有变换过来,

因此要在上面横线处假死SetWindowsPos(0,0,720,480)这样才可以正常获得屏幕触摸效果。

你可能感兴趣的:(关于横屏后LButtonDown事件接收不到的感悟)