Skip to content

Commit

Permalink
fix: use before set m_hBar
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Aug 21, 2022
1 parent a6c25d6 commit 270662e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions TrafficMonitor/TaskBarDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,11 +1020,6 @@ BOOL CTaskBarDlg::OnInitDialog()
if (theApp.m_win_version.IsWindows11OrLater())
{
theApp.m_is_windows11_taskbar = (::FindWindowExW(m_hTaskbar, 0, L"Windows.UI.Composition.DesktopWindowContentBridge", NULL) != NULL);
m_connot_insert_to_task_bar = !(::SetParent(this->m_hWnd, m_hTaskbar)); //把程序窗口设置成任务栏的子窗口
}
else
{
m_connot_insert_to_task_bar = !(::SetParent(this->m_hWnd, m_hBar)); //把程序窗口设置成任务栏的子窗口
}

//设置窗口透明色
Expand All @@ -1038,6 +1033,8 @@ BOOL CTaskBarDlg::OnInitDialog()
m_left_space = m_rcMin.left - m_rcBar.left;
m_top_space = m_rcMin.top - m_rcBar.top;

m_connot_insert_to_task_bar = !(::SetParent(this->m_hWnd, theApp.m_is_windows11_taskbar ? m_hTaskbar : m_hBar)); //把程序窗口设置成任务栏的子窗口

//根据已经确定的任务栏最小化窗口区域得到屏幕并获得所在屏幕的DPI(Windows 8.1及其以上)
if (theApp.m_win_version.IsWindows8Point1OrLater())
{
Expand Down

0 comments on commit 270662e

Please sign in to comment.