英文:
How can I get the default/recommend monitor device mode in C# or C++?
问题
我可以使用EnumDisplaySettingsA
来获取所有监视器模式(DEVMODEA
),例如在此C#代码片段中:
public static extern int EnumDisplaySettingsA(string lpszDeviceName, int iModeNum, ref DEVMODEA lpDevMode);
但如何获取默认和/或推荐的模式,就像设置中的一样?
我还想知道,如果监视器当前处于禁用状态,并且我没有关于要启用哪种模式的信息,是否有默认模式可以获取。因此,确保一种分辨率绝对可用。
PS:我知道这个超过10年的问题没有回答,但情况可能已经发生变化:https://stackoverflow.com/q/8390344/356726
英文:
I can get all monitor modes (DEVMODEA
) by EnumDisplaySettingsA
, e.g. as in this C# snippet:
public static extern int EnumDisplaySettingsA(string lpszDeviceName, int iModeNum, ref DEVMODEA lpDevMode);
But how can I get the default and/or recommended mode as in the settings?
I also wonder if there is a default mode I can retrieve if the monitor is currently DISABLED and I have no information on which mode to enable. So one mode (resolution) which is definitely working.
PS: I am aware of this >10 years old question with no response, but things might have changed: https://stackoverflow.com/q/8390344/356726
答案1
得分: 1
根据CCD Summaries and Scenarios,显示控制面板小程序使用这些功能。
就推荐模式而言,使用DisplayConfigGetDeviceInfo与DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE。
查看QueryDisplayConfig,了解DisplayConfigGetDeviceInfo的示例。
英文:
According to CCD Summaries and Scenarios, The display control panel applet uses such functions.
As far as the recommended mode is concerned, use DisplayConfigGetDeviceInfo with DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE.
See QueryDisplayConfig for an example of DisplayConfigGetDeviceInfo.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论