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


C++ GetTopWindow函数代码示例

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


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

示例1: LLOG

bool MenuBar::HotKey(dword key)
{
	if(Ctrl::HotKey(key))
		return true;
	if(IsChild()) {
		if((key == (K_ALT_KEY|K_KEYUP) || key == K_F10) && (submenu || HasFocusDeep())) {
			LLOG("CloseMenu()");
			CloseMenu();
			if(restorefocus)
				restorefocus->SetFocus();
			s_doaltkey = false;
			return true;
		}
		if(key == K_ALT_KEY) {
			LLOG("K_ALT_KEY");
			s_doaltkey = true;
			return true;
		}
		if((key == K_F10 || key == (K_ALT_KEY|K_KEYUP) && s_doaltkey)
		   && !submenu && !HasFocusDeep() && GetTopWindow() && GetTopWindow()->IsForeground()) {
			LLOG("Open menu by F10 or ALT-UP");
			SetupRestoreFocus();
			for(Ctrl *q = pane.GetFirstChild(); q; q = q->GetNext())
				if(q->SetFocus()) return true;
		}
	}
	LLOG("MenuBar::HotKey");
	return (key == K_LEFT || key == K_RIGHT) && parentmenu ? parentmenu->Key(key, 1) : false;
}
开发者ID:koz4k,项目名称:soccer,代码行数:29,代码来源:MenuBar.cpp

示例2: GetTopWindow

void MyApp::Log(const wxString& text)
{
    if (GetTopWindow())
    {
        ((MyFrame*) GetTopWindow())->Log(text);
    }
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:7,代码来源:splashtext.cpp

示例3: m_hProcess

CDesktopIconManager::CDesktopIconManager()
: m_hProcess(NULL)
, m_hwnd(NULL)
, m_lpMem(NULL)
{
    // Find the icon container window
    m_hwnd = GetTopWindow(GetTopWindow(FindWindow(_T("Progman"), NULL)));
    if (m_hwnd == NULL) return;

    // Get shell process id
    DWORD dwPid;
    GetWindowThreadProcessId(m_hwnd, &dwPid);

    // Open shell process
    m_hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, dwPid);
    if (m_hProcess == NULL) {
        m_hwnd = NULL;
        return;
    }

    // Allocate one page in shell's address space
    m_lpMem = VirtualAllocEx(m_hProcess, NULL, 4096, MEM_COMMIT, PAGE_READWRITE);
    if (m_lpMem == NULL) {
        CloseHandle(m_hProcess);
        m_hProcess = NULL;
        m_hwnd = NULL;
    }
}
开发者ID:death,项目名称:iconjesus,代码行数:28,代码来源:DesktopIconManager.cpp

示例4: WXUNUSED

void SpinEditorApp::OnSpinPollTimer(wxTimerEvent& WXUNUSED(event))
{
    // This checks that the spin client thread is still running. If not, it
    // probably means that the user did a CTRL-C in the terminal window, or
    // something more ugly that I can't think of...

    if (!spinListener.isRunning())
    {
        std::cout << "SPIN stopped running (CTRL-C ?)" << std::endl;

        // Tell this timer that it can stop:
        spinPollTimer_->Stop();
        //delete spinPollTimer_;

        // Tell main frame to quit (with force=TRUE so that it doesn't ask for
        // any confirmation). Once that window closes, the wxapp will be told
        // to quit automatically.
        GetTopWindow()->Close(true);

        std::cout << "top window should be closed" << std::endl;

        if (GetTopWindow())
        {
            std::cout << "got topwindow" << GetTopWindow() << " why does it still exist?!" << std::endl;
            GetTopWindow()->Destroy();
            SetTopWindow(0);
        }

        //this->ExitMainLoop();
    }
}
开发者ID:djiamnot,项目名称:spinframework,代码行数:31,代码来源:main.cpp

示例5: OnQueryEndSession

