获取屏幕分辨率和刷新率

1.Windows API方式:

DISPLAY_DEVICE displayDevice;

displayDevice.cb = sizeof(DISPLAY_DEVICE);
if (EnumDisplayDevices(NULL, adapter, &displayDevice,0))
{
DEVMODE devMode;
if (EnumDisplaySettings(displayDevice.DeviceName, ENUM_CURRENT_SETTINGS, &devMode))
{
info->iCurrentFPS = devMode.dmDisplayFrequency;
info->iWidth = devMode.dmPelsWidth;
info->iHeight = devMode.dmPelsHeight;
}

}


2.DirectX方式:

        D3DCAPS9 d3dCaps;
m_pd3d->GetDeviceCaps(adapter, D3DDEVTYPE_HAL, &d3dCaps);
D3DDISPLAYMODE displayMode;

m_pd3d->GetAdapterDisplayMode(adapter, &displayMode);

info->iMaxTextureWidth = d3dCaps.MaxTextureWidth;
info->iMaxTextureHeight = d3dCaps.MaxTextureHeight;
info->iCurrentFPS = displayMode.RefreshRate;
info->iWidth = displayMode.Width;
info->iHeight = displayMode.Height;

你可能感兴趣的:(D3D)