当前位置: 首页>>代码示例>>C++>>正文


C++ GetAncestor函数代码示例

本文整理汇总了C++中GetAncestor函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAncestor函数的具体用法?C++ GetAncestor怎么用?C++ GetAncestor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetAncestor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetAncestor

HWND uie::window::g_on_tab(HWND wnd_focus)
{
	HWND rv = 0;
	
	HWND wnd_temp = GetAncestor(wnd_focus, GA_ROOT);/*_GetParent(wnd_focus);
	
	while (wnd_temp && GetWindowLong(wnd_temp, GWL_EXSTYLE) & WS_EX_CONTROLPARENT)
	{
		if (GetWindowLong(wnd_temp, GWL_STYLE) & WS_POPUP) break;
		else wnd_temp = _GetParent(wnd_temp);
	}*/
	
	if (wnd_temp)
	{
		HWND wnd_next = GetNextDlgTabItem(wnd_temp, wnd_focus, (GetKeyState(VK_SHIFT) & KF_UP) ? TRUE :  FALSE);
		if (wnd_next && wnd_next != wnd_focus) 
		{
			unsigned flags = uSendMessage(wnd_next, WM_GETDLGCODE, 0, 0);
			if (flags & DLGC_HASSETSEL) uSendMessage(wnd_next, EM_SETSEL, 0, -1);
			SetFocus(wnd_next);
			
			rv = wnd_next;
		}
	}
	return rv;
};
开发者ID:19379,项目名称:foo-jscript-panel,代码行数:26,代码来源:ui_extension.cpp

示例2: onWM_COMMAND

static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
{
	uiColorButton *b = uiColorButton(c);
	HWND parent;
	struct colorDialogRGBA rgba;

	if (code != BN_CLICKED)
		return FALSE;

	parent = GetAncestor(b->hwnd, GA_ROOT);		// TODO didn't we have a function for this
	rgba.r = b->r;
	rgba.g = b->g;
	rgba.b = b->b;
	rgba.a = b->a;
	if (showColorDialog(parent, &rgba)) {
		b->r = rgba.r;
		b->g = rgba.g;
		b->b = rgba.b;
		b->a = rgba.a;
		invalidateRect(b->hwnd, NULL, TRUE);
		(*(b->onChanged))(b, b->onChangedData);
	}

	*lResult = 0;
	return TRUE;
}
开发者ID:123vipulj,项目名称:libui,代码行数:26,代码来源:colorbutton.cpp

示例3: inplace_frame_GetWindow

static HRESULT STDMETHODCALLTYPE
inplace_frame_GetWindow(IOleInPlaceFrame* self, HWND* win)
{
    HTML_TRACE("inplace_frame_GetWindow");
    *win = GetAncestor(MC_HTML_FROM_INPLACE_FRAME(self)->win, GA_ROOT);
    return(S_OK);
}
开发者ID:ArmstrongJ,项目名称:mctrl,代码行数:7,代码来源:html.c

示例4: IsShellWindow

bool IsShellWindow(HWND window)
{
    if(!IsWindow(window) || !IsWindowVisible(window))
    {
        return false;
    }
    if(GetAncestor(window, GA_PARENT) != GetDesktopWindow())
    {
        return false;
    }

    RECT clientRect;
    GetClientRect(window, &clientRect);
    if(clientRect.right - clientRect.left <= 1 || clientRect.bottom - clientRect.top <= 1)
    {
        return false;
    }
    
    char name[256] = {'\0'};
    GetWindowText(window, name, 256);
    String sName = name;
    if(sName.Length() == 0 || sName == "Start")
    {
        return false;
    }

    return true;
}
开发者ID:ElanHR,项目名称:Provincial,代码行数:28,代码来源:WindowsTasks.cpp

示例5: menubar_nccreate