// Default behaviour: close the application with prompts. The
// user can veto the close, and therefore the end session.
void wxApp::OnQueryEndSession(wxCloseEvent& event)
{
    if (GetTopWindow())
    {
        if (!GetTopWindow()->Close(!event.CanVeto()))
            event.Veto(true);
    }
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:10,代码来源:app.cpp

示例6: OnQueryEndSession

//
// Default behaviour: close the application with prompts. The
// user can veto the close, and therefore the end session.
//
void wxApp::OnQueryEndSession(
  wxCloseEvent&                     rEvent
)
{
    if (GetTopWindow())
    {
        if (!GetTopWindow()->Close(!rEvent.CanVeto()))
            rEvent.Veto(TRUE);
    }
} // end of wxApp::OnQueryEndSession
开发者ID:Duion,项目名称:Torsion,代码行数:14,代码来源:app.cpp

示例7: test_GetDlgItem

static void test_GetDlgItem(void)
{
    HWND hwnd, child1, child2, hwnd2;
    BOOL ret;

    hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
    ok(hwnd != NULL, "failed to created window\n");

    /* created with the same ID */
    child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
    ok(child1 != NULL, "failed to create first child\n");
    child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
    ok(child2 != NULL, "failed to create second child\n");

    hwnd2 = GetDlgItem(hwnd, 0);
    ok(hwnd2 == child1, "expected first child, got %p\n", hwnd2);

    hwnd2 = GetTopWindow(hwnd);
    ok(hwnd2 == child1, "expected first child to be top, got %p\n", hwnd2);

    ret = SetWindowPos(child1, child2, 0, 0, 0, 0, SWP_NOMOVE);
    ok(ret, "got %d\n", ret);
    hwnd2 = GetTopWindow(hwnd);
    ok(hwnd2 == child2, "expected second child to be top, got %p\n", hwnd2);

    /* top window from child list is picked */
    hwnd2 = GetDlgItem(hwnd, 0);
    ok(hwnd2 == child2, "expected second child, got %p\n", hwnd2);

    /* Now test how GetDlgItem searches */
    DestroyWindow(child2);
    child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, child1, 0, g_hinst, NULL);
    ok(child2 != NULL, "failed to create second child\n");

    /* give child2 an ID */
    SetWindowLong(child2, GWLP_ID, 100);

    hwnd2 = GetDlgItem(hwnd, 100);
    ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);

    /* make the ID of child2 public with a WS_EX_CONTROLPARENT parent */
    SetWindowLong(child1, GWL_EXSTYLE, WS_EX_CONTROLPARENT);

    hwnd2 = GetDlgItem(hwnd, 100);
    ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);

    DestroyWindow(child1);
    DestroyWindow(child2);
    DestroyWindow(hwnd);
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:50,代码来源:dialog.c

示例8: SnapWindowProc

static BOOL CALLBACK SnapWindowProc(HWND hwnd,LPARAM lParam)
{
	SnapWindowInfo *pInfo=reinterpret_cast<SnapWindowInfo*>(lParam);

	if (IsWindowVisible(hwnd) && hwnd!=pInfo->hwnd && hwnd!=pInfo->hwndExclude) {
		RECT rc,rcEdge;

		GetWindowRect(hwnd,&rc);
		if (rc.right>rc.left && rc.bottom>rc.top) {
			if (rc.top<pInfo->rcOriginal.bottom && rc.bottom>pInfo->rcOriginal.top) {
				if (abs(rc.left-pInfo->rcOriginal.right)<abs(pInfo->rcNearest.right)) {
					rcEdge.left=rc.left;
					rcEdge.right=rc.left;
					rcEdge.top=max(rc.top,pInfo->rcOriginal.top);
					rcEdge.bottom=min(rc.bottom,pInfo->rcOriginal.bottom);
					if (IsWindowEdgeVisible(hwnd,GetTopWindow(GetDesktopWindow()),&rcEdge,pInfo->hwnd))
						pInfo->rcNearest.right=rc.left-pInfo->rcOriginal.right;
				}
				if (abs(rc.right-pInfo->rcOriginal.left)<abs(pInfo->rcNearest.left)) {
					rcEdge.left=rc.right;
					rcEdge.right=rc.right;
					rcEdge.top=max(rc.top,pInfo->rcOriginal.top);
					rcEdge.bottom=min(rc.bottom,pInfo->rcOriginal.bottom);
					if (IsWindowEdgeVisible(hwnd,GetTopWindow(GetDesktopWindow()),&rcEdge,pInfo->hwnd))
						pInfo->rcNearest.left=rc.right-pInfo->rcOriginal.left;
				}
			}
			if (rc.left<pInfo->rcOriginal.right && rc.right>pInfo->rcOriginal.left) {
				if (abs(rc.top-pInfo->rcOriginal.bottom)<abs(pInfo->rcNearest.bottom)) {
					rcEdge.left=max(rc.left,pInfo->rcOriginal.left);
					rcEdge.right=min(rc.right,pInfo->rcOriginal.right);
					rcEdge.top=rc.top;
					rcEdge.bottom=rc.top;
					if (IsWindowEdgeVisible(hwnd,GetTopWindow(GetDesktopWindow()),&rcEdge,pInfo->hwnd))
						pInfo->rcNearest.bottom=rc.top-pInfo->rcOriginal.bottom;
				}
				if (abs(rc.bottom-pInfo->rcOriginal.top)<abs(pInfo->rcNearest.top)) {
					rcEdge.left=max(rc.left,pInfo->rcOriginal.left);
					rcEdge.right=min(rc.right,pInfo->rcOriginal.right);
					rcEdge.top=rc.bottom;
					rcEdge.bottom=rc.bottom;
					if (IsWindowEdgeVisible(hwnd,GetTopWindow(GetDesktopWindow()),&rcEdge,pInfo->hwnd))
						pInfo->rcNearest.top=rc.bottom-pInfo->rcOriginal.top;
				}
			}
		}
	}
	return TRUE;
}
开发者ID:ACUVE,项目名称:TVTest,代码行数:49,代码来源:WindowUtil.cpp

