Skip to content

Commit 019b069

Browse files
committed
使用pdh获取硬盘利用率时,默认选择第1块硬盘
1 parent 5b45c71 commit 019b069

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

TrafficMonitor/TrafficMonitorDlg.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
13821382
if (lite_version /*|| is_arm64ec*/ || !theApp.m_general_data.IsHardwareEnable(HI_HDD))
13831383
{
13841384
const auto& disk_names = m_disk_usage_helper.GetDiskNames();
1385-
int disk_index = 0;
1385+
int disk_index = -1;
13861386
for (int i = 0; i < static_cast<int>(disk_names.size()); i++)
13871387
{
13881388
if (theApp.m_general_data.hard_disk_name == disk_names[i].GetString())
@@ -1391,6 +1391,12 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
13911391
break;
13921392
}
13931393
}
1394+
//没有找到要监控的硬盘时默认使用第1个
1395+
if (disk_index < 0 && !disk_names.empty())
1396+
{
1397+
disk_index = 0;
1398+
theApp.m_general_data.hard_disk_name = disk_names.front();
1399+
}
13941400
if (m_disk_usage_helper.GetDiskUsage(disk_index, theApp.m_hdd_usage))
13951401
m_get_disk_usage_by_pdh = true;
13961402
}

0 commit comments

Comments
 (0)