static menubar_t*
menubar_nccreate(HWND win, CREATESTRUCT *cs)
{
    menubar_t* mb;
    TCHAR parent_class[16];

    MENUBAR_TRACE("menubar_nccreate(%p, %p)", win, cs);

    mb = (menubar_t*) malloc(sizeof(menubar_t));
    if(MC_ERR(mb == NULL)) {
        MC_TRACE("menubar_nccreate: malloc() failed.");
        return NULL;
    }

    memset(mb, 0, sizeof(menubar_t));
    mb->win = win;

    /* Lets be a little friendly to the app. developers: If the parent is
     * ReBar control, lets send WM_NOTIFY/WM_COMMAND to the ReBar's parent
     * as ReBar really is not interested in it, and embedding the menubar
     * in the ReBar is actually main advantage of this control in comparison
     * with the standard window menu. */
    GetClassName(cs->hwndParent, parent_class, MC_SIZEOF_ARRAY(parent_class));
    if(_tcscmp(parent_class, _T("ReBarWindow32")) == 0)
        mb->notify_win = GetAncestor(cs->hwndParent, GA_PARENT);
    else
        mb->notify_win = cs->hwndParent;

    mb->hot_item = -1;
    mb->pressed_item = -1;

    return mb;
}
开发者ID:Strongc,项目名称:mctrl,代码行数:33,代码来源:menubar.c

示例6: IsAltTabWindow

BOOL IsAltTabWindow(HWND hwnd)
{
    long wndStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
    if(GetWindowTextLength(hwnd) == 0)
        return false;

    // Ignore desktop window.
    if (hwnd == GetShellWindow())
        return(false);

    if(wndStyle & WS_EX_TOOLWINDOW)
        return(false);

    // Start at the root owner
    HWND hwndWalk = GetAncestor(hwnd, GA_ROOTOWNER);

    // See if we are the last active visible popup
    HWND hwndTry;
    while ((hwndTry = GetLastActivePopup(hwndWalk)) != hwndTry)
    {
        if (IsWindowVisible(hwndTry))
            break;
        hwndWalk = hwndTry;
    }
    return hwndWalk == hwnd;
}
开发者ID:jeffrimko,项目名称:QuickWin,代码行数:26,代码来源:mainwindow.cpp

示例7: is_alttab_window

// https://blogs.msdn.microsoft.com/oldnewthing/20071008-00/?p=24863/
static bool is_alttab_window(HWND const Window)
{
	if (!IsWindowVisible(Window))
		return false;

	auto Try = GetAncestor(Window, GA_ROOTOWNER);
	HWND Walk = nullptr;
	while (Try != Walk)
	{
		Walk = Try;
		Try = GetLastActivePopup(Walk);
		if (IsWindowVisible(Try))
			break;
	}
	if (Walk != Window)
		return false;

	// Tool windows should not be displayed either, these do not appear in the task bar
	if (GetWindowLongPtr(Window, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)
		return false;

	if (IsWindows8OrGreater())
	{
		int Cloaked = 0;
		if (SUCCEEDED(imports.DwmGetWindowAttribute(Window, DWMWA_CLOAKED, &Cloaked, sizeof(Cloaked))) && Cloaked)
			return false;
	}

	return true;
}
开发者ID:FarGroup,项目名称:FarManager,代码行数:31,代码来源:plist.cpp

示例8: EVENT_FocusIn

/**********************************************************************
 *              EVENT_FocusIn
 */
static void EVENT_FocusIn( HWND hwnd, XEvent *xev )
{
    XFocusChangeEvent *event = &xev->xfocus;
    XIC xic;

    if (!hwnd) return;

    TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );

    if (event->detail == NotifyPointer) return;

    if ((xic = X11DRV_get_ic( hwnd )))
    {
        wine_tsx11_lock();
        XSetICFocus( xic );
        wine_tsx11_unlock();
    }
    if (use_take_focus) return;  /* ignore FocusIn if we are using take focus */

    if (!can_activate_window(hwnd))
    {
        HWND hwnd = GetFocus();
        if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT );
        if (!hwnd) hwnd = GetActiveWindow();
        if (!hwnd) hwnd = x11drv_thread_data()->last_focus;
        if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, CurrentTime );
    }
    else SetForegroundWindow( hwnd );
}
开发者ID:howard5888,项目名称:wineT,代码行数:32,代码来源:event.c