示例9: OnQueryEndSession

// Default behaviour: close the application with prompts. The
// user can veto the close, and therefore the end session.
void wxApp::OnQueryEndSession(wxCloseEvent& event)
{
    if ( !wxDialog::OSXHasModalDialogsOpen() )
    {
        if (GetTopWindow())
        {
            if (!GetTopWindow()->Close(!event.CanVeto()))
                event.Veto(true);
        }
    }
    else
    {
        event.Veto(true);
    }
}
开发者ID:zhchbin,项目名称:wxWidgets,代码行数:17,代码来源:app.cpp

示例10: winReorderWindowsMultiWindow

void
winReorderWindowsMultiWindow (void)
{
  HWND hwnd = NULL;
  WindowPtr pWin = NULL;
  WindowPtr pWinSib = NULL;
  XID vlist[2];
  static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
  DWORD dwCurrentProcessID = GetCurrentProcessId ();
  DWORD dwWindowProcessID = 0;

#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
  winTrace ("winReorderWindowsMultiWindow\n");
#endif

  if (fRestacking)
    {
      /* It is a recusive call so immediately exit */
#if CYGWINDOWING_DEBUG
      ErrorF ("winReorderWindowsMultiWindow - "
	      "exit because fRestacking == TRUE\n");
#endif
      return;
    }
  fRestacking = TRUE;

  /* Loop through top level Window windows, descending in Z order */
  for ( hwnd = GetTopWindow (NULL);
	hwnd;
	hwnd = GetNextWindow (hwnd, GW_HWNDNEXT) )
    {
      /* Don't take care of other Cygwin/X process's windows */
      GetWindowThreadProcessId (hwnd, &dwWindowProcessID);

      if ( GetProp (hwnd, WIN_WINDOW_PROP)
	   && (dwWindowProcessID == dwCurrentProcessID)
	   && !IsIconic (hwnd) ) /* ignore minimized windows */
	{
	  pWinSib = pWin;
	  pWin = GetProp (hwnd, WIN_WINDOW_PROP);
	      
	  if (!pWinSib)
	    { /* 1st window - raise to the top */
	      vlist[0] = Above;
		  
	      ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
	    }
	  else
	    { /* 2nd or deeper windows - just below the previous one */
	      vlist[0] = winGetWindowID (pWinSib);
	      vlist[1] = Below;

	      ConfigureWindow (pWin, CWSibling | CWStackMode,
			       vlist, wClient(pWin));
	    }
	}
    }

  fRestacking = FALSE;
}
开发者ID:GrahamCobb,项目名称:maemo-xsisusb,代码行数:60,代码来源:winmultiwindowwindow.c

示例11: 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

示例12: OnRun

int CslApp::OnRun()
{
    if (GetTopWindow())
        wxApp::OnRun();

    return m_shutdown>CSL_SHUTDOWN_NORMAL ? 1 : 0;
}
开发者ID:aurhat,项目名称:cubelister,代码行数:7,代码来源:CslApp.cpp

示例13: GetFocusWidget

Gtk::Widget* GetFocusWidget(Gtk::Widget& some_wdg)
{
    Gtk::Widget* res_wdg = 0;
    if( Gtk::Window* win = GetTopWindow(some_wdg) )
        res_wdg = win->get_focus();
    return res_wdg;
}
开发者ID:cargabsj175,项目名称:bombono-dvd,代码行数:7,代码来源:test_text.cpp

示例14: EnumWindowsZOrder

// Function mostly compatible with the normal EnumChildWindows,
// except it lists in Z-Order and it doesn't ensure consistency
// if a window is removed while enumerating
void EnumWindowsZOrder(WNDENUMPROC callback, LPARAM lParam)
{
    HWND hwnd, hwndOwner;
    WCHAR szClass[64];
    DWORD ExStyle;

    for (hwnd = GetTopWindow(NULL); hwnd; hwnd = GetWindow(hwnd, GW_HWNDNEXT))
    {
        if (!IsWindowVisible(hwnd))
            continue;

        // check special windows
        if (!GetClassNameW(hwnd, szClass, _countof(szClass)) ||
            wcscmp(szClass, L"Shell_TrayWnd") == 0 ||
            wcscmp(szClass, L"Progman") == 0)
        {
            continue;
        }

        ExStyle = GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
        if (ExStyle & WS_EX_TOOLWINDOW)
            continue;

        hwndOwner = GetWindow(hwnd, GW_OWNER);
        if ((ExStyle & WS_EX_APPWINDOW) || !IsWindowVisible(hwndOwner))
        {
            if (!callback(hwnd, lParam))
                break;

            continue;
        }
    }
}
开发者ID:Moteesh,项目名称:reactos,代码行数:36,代码来源:appswitch.c

示例15: OnRun

int CslApp::OnRun()
{
    if (GetTopWindow())
        wxApp::OnRun();

    return 0;
}
开发者ID:MorganBorman,项目名称:Cube-Server-Lister,代码行数:7,代码来源:CslApp.cpp


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