本文整理匯總了C++中EnumDisplaySettings函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnumDisplaySettings函數的具體用法?C++ EnumDisplaySettings怎麽用?C++ EnumDisplaySettings使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnumDisplaySettings函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetListOfResolutions
// Search for available resolutions - TODO: Move to Common?
wxArrayString GetListOfResolutions()
{
wxArrayString retlist;
retlist.Add("Auto");
#ifdef _WIN32
DWORD iModeNum = 0;
DEVMODE dmi;
ZeroMemory(&dmi, sizeof(dmi));
dmi.dmSize = sizeof(dmi);
std::vector<std::string> resos;
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{
char res[100];
sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
std::string strRes(res);
// Only add unique resolutions
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{
resos.push_back(strRes);
retlist.Add(StrToWxStr(res));
}
ZeroMemory(&dmi, sizeof(dmi));
}
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
main_frame->m_XRRConfig->AddResolutions(retlist);
#elif defined(__APPLE__)
CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
{
std::stringstream res;
CGDisplayModeRef mode;
CFStringRef encoding;
size_t w, h;
bool is32;
mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
w = CGDisplayModeGetWidth(mode);
h = CGDisplayModeGetHeight(mode);
encoding = CGDisplayModeCopyPixelEncoding(mode);
is32 = CFEqual(encoding, CFSTR(IO32BitDirectPixels));
CFRelease(encoding);
if (!is32)
continue;
if (CGDisplayModeGetIOFlags(mode) & kDisplayModeStretchedFlag)
continue;
res << w << "x" << h;
retlist.Add(res.str());
}
CFRelease(modes);
#endif
return retlist;
}
示例2: GetScreenMode
void Window::GetScreenMode(){
std::cout<<"Get Screen INfo"<<std::endl;
DEVMODE Screen;
Screen.dmSize=sizeof(DEVMODE);
for(int i=0;EnumDisplaySettings(NULL,i,&Screen);i++){
//LPDWORD BitRequired=0;
//LPDWORD StructNb;
//EnumMonitorsW(NULL,1,NULL,0,BitRequired,StructNb);
//LPBYTE Buffer[(long)*BitRequired];
//EnumMonitorsW(NULL,1,*Buffer,*BitRequired,BitRequired,StructNb);
char buff[255];
char buff2[20];
strcpy(buff,"Device:");
strcat(buff,(const char*)Screen.dmDeviceName);
std::cout<<buff<<std::endl;
WriteToLog(buff,"DEVMOD");
strcpy(buff,"extra bit driver:");
sprintf(buff2,"%i",Screen.dmDriverExtra);
strcat(buff,buff2);
std::cout<<buff<<std::endl;
WriteToLog(buff,"DEVMOD");
//withd et height
strcpy(buff,"Width/Height:");
sprintf(buff2,"%u",Screen.dmPelsWidth);
strcat(buff,buff2);
strcat(buff,"/");
sprintf(buff2,"%u",Screen.dmPelsHeight);
strcat(buff,buff2);
std::cout<<buff<<std::endl;
WriteToLog(buff,"DEVMOD");
//bit par pixel
strcpy(buff,"Bit per pixel:");
sprintf(buff2,"%u",Screen.dmBitsPerPel);
strcat(buff,buff2);
std::cout<<buff<<std::endl;
WriteToLog(buff,"DEVMOD");
strcpy(buff,"FramePerSecond:");
sprintf(buff2,"%u",Screen.dmDisplayFrequency);
strcat(buff,buff2);
std::cout<<buff<<std::endl;
WriteToLog(buff,"DEVMOD");
int* Res=new int[2];
Res[0]=Screen.dmPelsWidth;
Res[1]=Screen.dmPelsHeight;
ResolutionList.push_back(Res);
FrameRateList.push_back(Screen.dmDisplayFrequency);
}
ResolutionList.sort(SortResolution);
FrameRateList.sort();
}
示例3: memset
int Window::GetDesktopRefreshRate() const
{
DEVMODE mode;
memset(&mode, 0, sizeof(mode));
mode.dmSize = sizeof(mode);
if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &mode))
return 60;
return mode.dmDisplayFrequency;
}
示例4: getPossibleScreenModes
void getPossibleScreenModes(vector<VideoMode> &out_modes) {
DEVMODE dm = {0};
dm.dmSize = sizeof(dm);
for (int iModeNum = 0; EnumDisplaySettings(NULL, iModeNum, &dm) != 0; ++iModeNum) {
if (dm.dmBitsPerPel == 32/* || dm.dmBitsPerPel == 16*/) {
VideoMode mode(dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency);
out_modes.push_back(mode);
}
}
}
示例5: deviceInfoForWidget
static DEVMODE deviceInfoForWidget(Widget* widget)
{
DEVMODE deviceInfo;
deviceInfo.dmSize = sizeof(DEVMODE);
deviceInfo.dmDriverExtra = 0;
MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &deviceInfo);
return deviceInfo;
}
示例6: getrefresh
double getrefresh() {
DEVMODE DevMode;
DevMode.dmDriverExtra = 0;
if (EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&DevMode)) {
return (double)DevMode.dmDisplayFrequency;
} else {
return 0;
}
}
示例7: IsResolutionSupported
BOOL Window::IsResolutionSupported(int width, int height) {
DEVMODE mode;
for (int i = 0; EnumDisplaySettings(0, i, &mode); i++) {
if (ChangeDisplaySettings(&mode, CDS_TEST) == DISP_CHANGE_SUCCESSFUL)
if (width == mode.dmPelsWidth && height == mode.dmPelsHeight) {
return TRUE;
}
}
return FALSE;
}
示例8: EnumDisplaySettings
VideoModeInfo DisplayWrapper::dwrapperCurrentVideoMode() {
DEVMODE devmode;
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
VideoModeInfo videoModeInfo;
videoModeInfo.width = devmode.dmPelsWidth;
videoModeInfo.height = devmode.dmPelsHeight;
videoModeInfo.bpp = devmode.dmBitsPerPel;
return videoModeInfo;
}
示例9: EnumDisplaySettings
VideoModeInfo DisplayWrapper::dw_currentMode()
{
DEVMODE devmode;
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
VideoModeInfo mode;
mode.width = devmode.dmPelsWidth;
mode.height = devmode.dmPelsHeight;
mode.bpp = devmode.dmBitsPerPel;
return mode;
}
示例10: adjustWindow
void adjustWindow(WindowsDesc* winDesc)
{
HWND hwnd = (HWND)winDesc->handle;
if (winDesc->fullScreen)
{
RECT windowedRect = {};
// Save the old window rect so we can restore it when exiting fullscreen mode.
GetWindowRect(hwnd, &windowedRect);
winDesc->windowedRect = { (int)windowedRect.left, (int)windowedRect.top, (int)windowedRect.right, (int)windowedRect.bottom };
// Make the window borderless so that the client area can fill the screen.
SetWindowLong(hwnd, GWL_STYLE, WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE);
// Get the settings of the primary display. We want the app to go into
// fullscreen mode on the display that supports Independent Flip.
DEVMODE devMode = {};
devMode.dmSize = sizeof(DEVMODE);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
SetWindowPos(
hwnd,
HWND_TOPMOST,
devMode.dmPosition.x,
devMode.dmPosition.y,
devMode.dmPosition.x + devMode.dmPelsWidth,
devMode.dmPosition.y + devMode.dmPelsHeight,
SWP_FRAMECHANGED | SWP_NOACTIVATE);
ShowWindow(hwnd, SW_MAXIMIZE);
}
else
{
// Restore the window's attributes and size.
SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
SetWindowPos(
hwnd,
HWND_NOTOPMOST,
winDesc->windowedRect.left,
winDesc->windowedRect.top,
winDesc->windowedRect.right - winDesc->windowedRect.left,
winDesc->windowedRect.bottom - winDesc->windowedRect.top,
SWP_FRAMECHANGED | SWP_NOACTIVATE);
if (winDesc->maximized)
{
ShowWindow(hwnd, SW_MAXIMIZE);
}
else
{
ShowWindow(hwnd, SW_NORMAL);
}
}
}
示例11: GLimp_GetCurrentMode
/*
** GLimp_GetCurrentMode
*/
int GLimp_GetCurrentMode( void )
{
DEVMODE dm;
memset( &dm, 0, sizeof( dm ) );
dm.dmSize = sizeof( dm );
EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &dm );
return VID_GetModeNum( dm.dmPelsWidth, dm.dmPelsHeight );
}
示例12: changeDisplayRes
void changeDisplayRes(int displayIndex)
{
DEVMODE dm;
EnumDisplaySettings(NULL, displayIndex, &dm);
if (ChangeDisplaySettings(&dm, CDS_TEST) != DISP_CHANGE_SUCCESSFUL)
return;
ChangeDisplaySettings(&dm, 0);
}
示例13: s_video_gdi_server_fullscreen
void s_video_gdi_server_fullscreen (void)
{
RECT rect;
DEVMODE settings;
s_video_gdi_data_t *priv = (s_video_gdi_data_t *) xynth_server->driver->driver_data;
if (priv->fullscreen == 0) {
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &priv->dmode);
memset(&settings, 0, sizeof(DEVMODE));
settings.dmSize = sizeof(DEVMODE);
settings.dmBitsPerPel = priv->bpp_windows;
settings.dmPelsWidth = xynth_server->window->surface->width;
settings.dmPelsHeight = xynth_server->window->surface->height;
settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
} else {
settings.dmSize = sizeof(DEVMODE);
settings.dmBitsPerPel = priv->dmode.dmBitsPerPel;
settings.dmPelsWidth = priv->dmode.dmPelsWidth;
settings.dmPelsHeight = priv->dmode.dmPelsHeight;
settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
}
switch (ChangeDisplaySettings(&settings, CDS_FULLSCREEN)) {
case DISP_CHANGE_SUCCESSFUL:
break;
case DISP_CHANGE_BADFLAGS:
case DISP_CHANGE_BADMODE:
case DISP_CHANGE_BADPARAM:
case DISP_CHANGE_FAILED:
case DISP_CHANGE_NOTUPDATED:
case DISP_CHANGE_RESTART:
break;
}
if (priv->fullscreen == 0) {
rect.left = 0;
rect.right = xynth_server->window->surface->width;
rect.top = 0;
rect.bottom = xynth_server->window->surface->height;
AdjustWindowRect(&rect, GetWindowLong(priv->hwndMain, GWL_STYLE), FALSE);
SetWindowPos(priv->hwndMain, HWND_TOPMOST, rect.left, rect.top, rect.right + 100, rect.bottom + 100, 0);
priv->fullscreen = 1;
} else {
rect.left = 0;
rect.right = xynth_server->window->surface->width;
rect.top = 0;
rect.bottom = xynth_server->window->surface->height;
AdjustWindowRect(&rect, GetWindowLong(priv->hwndMain, GWL_STYLE), FALSE);
SetWindowPos(priv->hwndMain, HWND_NOTOPMOST, 0, 0, rect.right - rect.left, rect.bottom - rect.top, 0);
priv->fullscreen = 0;
}
UpdateWindow(priv->hwndMain);
}
示例14: GetClientRect
void GLWindow::changeDisplaySettings()
{
RECT screenRect = { };
GetClientRect(GetDesktopWindow(), &screenRect);
DEVMODE deviceMode = { };
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &deviceMode);
deviceMode.dmSize = sizeof(DEVMODE);
deviceMode.dmPelsWidth = screenRect.right;
deviceMode.dmPelsHeight = screenRect.bottom;
ChangeDisplaySettings(&deviceMode, CDS_FULLSCREEN);
}
示例15: swprintf_s
void CFixApp::PopulateDialog()
{
//Populate the GUI scale combobox
for (size_t i = 1; i < 6; i++)
{
wchar_t szBuf[3];
swprintf_s(szBuf, L"x%Iu", i);
ComboBox_AddString(m_hWndCBGUIScales, szBuf);
}
ComboBox_SetCurSel(m_hWndCBGUIScales, 0);
//Populate the resolution combobox
DEVMODE dm = {};
dm.dmSize = sizeof(dm);
Resolution r= {};
for(DWORD iModeNum = 0; EnumDisplaySettings(NULL, iModeNum, &dm) != FALSE; iModeNum++)
{
if((dm.dmPelsWidth != r.iX || dm.dmPelsHeight != r.iY) && dm.dmBitsPerPel == 32) //Only add each res once, but don't actually check if it matches the current color depth/refresh rate
{
r.iX = dm.dmPelsWidth;
r.iY = dm.dmPelsHeight;
m_Resolutions.push_back(r);
wchar_t szBuffer[20];
_snwprintf_s(szBuffer, _TRUNCATE, L"%Iux%Iu", r.iX, r.iY);
int iIndex = ComboBox_AddString(m_hWndCBResolutions, szBuffer);
ComboBox_SetItemData(m_hWndCBResolutions, iIndex, &(m_Resolutions.back()));
}
}
ComboBox_SetCurSel(m_hWndCBResolutions, 0);
//Renderers (based on UnEngineWin.h), requires appInit() to have been called
TArray<FRegistryObjectInfo> Classes;
Classes.Empty();
UObject::GetRegistryObjects( Classes, UClass::StaticClass(), URenderDevice::StaticClass(), 0 );
for( TArray<FRegistryObjectInfo>::TIterator It(Classes); It; ++It )
{
FString Path = It->Object, Left, Right;
if( Path.Split(L".",&Left,&Right) )
{
const wchar_t* pszDesc = Localize(*Right,L"ClassCaption",*Left);
assert(pszDesc);
if(ComboBox_FindStringExact(m_hWndCBRenderers, -1, pszDesc) == CB_ERR)
{
ComboBox_AddString(m_hWndCBRenderers, pszDesc);
m_Renderers.emplace_back(static_cast<wchar_t*>(Path.GetCharArray().GetData()));
}
}
}
}