示例9: ui_window_lower

static int
ui_window_lower(lua_State* L)  /* emulate Alt-Esc. */
{
	HWND hwnd = NULL;
	HWND root;
	HWND next_hwnd;
	BOOL syncp = FALSE;
	Crj_ParseArgs(L, "| u Q", &hwnd, &syncp);
	hwnd = GetTargetWindow(hwnd);

	root = GetAncestor(hwnd, GA_ROOT);
	if (root != NULL)
		hwnd = root;

	if (!IsTopmostP(hwnd)) {
		if (hwnd == GetForegroundWindow()) {
			next_hwnd = GetNextAppWindow(hwnd, FALSE);
			if (next_hwnd != NULL)
				SetForegroundWindow(next_hwnd);
		}
		SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0,
		             (((!syncp) ? SWP_ASYNCWINDOWPOS : 0)
		              | SWP_NOACTIVATE
		              | SWP_NOMOVE
		              | SWP_NOOWNERZORDER
		              | SWP_NOSIZE));
	} else {
		if (hwnd == GetForegroundWindow()) {
			next_hwnd = GetNextAppWindow(hwnd, TRUE);
			if (next_hwnd != NULL)
				SetForegroundWindow(next_hwnd);
		}
	}
	return 0;
}
开发者ID:emonkak,项目名称:cereja,代码行数:35,代码来源:window.c

示例10: CursorProc

LRESULT CALLBACK CursorProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  if (msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN || msg == WM_RBUTTONDOWN) {
    ShowWindow(hwnd, SW_HIDE);
    HWND page = PropSheet_GetCurrentPageHwnd(g_cfgwnd);

    if (msg == WM_LBUTTONDOWN) {
      POINT pt;
      GetCursorPos(&pt);
      HWND window = WindowFromPoint(pt);
      window = GetAncestor(window, GA_ROOT);

      wchar_t title[256], classname[256];
      GetWindowText(window, title, ARRAY_SIZE(title));
      GetClassName(window, classname, ARRAY_SIZE(classname));

      wchar_t txt[1000];
      swprintf(txt, L"%s|%s", title, classname);
      SetDlgItemText(page, IDC_NEWRULE, txt);
    }

    // Show icon again
    ShowWindowAsync(GetDlgItem(page,IDC_FINDWINDOW), SW_SHOW);

    DestroyWindow(hwnd);
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}
开发者ID:alex310110,项目名称:altdrag,代码行数:27,代码来源:config.c

示例11: CloseCurrentSession

INT_PTR CloseCurrentSession(WPARAM wparam,LPARAM lparam)
{
	HWND hWnd;
	int i=0;
	MessageWindowInputData  mwid;
	MessageWindowData  mwd;

	while(session_list[0]!=0)
	{
		mwid.cbSize = sizeof(MessageWindowInputData);
		mwid.hContact=session_list[i];
		mwid.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH;

		mwd.cbSize = sizeof(MessageWindowData);
		mwd.hContact = mwid.hContact;
		mwd.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH;
		CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid,(LPARAM)&mwd);

		if (g_mode)
		{
			hWnd=GetAncestor(mwd.hwndWindow,GA_ROOT);
			SendMessage(hWnd,WM_CLOSE,0,1);
		}
		else SendMessage(mwd.hwndWindow, WM_CLOSE, 0, 0);
	}
	ZeroMemory(session_list,SIZEOF(session_list));
	return 0;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:28,代码来源:Main.cpp

示例12: WinPosActivateOtherWindow

/*******************************************************************
 *         WINPOS_ActivateOtherWindow
 *
 *  Activates window other than pWnd.
 */
void
WINAPI
WinPosActivateOtherWindow(HWND hwnd)
{
    HWND hwndTo, fg;

    if ((GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER )))
    {
        hwndTo = GetAncestor( hwndTo, GA_ROOT );
        if (can_activate_window( hwndTo )) goto done;
    }

    hwndTo = hwnd;
    for (;;)
    {
        if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
        if (can_activate_window( hwndTo )) break;
    }

 done:
    fg = GetForegroundWindow();
    TRACE("win = %p fg = %p\n", hwndTo, fg);
    if (!fg || (hwnd == fg))
    {
        if (SetForegroundWindow( hwndTo )) return;
    }
    if (!SetActiveWindow( hwndTo )) SetActiveWindow(0);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:33,代码来源:winpos.c

