本文整理匯總了C++中EnumDisplayMonitors函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnumDisplayMonitors函數的具體用法?C++ EnumDisplayMonitors怎麽用?C++ EnumDisplayMonitors使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnumDisplayMonitors函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: _gdk_monitor_init
void
_gdk_monitor_init (void)
{
#ifdef HAVE_MONITOR_INFO
gint i, index;
_gdk_num_monitors = 0;
EnumDisplayMonitors (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors);
_gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, _gdk_num_monitors);
index = 0;
EnumDisplayMonitors (NULL, NULL, enum_monitor, (LPARAM) &index);
_gdk_offset_x = G_MININT;
_gdk_offset_y = G_MININT;
/* Calculate offset */
for (i = 0; i < _gdk_num_monitors; i++)
{
_gdk_offset_x = MAX (_gdk_offset_x, -_gdk_monitors[i].rect.x);
_gdk_offset_y = MAX (_gdk_offset_y, -_gdk_monitors[i].rect.y);
}
GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
_gdk_offset_x, _gdk_offset_y));
/* Translate monitor coords into GDK coordinate space */
for (i = 0; i < _gdk_num_monitors; i++)
{
_gdk_monitors[i].rect.x += _gdk_offset_x;
_gdk_monitors[i].rect.y += _gdk_offset_y;
GDK_NOTE (MISC, g_print ("Monitor %d: %dx%[email protected]%+d%+d\n",
i, _gdk_monitors[i].rect.width,
_gdk_monitors[i].rect.height,
_gdk_monitors[i].rect.x,
_gdk_monitors[i].rect.y));
}
#else
HDC hDC;
_gdk_num_monitors = 1;
_gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, 1);
_gdk_monitors[0].name = g_strdup ("DISPLAY");
hDC = GetDC (NULL);
_gdk_monitors[0].width_mm = GetDeviceCaps (hDC, HORZSIZE);
_gdk_monitors[0].height_mm = GetDeviceCaps (hDC, VERTSIZE);
ReleaseDC (NULL, hDC);
_gdk_monitors[0].rect.x = 0;
_gdk_monitors[0].rect.y = 0;
_gdk_monitors[0].rect.width = GetSystemMetrics (SM_CXSCREEN);
_gdk_monitors[0].rect.height = GetSystemMetrics (SM_CYSCREEN);
_gdk_offset_x = 0;
_gdk_offset_y = 0;
#endif
}
示例2: GetDCRect
RECT GetDCRect( HDC hdc)
{
RECT rc = {0};
EnumDisplayMonitors(hdc, NULL, MyDCDisplayMonitorsEnumProc, (LPARAM)&rc);
return rc;
}
示例3: EnumDisplayMonitors
//---------------------------------------------------------------------------//
// SaveData
//
//---------------------------------------------------------------------------//
void CLauncher::SaveData()
{
m_EnumeratingMonitors = true;
m_Monitor = m_D3D->GetAdapterMonitor(m_Device);
EnumDisplayMonitors(NULL, NULL, MyEnumMonitors, 0);
m_EnumeratingMonitors = false;
IAppOptions::GetInstance()->Set("Device", m_Device);
IAppOptions::GetInstance()->Set("Width", m_Fullscreen ? m_Modes[m_Mode].Width : m_Width);
IAppOptions::GetInstance()->Set("Height", m_Fullscreen ? m_Modes[m_Mode].Height : m_Height);
IAppOptions::GetInstance()->Set("RLeft", m_MonitorRect.left);
IAppOptions::GetInstance()->Set("RTop", m_MonitorRect.top);
IAppOptions::GetInstance()->Set("RWidth", m_Expand ? m_MonitorRect.right - m_MonitorRect.left : m_Width);
IAppOptions::GetInstance()->Set("RHeight", m_Expand ? m_MonitorRect.bottom - m_MonitorRect.top : m_Height);
IAppOptions::GetInstance()->Set("Mode", m_Mode);
IAppOptions::GetInstance()->Set("Fullscreen", m_Fullscreen ? 1 : 0);
IAppOptions::GetInstance()->Set("Expand", m_Expand ? 1 : 0);
IAppOptions::GetInstance()->Set("AutoCustTex", m_AutoCustTex ? 1 : 0);
if (m_AutoCustTex)
{
int w = IAppOptions::GetInstance()->Get("Width", 0);
int h = IAppOptions::GetInstance()->Get("Height", 0);
IAppOptions::GetInstance()->Set("CustTex1W", w>>1);
IAppOptions::GetInstance()->Set("CustTex1H", h>>1);
IAppOptions::GetInstance()->Set("CustTex2W", w>>2);
IAppOptions::GetInstance()->Set("CustTex2H", h>>2);
}
else
{
示例4: DIB_IsWinVisible
static int DIB_IsWinVisible(_THIS, int recenter)
{
VisibilityData data;
data.result = 0;
data.first = 1;
GetWindowRect(SDL_Window, &data.wrect);
EnumDisplayMonitors(NULL, NULL, visibility_cb, (LPARAM)&data);
if ( !data.result && recenter ) {
int new_x = 10;
int new_y = 10;
if ( !data.first ) {
int primary_w = data.primary.right - data.primary.left;
int primary_h = data.primary.bottom - data.primary.top;
new_x = data.primary.left + (primary_w - this->screen->w)/2;
new_y = data.primary.top + (primary_h - this->screen->h)/2;
}
DIB_SetWinPos(this, new_x, new_y);
}
return data.result;
}
示例5: MonitorFromRect
/***********************************************************************
* MonitorFromRect ([email protected])
*/
HMONITOR WINAPI MonitorFromRect( LPRECT rect, DWORD flags )
{
struct monitor_enum_info info;
info.rect = *rect;
info.max_area = 0;
info.min_distance = ~0u;
info.primary = 0;
info.nearest = 0;
info.ret = 0;
if (IsRectEmpty(&info.rect))
{
info.rect.right = info.rect.left + 1;
info.rect.bottom = info.rect.top + 1;
}
if (!EnumDisplayMonitors( 0, NULL, monitor_enum, (LPARAM)&info )) return 0;
if (!info.ret)
{
if (flags & MONITOR_DEFAULTTOPRIMARY) info.ret = info.primary;
else if (flags & MONITOR_DEFAULTTONEAREST) info.ret = info.nearest;
}
TRACE( "%s flags %x returning %p\n", wine_dbgstr_rect(rect), flags, info.ret );
return info.ret;
}
示例6: wf_info_peer_register
BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
{
int i;
int peerId;
if (!wfi || !context)
return FALSE;
if (!wf_info_lock(wfi))
return FALSE;
if (wfi->peerCount == WF_INFO_MAXPEERS)
goto fail_peer_count;
context->info = wfi;
if (!(context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
goto fail_update_event;
//get the offset of the top left corner of selected screen
EnumDisplayMonitors(NULL, NULL, wf_info_monEnumCB, 0);
_IDcount = 0;
#ifdef WITH_DXGI_1_2
if (wfi->peerCount == 0)
if (wf_dxgi_init(wfi) != 0)
goto fail_driver_init;
#else
if (!wf_mirror_driver_activate(wfi))
goto fail_driver_init;
#endif
//look through the array of peers until an empty slot
for (i = 0; i < WF_INFO_MAXPEERS; ++i)
{
//empty index will be our peer id
if (wfi->peers[i] == NULL)
{
peerId = i;
break;
}
}
wfi->peers[peerId] = ((rdpContext*) context)->peer;
wfi->peers[peerId]->pId = peerId;
wfi->peerCount++;
WLog_INFO(TAG, "Registering Peer: id=%d #=%d", peerId, wfi->peerCount);
wf_info_unlock(wfi);
wfreerdp_server_peer_callback_event(peerId, WF_SRV_CALLBACK_EVENT_CONNECT);
return TRUE;
fail_driver_init:
CloseHandle(context->updateEvent);
context->updateEvent = NULL;
fail_update_event:
fail_peer_count:
context->socketClose = TRUE;
wf_info_unlock(wfi);
return FALSE;
}
示例7: gfx_ctx_init
static bool gfx_ctx_init(void)
{
if (g_inited)
return false;
g_quit = false;
g_restore_desktop = false;
g_num_mons = 0;
EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, 0);
WNDCLASSEX wndclass = {0};
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = WndProc;
wndclass.hInstance = GetModuleHandle(NULL);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.lpszClassName = "RetroArch";
wndclass.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON));
wndclass.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
if (!RegisterClassEx(&wndclass))
return false;
return true;
}
示例8: sizeof
////////////////////////////////////////////////////////////////////////////////////////////////////
// Fills specified SHELLEXECUTEINFO structure with the information read from registry
VOID CConfigReader::PopulateExecuteInformation ( SHELLEXECUTEINFO* pExecInfo )
{
pExecInfo->cbSize = sizeof ( SHELLEXECUTEINFO ) ;
pExecInfo->fMask =
SEE_MASK_FLAG_DDEWAIT | SEE_MASK_HMONITOR | SEE_MASK_NOASYNC | SEE_MASK_UNICODE ;
pExecInfo->hwnd = NULL ;
pExecInfo->lpVerb = g_szShellExecuteVerb ;
pExecInfo->lpFile = m_lpszPath ;
pExecInfo->lpParameters = m_lpszParams ;
pExecInfo->lpDirectory = NULL ;
pExecInfo->nShow = m_dwWindowState ;
// Set monitor handle. 0 means primary monitor, if index is greater then zero we will enumerate
// through all monitors and find the required one using index.
if ( 0 < m_dwMonitorIndex )
{
FINDMONITOR FindMonitor ;
FindMonitor.dwCurrentIndex = 0 ;
FindMonitor.dwRequiredIndex = m_dwMonitorIndex ;
FindMonitor.hMonitor = NULL ;
EnumDisplayMonitors ( NULL , NULL , EnumMonitorsCallBack , ( LPARAM ) &FindMonitor ) ;
if ( NULL != FindMonitor.hMonitor )
{
pExecInfo->hMonitor = FindMonitor.hMonitor ;
return ;
}
} // If index is invalid or is 0 we will default to primary monitor
else
{
POINT ptZero = { 0 } ;
pExecInfo->hMonitor = MonitorFromPoint ( ptZero , MONITOR_DEFAULTTOPRIMARY ) ;
}
}
示例9: d3d_monitor_rect
// Multi-monitor support.
RECT d3d_monitor_rect(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
Monitor::num_mons = 0;
EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, 0);
if (!Monitor::last_hm)
Monitor::last_hm = MonitorFromWindow(GetDesktopWindow(), MONITOR_DEFAULTTONEAREST);
HMONITOR hm_to_use = Monitor::last_hm;
unsigned fs_monitor = g_settings.video.monitor_index;
if (fs_monitor && fs_monitor <= Monitor::num_mons && Monitor::all_hms[fs_monitor - 1])
{
hm_to_use = Monitor::all_hms[fs_monitor - 1];
d3d->cur_mon_id = fs_monitor - 1;
}
else
{
for (unsigned i = 0; i < Monitor::num_mons; i++)
{
if (Monitor::all_hms[i] == hm_to_use)
{
d3d->cur_mon_id = i;
break;
}
}
}
MONITORINFOEX current_mon;
memset(¤t_mon, 0, sizeof(current_mon));
current_mon.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(hm_to_use, (MONITORINFO*)¤t_mon);
return current_mon.rcMonitor;
}
示例10: EnumDisplayMonitors
/* static */
int32_t
WinUtils::GetMonitorCount()
{
int32_t monitorCount = 0;
EnumDisplayMonitors(nullptr, nullptr, AddMonitor, (LPARAM)&monitorCount);
return monitorCount;
}
示例11: GetCursorPos
BOOL CScreenCapture::CaptureScreenRect(
std::vector<CRect> arcCapture,
CString sSaveDirName,
int nIdStartFrom,
SCREENSHOT_IMAGE_FORMAT fmt,
int nJpegQuality,
BOOL bGrayscale,
std::vector<MonitorInfo>& monitor_list)
{
// Init output variables
monitor_list.clear();
// Set internal variables
m_nIdStartFrom = nIdStartFrom;
m_sSaveDirName = sSaveDirName;
m_fmt = fmt;
m_nJpegQuality = nJpegQuality;
m_bGrayscale = bGrayscale;
m_arcCapture = arcCapture;
m_monitor_list.clear();
// Get cursor information
GetCursorPos(&m_ptCursorPos);
m_CursorInfo.cbSize = sizeof(CURSORINFO);
GetCursorInfo(&m_CursorInfo);
// Perform actual capture task inside of EnumMonitorsProc
EnumDisplayMonitors(NULL, NULL, EnumMonitorsProc, (LPARAM)this);
// Return
monitor_list = m_monitor_list;
return TRUE;
}
示例12: w32_update_xinerama_info
/**
* \brief Update screen information.
*
* This function should be called in libvo's "control" callback
* with parameter VOCTRL_UPDATE_SCREENINFO.
* Note that this also enables the new API where geometry and aspect
* calculations are done in video_out.c:config_video_out
*
* Global libvo variables changed:
* xinerama_x
* xinerama_y
* vo_screenwidth
* vo_screenheight
*/
void w32_update_xinerama_info(struct vo *vo)
{
struct vo_w32_state *w32 = vo->w32;
struct mp_vo_opts *opts = vo->opts;
int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
vo->xinerama_x = vo->xinerama_y = 0;
if (opts->fs && screen == -2) {
int tmp;
vo->xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
vo->xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
tmp = GetSystemMetrics(SM_CXVIRTUALSCREEN);
if (tmp) vo->opts->screenwidth = tmp;
tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
if (tmp) vo->opts->screenheight = tmp;
} else if (screen == -1) {
MONITORINFO mi;
HMONITOR m = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
mi.cbSize = sizeof(mi);
GetMonitorInfoW(m, &mi);
vo->xinerama_x = mi.rcMonitor.left;
vo->xinerama_y = mi.rcMonitor.top;
vo->opts->screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
vo->opts->screenheight = mi.rcMonitor.bottom - mi.rcMonitor.top;
} else if (screen >= 0) {
w32->mon_cnt = 0;
w32->mon_id = screen;
EnumDisplayMonitors(NULL, NULL, mon_enum, (LONG_PTR)vo);
}
aspect_save_screenres(vo, vo->opts->screenwidth,
vo->opts->screenheight);
}
示例13: EnumDisplayMonitors
void winDisplayDeviceManager::scanDisplays()
{
// TODO mutex for this variable ???
descMap.clear();
EnumDisplayMonitors(0,0,winDisplayDeviceManager::EnumDispProc,(LPARAM)this);
// Add new descriptors
set<DisplayDeviceDescriptor> tempSet, resultSet;
for (descMap_t::iterator it = descMap.begin(); it != descMap.end(); it++)
{
addDevice(it->second);
tempSet.insert(it->second);
}
// We could just copy the new descriptors, however, we need to call callback functions
// for old displays, that's why we do this:
std::set_difference(descriptors.begin(), descriptors.end(), tempSet.begin(), tempSet.end(),
std::inserter(resultSet, resultSet.end()));
set<DisplayDeviceDescriptor>::iterator it = resultSet.begin();
for (; it != resultSet.end(); it++)
{
DisplayDeviceDescriptor desc = *it;
removeDevice(desc);
}
}
示例14: DrawFrame
void DrawFrame(OpenGLDrawData &oglData)
{
//OutputDebugString("Drawing frame ...\n");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
EnumDisplayMonitors(oglData.oglDC, NULL, MonitorEnumProc, (LPARAM)&oglData);
#if 0
//glScalef(oglData.width, oglData.height, 1.0f);
glPushMatrix();
glTranslatef(oglData.width / 2.0f, oglData.height / 2.0f, 0.0f);
glScalef(oglData.width, oglData.height, 0.0f);
glBegin(GL_QUADS);
glColor3ub(255, 0, 0);
glVertex2f(-0.5f, -0.5f);
glColor3ub(0, 255, 0);
glVertex2f(-0.5f, 0.5f);
glColor3ub(0, 0, 255);
glVertex2f(0.5f, 0.5f);
glColor3ub(255, 255, 255);
glVertex2f(0.5f, -0.5f);
glEnd();
glPopMatrix();
#endif
#if 1
glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // non-premultiplied alpha
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // premultiplied alpha
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, oglData.iconsTexture);
glColor3ub(255, 255, 255);
glScalef(oglData.width, oglData.height, 0.0f);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(0.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex2f(0.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex2f(1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex2f(1.0f, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
#endif
//OutputDebugString("Drew frame.\n");
}
示例15: enumerate
void enumerate() {
if (initialized) {
return;
}
initialized = true;
EnumDisplayMonitors(NULL, NULL, enumerationCallback, NULL);
}