MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / InitTree

Method InitTree

WinArk/WindowsView.cpp:187–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void CWindowsView::InitTree() {
188 m_TotalVisibleWindows = m_TotalWindows = m_TopLevelWindows = 0;
189 m_DesktopNode = nullptr;
190 HWND hDesktop = ::GetDesktopWindow();
191 if (!hDesktop)
192 return;
193
194 m_SelectedHwnd.Attach(hDesktop);
195 CWaitCursor wait;
196
197 m_Tree.LockWindowUpdate(TRUE);
198 m_Deleting = true;
199 m_Tree.DeleteAllItems();
200 m_WindowsMap.clear();
201 m_Deleting = false;
202
203 m_DesktopNode = AddNode(hDesktop, TVI_ROOT);
204 ::EnumWindows([](auto hWnd, auto lp)->BOOL {
205 auto pThis = (CWindowsView*)lp;
206 pThis->AddNode(hWnd, pThis->m_DesktopNode);
207 return TRUE;
208 }, reinterpret_cast<LPARAM>(this));
209 m_DesktopNode.Expand(TVE_EXPAND);
210 m_Tree.LockWindowUpdate(FALSE);
211
212 m_DesktopNode.Select();
213 m_DesktopNode.EnsureVisible();
214 m_Tree.SetScrollPos(SB_HORZ, 0);
215}
216
217void CWindowsView::AddChildWindows(HTREEITEM hParent) {
218 auto hWnd = (HWND)m_Tree.GetItemData(hParent);

Callers

nothing calls this directly

Calls 4

clearMethod · 0.80
AddNodeMethod · 0.80
ExpandMethod · 0.80
AttachMethod · 0.45

Tested by

no test coverage detected