本文整理汇总了C++中GetWindowInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowInfo函数的具体用法?C++ GetWindowInfo怎么用?C++ GetWindowInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWindowInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: al
void LocalUpdateHandler::updateVideoRegion()
{
ServerConfig *srvConf = Configurator::getInstance()->getServerConfig();
unsigned int interval = srvConf->getVideoRecognitionInterval();
DateTime curTime = DateTime::now();
if ((curTime - m_lastVidUpdTime).getTime() > interval) {
m_lastVidUpdTime = DateTime::now();
m_vidRegion.clear();
AutoLock al(srvConf);
StringVector *classNames = srvConf->getVideoClassNames();
std::vector<HWND> hwndVector;
std::vector<HWND>::iterator hwndIter;
WindowFinder::findWindowsByClass(classNames, &hwndVector);
for (hwndIter = hwndVector.begin(); hwndIter != hwndVector.end(); hwndIter++) {
HWND videoHWND = *hwndIter;
if (videoHWND != 0) {
WINDOWINFO wi;
wi.cbSize = sizeof(WINDOWINFO);
if (GetWindowInfo(videoHWND, &wi)) {
Rect videoRect(wi.rcClient.left, wi.rcClient.top,
wi.rcClient.right, wi.rcClient.bottom);
videoRect.move(-GetSystemMetrics(SM_XVIRTUALSCREEN),
-GetSystemMetrics(SM_YVIRTUALSCREEN));
m_vidRegion.addRect(&videoRect);
}
}
}
}
}
示例2: winDialogGetWindowDecor
static void winDialogGetWindowDecor(Ihandle* ih, int *border, int *caption, int menu)
{
WINDOWINFO wi;
wi.cbSize = sizeof(WINDOWINFO);
GetWindowInfo(ih->handle, &wi);
*border = wi.cxWindowBorders;
if (wi.rcClient.bottom == wi.rcClient.top ||
wi.rcClient.top > wi.rcWindow.bottom ||
wi.rcClient.bottom > wi.rcWindow.bottom)
{
if (wi.dwStyle & WS_CAPTION)
{
if (wi.dwExStyle & WS_EX_TOOLWINDOW)
*caption = GetSystemMetrics(SM_CYSMCAPTION); /* tool window */
else
*caption = GetSystemMetrics(SM_CYCAPTION); /* normal window */
}
else
*caption = 0;
}
else
{
/* caption = window height - borders - client height - menu */
*caption = (wi.rcWindow.bottom-wi.rcWindow.top) - 2*wi.cyWindowBorders - (wi.rcClient.bottom-wi.rcClient.top) - menu;
}
}
示例3: winDialogGetActiveWindowAttrib
static char* winDialogGetActiveWindowAttrib(Ihandle* ih)
{
WINDOWINFO wininfo;
wininfo.cbSize = sizeof(WINDOWINFO);
GetWindowInfo(ih->handle, &wininfo);
return iupStrReturnBoolean (wininfo.dwWindowStatus & WS_ACTIVECAPTION);
}
示例4: GetWindowInfo
void Window::HandleSizeMessage()
{
WINDOWINFO info;
GetWindowInfo(m_handle, &info);
bool resized = false;
if (GetRectWidth(info.rcClient) != GetRectWidth(m_clientRect))
resized = true;
else if (GetRectHeight(info.rcClient) != GetRectHeight(m_clientRect))
resized = true;
m_clientRect = info.rcClient;
m_windowRect = info.rcWindow;
if (resized)
{
unsigned int clientWidth = GetClientWidth();
unsigned int clientHeight = GetClientHeight();
unsigned int windowWidth = GetWindowWidth();
unsigned int windowHeight = GetWindowHeight();
for (size_t i = 0; i < m_eventListeners.size(); ++i)
{
m_eventListeners[i]->WindowResized(clientWidth, clientHeight, windowWidth, windowHeight);
}
}
}
示例5: RKMDIWindow
RKCaughtX11Window::RKCaughtX11Window (WId window_to_embed, int device_number) : RKMDIWindow (0, X11Window) {
RK_TRACE (MISC);
commonInit (device_number);
embedded = window_to_embed;
#ifdef Q_WS_WIN
// unfortunately, trying to get KWindowInfo as below hangs on windows (KDElibs 4.2.3)
WINDOWINFO wininfo;
wininfo.cbSize = sizeof (WINDOWINFO);
GetWindowInfo (embedded, &wininfo);
// clip off the window frame and menubar
xembed_container->setContentsMargins (wininfo.rcWindow.left - wininfo.rcClient.left, wininfo.rcWindow.top - wininfo.rcClient.top,
wininfo.rcClient.right - wininfo.rcWindow.right, wininfo.rcClient.bottom - wininfo.rcWindow.bottom);
// set a fixed size until the window is shown
xembed_container->setFixedSize (wininfo.rcClient.right - wininfo.rcClient.left, wininfo.rcClient.bottom - wininfo.rcClient.top);
setGeometry (wininfo.rcClient.left, wininfo.rcClient.right, wininfo.rcClient.top, wininfo.rcClient.bottom); // see comment in X11 section
move (wininfo.rcClient.left, wininfo.rcClient.top); // else the window frame may be off scree on top/left.
#elif defined Q_WS_X11
KWindowInfo wininfo = KWindowSystem::windowInfo (embedded, NET::WMName | NET::WMGeometry);
RK_ASSERT (wininfo.valid ());
// set a fixed size until the window is shown
xembed_container->setFixedSize (wininfo.geometry ().width (), wininfo.geometry ().height ());
setGeometry (wininfo.geometry ()); // it's important to set a size, even while not visible. Else DetachedWindowContainer will assign a default size of 640*480, and then size upwards, if necessary.
setCaption (wininfo.name ());
#endif
// somehow in Qt 4.4.3, when the RKCaughtWindow is reparented the first time, the QX11EmbedContainer may kill its client. Hence we delay the actual embedding until after the window was shown.
// In some previous version of Qt, this was not an issue, but I did not track the versions.
QTimer::singleShot (0, this, SLOT (doEmbed()));
}
示例6: is_valid_window
static int is_valid_window(HWND hwnd)
{
WINDOWINFO wi;
wi.cbSize = sizeof(wi);
GetWindowInfo(hwnd, &wi);
return (wi.dwStyle & WS_VISIBLE) && !(wi.dwExStyle & WS_EX_TOOLWINDOW);
}
示例7: maybeAddWindow
static
bool maybeAddWindow(HWND hwnd, std::vector<QRect> *windows) {
WINDOWINFO wi;
GetWindowInfo( hwnd, &wi );
RECT rect = wi.rcClient;
#if 0
RECT rect;
GetWindowRect( hwnd, &rect );
#endif
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
// For some reason, rect.left and rect.top are shifted by cxWindowBorders and cyWindowBorders pixels respectively
// in *every* case (for every window), but cxWindowBorders and cyWindowBorders are non-zero only in the
// biggest-window case, therefore we need to save the biggest cxWindowBorders and cyWindowBorders to adjust the rect later
cxWindowBorder = qMax(cxWindowBorder, wi.cxWindowBorders);
cyWindowBorder = qMax(cyWindowBorder, wi.cyWindowBorders);
if ( ( ( wi.dwStyle & WS_VISIBLE ) != 0 ) && (width >= minSize ) && (height >= minSize ) )
{
//QRect r( rect.left + 4, rect.top + 4, width, height); // 4 = max(wi.cxWindowBorders) = max(wi.cyWindowBorders)
QRect r(rect.left + cxWindowBorder, rect.top + cyWindowBorder, width, height);
if ( std::find( windows->begin(), windows->end(), r ) == windows->end() ) {
windows->push_back( r );
return true;
}
}
return false;
}
示例8: draw_hilight_box
static void draw_hilight_box (HWND hWnd, HDC hdc, COOLBARITEMDATA* item)
{
int l,r,t,b;
WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd);
DWORD color;
DWORD mainc = GetWindowElementAttr (hWnd, WE_MAINC_THREED_BODY);
l = item->RcTitle.left;
t = item->RcTitle.top;
r = item->RcTitle.right - 1;
b = item->RcTitle.bottom - 1;
color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKER);
SetPenColor (hdc,
RGBA2Pixel (hdc, GetRValue (color), GetGValue (color),
GetBValue (color), GetAValue (color)));
MoveTo (hdc, l, t);
LineTo (hdc, l, b);
MoveTo (hdc, r - 1, t);
LineTo (hdc, r - 1, b);
color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTER);
SetPenColor (hdc,
RGBA2Pixel (hdc, GetRValue (color), GetGValue (color),
GetBValue (color), GetAValue (color)));
MoveTo (hdc, l + 1, t);
LineTo (hdc, l + 1, b);
MoveTo (hdc, r, t);
LineTo (hdc, r, b);
}
示例9: InitInstance
//
// ‘”Ќ ÷»я: InitInstance(HINSTANCE, int)
//
// Ќј«Ќј„≈Ќ»≈: сохран¤ет обработку экземпл¤ра и создает главное окно.
//
// ќћћ≈Ќ“ј–»»:
//
// ¬ данной функции дескриптор экземпл¤ра сохран¤етс¤ в глобальной переменной, а также
// создаетс¤ и выводитс¤ на экран главное окно программы.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // —охранить дескриптор экземпл¤ра в глобальной переменной
//Samsung Galaxy S+ Screen Resolution
int WINDOW_WIDTH = 800;
int WINDOW_HEIGHT = 480;
hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
RECT rect = { 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT };
WINDOWINFO info;
GetWindowInfo(hWnd, &info);
AdjustWindowRectEx(&rect, info.dwStyle, GetMenu(hWnd) != NULL, info.dwExStyle);
MoveWindow(hWnd, 0, 0, (rect.right - rect.left), (rect.bottom - rect.top), FALSE);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
示例10: GetWindowInformation
void GetWindowInformation()
{
TCHAR buf[256];
GetCursorPos (&g_ptMouse);
memset(&g_WinInfo, 0, sizeof(g_WinInfo));
g_WinInfo.hwnd = WindowFromPoint(g_ptMouse);
RealGetWindowClass(g_WinInfo.hwnd , g_WinInfo.szWindowClass, sizeof(g_WinInfo.szWindowClass));
GetWindowInfo(g_WinInfo.hwnd , &g_WinInfo.wi );
int id = GetDlgCtrlID(g_WinInfo.hwnd );
HWND hwndEdit = GetDlgItem(g_hWndMain,ID_EDITCHILD);
_stprintf_s(buf, _T("「WindowClass」=%s 「CtrlID」=0x%p 「Location」=%d,%d"), g_WinInfo.szWindowClass, id,
g_WinInfo.wi.rcWindow.right - g_WinInfo.wi.rcWindow.left ,
g_WinInfo.wi.rcWindow.bottom - g_WinInfo.wi.rcWindow.top);
// Add text to the window.
//SendMessage(hwndEdit, WM_SETTEXT, 0, (LPARAM) buf);
InvalidateRect(g_hWndMain,NULL,FALSE);
}
示例11: GetWindowInfo
/*static*/ WindowInfo WindowInfo::about (int64_t wid){
HWND win = (HWND) (wid);
WINDOWINFO info;
GetWindowInfo(win, &info);
bool isVisible = (info.dwStyle & WS_VISIBLE) != 0;
if (isVisible) {
char title [512] = "";
GetWindowText (win, title, (sizeof title) - 1);
DWORD process;
GetWindowThreadProcessId (win, &process);
WindowInfo dst;
dst.title = title;
dst.id = (int64_t) win; // At least in Win7 Window Handles seem unique and could also be interpreted as IDs
dst.pid = process;
dst.area = dz::Rect(info.rcWindow.left, info.rcWindow.top, info.rcWindow.right - info.rcWindow.left, info.rcWindow.bottom - info.rcWindow.top);
return dst;
} else {
// do not count invisible windows
return WindowInfo ();
}
}
示例12: _ecore_win32_event_handle_configure_notify
void
_ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg)
{
WINDOWINFO wi;
Ecore_Win32_Event_Window_Configure *e;
WINDOWPOS *window_pos;
INF("window configure notify");
e = calloc(1, sizeof(Ecore_Win32_Event_Window_Configure));
if (!e) return;
window_pos = (WINDOWPOS *)msg->data_param;
wi.cbSize = sizeof(WINDOWINFO);
if (!GetWindowInfo(window_pos->hwnd, &wi))
{
free(e);
return;
}
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->abovewin = (void *)GetWindowLongPtr(window_pos->hwndInsertAfter, GWLP_USERDATA);
e->x = wi.rcClient.left;
e->y = wi.rcClient.top;
e->width = wi.rcClient.right - wi.rcClient.left;
e->height = wi.rcClient.bottom - wi.rcClient.top;
e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
}
示例13: EnumWindowsProc
static BOOL CALLBACK EnumWindowsProc (HWND win, LPARAM user){
EnumerateWindowSettings * settings = (EnumerateWindowSettings*) (user);
DWORD process;
GetWindowThreadProcessId (win, &process);
if (settings->pid && settings->pid != process) {
return TRUE; // skipping
}
WINDOWINFO info;
GetWindowInfo(win, &info);
char title [512] = "";
GetWindowText (win, title, (sizeof title) - 1);
bool isVisible = (info.dwStyle & WS_VISIBLE) != 0;
// bool isPopup = info.dwStyle & WS_POPUP;
if (isVisible) {
WindowInfo dst;
dst.title = title;
dst.id = (int64_t) win; // At least in Win7 Window Handles seem unique and could also be interpreted as IDs
dst.pid = process;
dst.area = dz::Rect(info.rcWindow.left, info.rcWindow.top, info.rcWindow.right - info.rcWindow.left, info.rcWindow.bottom - info.rcWindow.top);
settings->destination->push_back (dst);
}
return TRUE; // continue enumeration
}
示例14: IsTopLevelWindow
bool IsTopLevelWindow(HWND hWnd)
{
WINDOWINFO wi = {0};
assert(GetWindowInfo(hWnd, &wi));
bool WS_VISIBLE_isSet = (wi.dwStyle & WS_VISIBLE) != 0;
bool WS_EX_NOACTIVATE_isSet = (wi.dwExStyle & WS_EX_NOACTIVATE) != 0;
bool WS_EX_TOOLWINDOW_isSet = (wi.dwExStyle & WS_EX_TOOLWINDOW) != 0;
bool WS_EX_APPWINDOW_isSet = (wi.dwExStyle & WS_EX_APPWINDOW) != 0;
bool WS_POPUP_isSet = (wi.dwStyle & WS_POPUP) != 0;
bool WS_CHILD_isSet = (wi.dwStyle & WS_CHILD) != 0;
if (!WS_VISIBLE_isSet
|| ((WS_EX_NOACTIVATE_isSet || WS_EX_TOOLWINDOW_isSet) && !WS_EX_APPWINDOW_isSet)
|| hWnd == 0
|| WS_POPUP_isSet
|| WS_CHILD_isSet
)
{
return false;
}
else
{
return true;
}
}
示例15: draw_scroll_button
/*
* draw_scroll_button:
*
* This function draw scroll button of propsheet control .
*
* Author: Peng LIU
* Date: 2007-12-05
*/
static void
draw_scroll_button (HWND hWnd, HDC hdc, RECT *title_rc,
PPROPSHEETDATA propsheet, DWORD style)
{
RECT btn_rect = {0, 0, 0, 0};
WINDOWINFO *info;
DWORD color;
info = (WINDOWINFO*)GetWindowInfo (hWnd);
color = GetWindowElementAttr (hWnd, WE_FGC_WINDOW);
/* draw left arrow */
btn_rect.top = ((style & 0xf0L) == PSS_BOTTOM) ?
title_rc->top + 1 + 2 : title_rc->top + 1;
btn_rect.right = get_metrics (MWM_SB_WIDTH);
btn_rect.bottom = ((style & 0xf0L) == PSS_BOTTOM) ?
title_rc->bottom + 2 - 2 : title_rc->bottom - 2 - 1;
//SelectClipRect (hdc, &btn_rect);
info->we_rdr->draw_arrow (hWnd, hdc, &btn_rect, color , LFRDR_ARROW_LEFT);
/* draw right arrow */
btn_rect.left = propsheet->head_rc.right - get_metrics(MWM_SB_WIDTH);
btn_rect.right = propsheet->head_rc.right;
//SelectClipRect (hdc, &btn_rect);
info->we_rdr->draw_arrow (hWnd, hdc, &btn_rect, color , LFRDR_ARROW_RIGHT);
}