不支持缩放/固定输出分辨率
No Scaling/Fixed Output Resolution support?
我正在编写一个Win32 C++程序来更改各种机器的屏幕分辨率和缩放模式。我运行的是Windows 7,但目标是Windows XP。该程序适用于我的Windows 7笔记本电脑,枚举兼容的显示模式:
if (listModes)
{
DEVMODE dmPossibleMode = { 0 };
ZeroMemory(&dmPossibleMode, sizeof(dmPossibleMode));
dmPossibleMode.dmSize = sizeof(dmPossibleMode);
cout << "Key: BD = Bit density/Bits per pixel, SM = Scale mode" << endl;
cout << "+-----+-----------+-------+----+----+" << endl;
cout << "| ID | Dims | Freq. | BD | SM |" << endl;
cout << "+-----+-----------+-------+----+----+" << endl;
for(int iModeNum = 0; EnumDisplaySettings(dd.DeviceName, iModeNum, &dmPossibleMode) != 0; iModeNum++)
{
ostringstream resString; resString << dmPossibleMode.dmPelsWidth << "x" << dmPossibleMode.dmPelsHeight;
ostringstream freqString; freqString << dmPossibleMode.dmDisplayFrequency << "Hz";
ostringstream bbpString; bbpString << dmPossibleMode.dmBitsPerPel;
ostringstream scaleString; scaleString << dmPossibleMode.dmDisplayFixedOutput;
cout << "|" << setw(4) << iModeNum << " ";
cout << "|" << setw(10) << resString.str() << " ";
cout << "|" << setw(6) << freqString.str() << " ";
cout << "|" << setw(3) << bbpString.str() << " ";
cout << "|" << setw(3) << scaleString.str() << " |" << endl;
}
cout << "+-----+-----------+-------+----+----+" << endl;
}
给我:
+-----+-----------+-------+----+----+
| ID | Dims | Freq. | BD | SM |
+-----+-----------+-------+----+----+
| 0 | 640x480 | 59Hz | 8 | 0 |
| 1 | 640x480 | 60Hz | 8 | 0 |
| 2 | 640x480 | 60Hz | 8 | 2 |
| 3 | 640x480 | 60Hz | 8 | 1 |
| 4 | 640x480 | 73Hz | 8 | 0 |
| 5 | 640x480 | 75Hz | 8 | 0 |
| 6 | 640x480 | 75Hz | 8 | 2 |
| 7 | 640x480 | 75Hz | 8 | 1 |
| 8 | 640x480 | 59Hz | 16 | 0 |
| 9 | 640x480 | 60Hz | 16 | 0 |
| 10 | 640x480 | 60Hz | 16 | 2 |
[ etc. ]
但在Windows XP桌面上,输出如下:
+-----+-----------+-------+----+----+
| ID | Dims | Freq. | BD | SM |
+-----+-----------+-------+----+----+
| 0 | 640x480 | 59Hz | 8 | 0 |
| 1 | 640x480 | 60Hz | 8 | 0 |
| 2 | 640x480 | 60Hz | 8 | 0 |
| 3 | 640x480 | 60Hz | 8 | 0 |
| 4 | 640x480 | 73Hz | 8 | 0 |
| 5 | 640x480 | 75Hz | 8 | 0 |
| 6 | 640x480 | 75Hz | 8 | 0 |
| 7 | 640x480 | 75Hz | 8 | 0 |
| 8 | 640x480 | 59Hz | 16 | 0 |
| 9 | 640x480 | 60Hz | 16 | 0 |
| 10 | 640x480 | 60Hz | 16 | 0 |
[ etc. ]
即缩放模式都说"0"。谁能提供一些关于为什么会这样的想法?非常感谢!
您忘了对照DM_DISPLAYFIXEDOUTPUT
检查dmPossibleMode.dmFields
。如果未设置该位,则您在 dmPossibleMode.dmDisplayFixedOutput
处使用的值尚未初始化,因此检查它是毫无价值的。
如果未设置DM_DISPLAYFIXEDOUTPUT则此成员必须为零。
与 http://msdn.microsoft.com/en-us/library/windows/desktop/dd183565%28v=vs.85%29.aspx 相比
如果我没记错的话,这些"拉伸"值仅在笔记本电脑屏幕上有意义,但这可能是错误的,不要基于它。
相关文章:
- 递归函数计算序列中的平方和(并输出过程)
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 请解释"函数1(p1,p2,p3);"的输出
- C++:将控制台输出存储在宏中更好吗
- 创建一个函数以在输入为负数或零时输出字符串.第一次执行用户定义的函数
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 为什么我的代码在输出中增加了93天
- 如何从void函数输出字符串
- 输入到文件并输出到另一个文件,并将流文件传递给函数
- AES加密到解密未正确输出
- 如何将c++程序的一些输出传递给shell,以便在shell中使用
- 使用C++程序合并排序没有得到正确的输出
- 为什么我不能在不创建字符串变量的情况下使用函数的字符串输出
- C++格式化输出问题
- 将值从二维数组输出到文本文件
- 集合上的输出迭代器:assign和increment迭代器
- 自定义输出分辨率重复输出DXGI
- 访问Ximea相机并使用OpenCV设置预定义的分辨率时,由于相机默认分辨率的大小为Mat,因此显示混乱的输出
- OpenCV超分辨率输出阵列帧
- 不支持缩放/固定输出分辨率