正在運行的任務,可以通過遍歷窗口來找到
m_list2.DeleteAllItems(); //個人感覺帶有刷新的效果
CWnd *pWnd=AfxGetMainWnd()->GetWindow(GW_HWNDFIRST);//幾個列
int nCount=m_list2.GetHeaderCtrl()->GetItemCount();
int i=0;
while (pWnd)
{
if (pWnd->IsWindowVisible())
{
pWnd->GetWindowText(strText1);
if (!strText1.IsEmpty()) //判斷是否為空
{
m_list2.InsertItem(i,strText1); //插入,也可以用這個m_list2.InsertItem(LVIF_TEXT | LVIF_STATE, i, strText1,(i % 2) == 0 ? LVIS_SELECTED : 0, LVIS_SELECTED, 0, 0);有點看不懂
i++;
}
}
pWnd=pWnd->GetWindow(GW_HWNDNEXT);
}