獲取工作列所有正在執行程式

2021-06-23 03:42:20 字數 1449 閱讀 8924

mfc程式新增 clistctrl名稱 m_userlist 

oninitdialog 事件中新增initthis 方法

bool callback enumtaskbarwnds( hwnd hwnd, lparam lparam )

int row=currentobj->m_userlist.insertitem(currentobj->m_userlist.getitemcount(),"");

currentobj->m_userlist.setitemtext(row,0,sztitle);

currentobj->m_userlist.setitemtext(row,1,"正在執行");

//這裡獲取到視窗的程序id

hwnd hwnd=findwindow(szclass,null);

hinstance hins = (hinstance)getwindowlong(hwnd, gwl_hinstance);

//hicon icon=loadicon(handle,0);

dword dwprocid=0;

::getwindowthreadprocessid(hwnd,&dwprocid);

handle phandle = openprocess(process_all_access, 0, dwprocid);

char szexepath[max_path]="";

getmodulefilenameex(phandle, 0, szexepath, sizeof(szexepath));

word rtnindex;

hicon rtnicon;

//hicon rtnicon=extractassociatedicon(hins,szexepath,&rtnindex);//一種匯出方式

shfileinfo fileinfo;

dword dwret = ::shgetfileinfo(szexepath, 0, &fileinfo, sizeof(shfileinfo), shgfi_icon); //另外一種匯出方式

rtnicon=fileinfo.hicon;

currentobj->m_imagelist.add(rtnicon);

lv_item lvitem = ;

lvitem.mask = lvif_image;

lvitem.iitem = row;    //設定的第幾行

lvitem.isubitem = 0;   //這個表示當前行的列索引

lvitem.iimage = row;   //影象索引,以imagelist新增順序為準

currentobj->m_userlist.setitem(&lvitem);

}//end if

}//end if

return true;

}void ctrl_usertaslist::initthis()

從任務視窗查詢正在執行程式

1 下面程式是查詢正在執行的軟鍵盤,找到並關閉 中止正在執行的某個程序 processentry32 processliststr processliststr.dwsize sizeof processentry32 bool return value process32first snapsho...

如何獲取正在執行任務的列表

裝置,軟體版本 s60 1st edition s60 2nd edition and fp1,fp2,fp3 s60 3rd edition and fp1 series 80 2nd edition 詳細描述 描述symbian作業系統的應用程式框架提供了一組api用以獲得當前正在執行的任務的資...

如何使用dos命令關閉正在執行程式

使用cmd下的dos命令列可以對正在執行的程式進行管理,對影響電腦速度的程式可以使用命令關閉,這主要用在批量關閉程式的時候,比如一台電腦開了很多程式,現在需要把電腦中不用的程式全部關閉,類似於電腦的登出。那cmd下的關閉命令就派上用場了。再加上批處理檔案的使用,優化管理電腦也就水到渠成了。另外,對於...