Beispiel #1
0
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;
}
Beispiel #2
0
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;
    }
}
void MyApp::Log(const wxString& text)
{
    if (GetTopWindow())
    {
        ((MyFrame*) GetTopWindow())->Log(text);
    }
}
Beispiel #4
0
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();
    }
}
Beispiel #5
0
// 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);
    }
}
Beispiel #6
0
//
// 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
Beispiel #7
0
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;
}
Beispiel #8
0
// 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);
    }
}
int CslApp::OnRun()
{
    if (GetTopWindow())
        wxApp::OnRun();

    return 0;
}
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;
}
Beispiel #11
0
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;
}
Beispiel #12
0
BOOL CALLBACK WDbgArkColorHack::EnumWindowsProc(HWND hwnd, LPARAM lParam) {
    bool*            found = reinterpret_cast<bool*>(lParam);
    unsigned __int32 pid   = 0;

    GetWindowThreadProcessId(hwnd, reinterpret_cast<LPDWORD>(&pid));

    if ( pid == GetCurrentProcessId() ) {
        HWND top_window = GetTopWindow(hwnd);

        if ( top_window ) {
            size_t window_text_len = static_cast<size_t>(GetWindowTextLength(top_window));

            if ( window_text_len ) {
                std::unique_ptr<char[]> test_name(new char[window_text_len]);

                if ( GetWindowText(top_window, test_name.get(), static_cast<int>(window_text_len)) ) {
                    std::string window_text_name = test_name.get();

                    if ( window_text_name.find("WinDbg:") != std::string::npos ) {
                        *found = true;
                        return FALSE;  // stop enumeration
                    }
                }
            }
        }
    }

    return TRUE;
}
Beispiel #13
0
int CslApp::OnRun()
{
    if (GetTopWindow())
        wxApp::OnRun();

    return m_shutdown>CSL_SHUTDOWN_NORMAL ? 1 : 0;
}
Beispiel #14
0
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;
}
Beispiel #15
0
// 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;
        }
    }
}
Beispiel #16
0
BOOL AutoSelectMode::snapshotWindows()
{
	for (HWND hWnd = GetTopWindow(NULL); NULL != hWnd; hWnd = GetWindow(hWnd, GW_HWNDNEXT))
	{
		if (!IsWindow(hWnd)
			|| !IsWindowVisible(hWnd)
			|| IsIconic(hWnd))
		{
			continue;
		}
		EnumChildWindows(hWnd, [](HWND hwnd, LPARAM lParam)->BOOL{
			if (!IsWindow(hwnd)
				|| !IsWindowVisible(hwnd)
				|| IsIconic(hwnd))
			{
				return TRUE;
			}
			RECT rcWnd = { 0 };
			GetWindowRect(hwnd, &rcWnd);
			
			if (ScreenCommon::isRectEmpty(rcWnd))
			{
				return TRUE;
			}

			wchar_t szTxt[MAX_PATH] = { 0 };
			GetWindowText(hwnd, szTxt, MAX_PATH);
			if (wcslen(szTxt) <= 0)
			{
				//continue;
			}

			//combine the rect with the screen rect
			AutoSelectMode* pThis = (AutoSelectMode*)lParam;
			pThis->m_lsWndList.push_back(ScreenCaptureWndInfo(hwnd, rcWnd));
			return TRUE;
		}, (LPARAM)this);
		

		RECT rcWnd = { 0 };
		GetWindowRect(hWnd, &rcWnd);
		adjustRectInScreen(rcWnd);
		if (ScreenCommon::isRectEmpty(rcWnd))
		{
			continue;
		}

		wchar_t szTxt[MAX_PATH] = { 0 };
		GetWindowText(hWnd, szTxt, MAX_PATH);
		if (wcslen(szTxt) <= 0)
		{
			//continue;
		}

		//combine the rect with the screen rect
		m_lsWndList.push_back(ScreenCaptureWndInfo(hWnd, rcWnd));
	}

	return m_lsWndList.size() > 0;
}
Beispiel #17
0
HRESULT CMpcAudioRenderer::InitCoopLevel()
{
    HRESULT hr = S_OK;
    IVideoWindow* pVideoWindow = nullptr;
    HWND hWnd = nullptr;

    hr = m_pGraph->QueryInterface(IID_PPV_ARGS(&pVideoWindow));
    if (SUCCEEDED(hr)) {
        pVideoWindow->get_Owner((OAHWND*)&hWnd);
        SAFE_RELEASE(pVideoWindow);
    }
    if (!hWnd) {
        hWnd = GetTopWindow(nullptr);
    }

    ASSERT(hWnd != nullptr);
    if (!m_useWASAPI) {
        hr = m_pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
    } else if (hTask == nullptr) {
        // Ask MMCSS to temporarily boost the thread priority
        // to reduce glitches while the low-latency stream plays.
        DWORD taskIndex = 0;

        if (pfAvSetMmThreadCharacteristicsW) {
            hTask = pfAvSetMmThreadCharacteristicsW(_T("Pro Audio"), &taskIndex);
            TRACE(_T("CMpcAudioRenderer::InitCoopLevel Putting thread in higher priority for WASAPI mode (lowest latency)\n"));
            hr = GetLastError();
            if (hTask == nullptr) {
                return hr;
            }
        }
    }

    return hr;
}
Beispiel #18
0
HRESULT CMpcAudioRenderer::InitCoopLevel()
{
	HRESULT				hr				= S_OK;
	IVideoWindow*		pVideoWindow	= NULL;
	HWND				hWnd			= NULL;
	CComBSTR			bstrCaption;

	hr = m_pGraph->QueryInterface (__uuidof(IVideoWindow), (void**) &pVideoWindow);
	if (SUCCEEDED (hr))
	{
		pVideoWindow->get_Owner((long*)&hWnd);
		SAFE_RELEASE (pVideoWindow);
	}
	if (!hWnd) 
	{
		hWnd = GetTopWindow(NULL);
	}

	ATLASSERT(hWnd != NULL);
 if (!useWASAPI)
	 hr = m_pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
 else if (hTask == NULL)
 {
  // Ask MMCSS to temporarily boost the thread priority
  // to reduce glitches while the low-latency stream plays.
  DWORD taskIndex = 0;
  hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
  hr=GetLastError();
  if (hTask == NULL)
   return hr;
 }

	return hr;
}
Beispiel #19
0
void DockBase::ControlPanel()
{
    if(controlpanel.IsOpen()) return;
    controlpanel.Open(GetTopWindow());
   	RefreshGroups();
    RefreshPanel(); 
}
Beispiel #20
0
void OyunApp::ShowHelp(wxWindow *parent, const wxString &fileName)
{
	if (parent == NULL)
		parent = GetTopWindow();
	
	wxHtmlModalHelp help(parent, FS::GetDocPath(), fileName,
	                     wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL | wxHF_MERGE_BOOKS);
}
Beispiel #21
0
void Pdb::ToForeground()
{
	TopWindow *w = GetTopWindow();
	if(w && !w->IsForeground()) {
		LLOG("Setting theide as foreground");
		w->SetForeground();
	}
}
Beispiel #22
0
void hvApp::OnIdle(wxIdleEvent& event)
{
    if (m_exitIfNoMainWindow && !GetTopWindow())
        ExitMainLoop();

    event.Skip();
    event.RequestMore();
}
Beispiel #23
0
int BenchApp::OnExit()
{
#if wxUSE_GUI
    delete GetTopWindow();
#endif // wxUSE_GUI

    return 0;
}
Beispiel #24
0
static HWND
main_window (void)
{
  HWND retval;

  retval = GetTopWindow (NULL);
  return retval;
}
void
winMWExtWMReorderWindows (ScreenPtr pScreen)
{
  winScreenPriv(pScreen);
  HWND hwnd = NULL;
  win32RootlessWindowPtr pRLWin = NULL;
  win32RootlessWindowPtr pRLWinSib = NULL;
  DWORD dwCurrentProcessID = GetCurrentProcessId ();
  DWORD dwWindowProcessID = 0;
  XID vlist[2];

#if CYGMULTIWINDOW_DEBUG && FALSE
  winDebug ("winMWExtWMReorderWindows\n");
#endif

  pScreenPriv->fRestacking = TRUE;

  if (pScreenPriv->fWindowOrderChanged)
    {
#if CYGMULTIWINDOW_DEBUG
      winDebug ("winMWExtWMReorderWindows - Need to restack\n");
#endif
      hwnd = GetTopWindow (NULL);

      while (hwnd)
	{
	  GetWindowThreadProcessId (hwnd, &dwWindowProcessID);

	  if ((dwWindowProcessID == dwCurrentProcessID)
	      && GetProp (hwnd, WIN_WINDOW_PROP))
	    {
	      pRLWinSib = pRLWin;
	      pRLWin = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP);
	      
	      if (pRLWinSib)
		{
		  vlist[0] = pRLWinSib->pFrame->win->drawable.id;
		  vlist[1] = Below;

		  ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode,
				   vlist, wClient(pRLWin->pFrame->win));
		}
	      else
		{
		  /* 1st window - raise to the top */
		  vlist[0] = Above;

		  ConfigureWindow (pRLWin->pFrame->win, CWStackMode,
				   vlist, wClient(pRLWin->pFrame->win));
		}
	    }
	  hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
	}
    }

  pScreenPriv->fRestacking = FALSE;
  pScreenPriv->fWindowOrderChanged = FALSE;
}
Beispiel #26
0
void sipXezPhoneApp::OnProcessLogMessage(wxCommandEvent& event)
{
   wxWindow* pLogWindow = wxWindow::FindWindowById(IDR_CALLERID_BOX, GetTopWindow());
   if (pLogWindow)
   {
      ((wxTextCtrl*)pLogWindow)->AppendText(mLogMessage);
   }

}
Beispiel #27
0
    virtual bool OnInit() {
        // Add the common image handlers
        wxImage::AddHandler( new wxPNGHandler );
        wxImage::AddHandler( new wxJPEGHandler );

        MainFrame *mainFrame = new MainFrame(NULL);
        SetTopWindow(mainFrame);
        return GetTopWindow()->Show();
    }
Beispiel #28
0
void sipXezPhoneApp::OnProcessStatusMessage(wxCommandEvent& event)
{
   wxWindow* pLogWindow = wxWindow::FindWindowById(IDR_STATUS_BOX, GetTopWindow());
   if (pLogWindow)
   {
      ((wxTextCtrl*)pLogWindow)->SetValue(mStatusMessage);
   }
    return;
}
Beispiel #29
0
static void hugsprim_GetTopWindow_32(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsPtr res1;
    arg1 = hugs->getPtr();
    res1 = GetTopWindow(arg1);
    hugs->putPtr(res1);
    hugs->returnIO(hugs_root,1);
}
Beispiel #30
-1
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);
}