示例13: MonthCalReload

static VOID
MonthCalReload(IN PMONTHCALWND infoPtr)
{
    WCHAR szBuf[64];
    UINT i;

    infoPtr->UIState = (DWORD)SendMessageW(GetAncestor(infoPtr->hSelf,
                                                       GA_PARENT),
                                            WM_QUERYUISTATE,
                                            0,
                                            0);

    /* Cache the configuration */
    infoPtr->FirstDayOfWeek = MonthCalFirstDayOfWeek();

    infoPtr->hbHeader = GetSysColorBrush(infoPtr->Enabled ? MONTHCAL_HEADERBG : MONTHCAL_DISABLED_HEADERBG);
    infoPtr->hbSelection = GetSysColorBrush(infoPtr->Enabled ? MONTHCAL_SELBG : MONTHCAL_DISABLED_SELBG);

    for (i = 0; i < 7; i++)
    {
        if (GetLocaleInfoW(LOCALE_USER_DEFAULT,
                           LOCALE_SABBREVDAYNAME1 +
                               ((i + infoPtr->FirstDayOfWeek) % 7),
                           szBuf,
                           sizeof(szBuf) / sizeof(szBuf[0])) != 0)
        {
            infoPtr->Week[i] = szBuf[0];
        }
    }

    /* Update the control */
    MonthCalUpdate(infoPtr);
}
开发者ID:GYGit,项目名称:reactos,代码行数:33,代码来源:monthcal.c

示例14: ui_window_raise

static int
ui_window_raise(lua_State* L)
{
	HWND hwnd = NULL;
	HWND rootowner;
	HWND lap;
	Crj_ParseArgs(L, "| u", &hwnd);
	hwnd = GetTargetWindow(hwnd);

	rootowner = GetAncestor(hwnd, GA_ROOTOWNER);
	if (rootowner != NULL)
		hwnd = rootowner;
	lap = GetLastActivePopup(hwnd);
	if (lap != NULL)
		hwnd = lap;

	if (hwnd != GetForegroundWindow()) {
		SetForegroundWindow(hwnd);
	} else {
		SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
		             (SWP_ASYNCWINDOWPOS
		              | SWP_NOACTIVATE
		              | SWP_NOMOVE
		              | SWP_NOOWNERZORDER
		              | SWP_NOSIZE));
	}
	return 0;
}
开发者ID:emonkak,项目名称:cereja,代码行数:28,代码来源:window.c

示例15: GetMainWindowHandle

HWND GetMainWindowHandle(DWORD processId) {
  if (!HeXModule()/* && !DesktopWidget()*/) {
    return FindWindow(GetMainWindowClassName(processId), NULL);
  }

  /*if (DesktopWidget()) {
    HWND desktop = FindWindow(L"Progman", NULL);
    desktop = GetWindow(desktop, GW_CHILD);
    HWND main_window = FindWindowEx(desktop, NULL,
        GetMainWindowClassName(processId), NULL);
    return main_window;
  }*/

  seekedHandle = NULL;  
  HWND topWindow = GetTopWindow(NULL);
  while (topWindow){
    DWORD pid = 0;
    DWORD threadId = GetWindowThreadProcessId(topWindow, &pid);
    if (threadId != 0 && pid == processId) {
      EnumChildWindows(topWindow, EnumChildBrowserProc, (LPARAM)pid);
      if (seekedHandle) {
        return GetAncestor(seekedHandle, GA_ROOT);
      }
    }
    topWindow = GetNextWindow(topWindow, GW_HWNDNEXT);
  }
  return NULL;
}
开发者ID:276361270,项目名称:hex,代码行数:28,代码来源:hex_shared_win.cpp


注:本文中的GetAncestor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。