日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

任务栏托盘不消失的问题-有启示

發布時間:2025/4/5 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 任务栏托盘不消失的问题-有启示 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
通過找出該圖標所相應的進程ID,假設該ID為NULL則刪除該圖標.

#include <AFX.H> #include <COMMCTRL.H> #include <iostream.h> int main() { HWND hStatus=::FindWindow("Shell_TrayWnd",NULL); //得到任務欄句柄 if (hStatus==NULL) { cout<<"Get Shell_TrayWnd error!\n"; return -1; } HWND hNotify=FindWindowEx(hStatus,NULL,"TrayNotifyWnd",NULL); //右下角區域 if (hNotify==NULL) { cout<<"Get TrayNotifyWnd error!\n"; return -1; } HWND hNotify1=FindWindowEx(hNotify,NULL,"SysPager",NULL); if (hNotify==NULL) { cout<<"Get SysPager error!\n"; return -1; } HWND hNotify1_0=FindWindowEx(hNotify1,NULL,"ToolBarWindow32",NULL);//右下角區域(不包含時間) if (hNotify1_0==NULL) { cout<<"Get ToolBarWindow32 error!\n"; return -1; } //-------------------以上是得到任務欄右下腳一塊地方的句柄 DWORD pid = 0; GetWindowThreadProcessId(hNotify1_0,&pid); if (pid==NULL) { cout<<"Get pid error!\n"; return -1; } HANDLE hProcess=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_ALL_ACCESS,true,pid); if (hProcess==NULL) { cout<<"Get hd error!\n"; return -1; } ::SendMessage(hNotify1_0,WM_PAINT ,NULL,NULL); CRect rect; ::GetWindowRect(hNotify1_0,&rect); ::InvalidateRect(hNotify1_0,&rect,false); int iNum=::SendMessage(hNotify1_0,TB_BUTTONCOUNT ,NULL,NULL); //獲取任務欄上圖標個數unsigned long n = 0; TBBUTTON *pButton = new TBBUTTON; CString strInfo = _T(""); wchar_t name[256] = {0}; TBBUTTON BButton; unsigned long whd,proid; CString x;for(int i=0; i<iNum; i++) { ::SendMessage(hNotify1_0,TB_GETBUTTON,i,(LPARAM)(&BButton)); ReadProcessMemory(hProcess,&BButton,pButton,sizeof(TBBUTTON),&n); if (pButton->iString != 0xffffffff) { try { ReadProcessMemory(hProcess,(void *)pButton->iString,name,255,&n); } catch(...) { } strInfo.Format("%d : %s\n",i+1,CString(name)); TRACE(strInfo); cout<<strInfo<<endl; }try { whd=0; ReadProcessMemory(hProcess,(void *)pButton->dwData,&whd,4,&n); } catch(...) { } proid=NULL; GetWindowThreadProcessId((HWND)whd,&proid); if(proid==NULL) ::SendMessage(hNotify1_0,TB_DELETEBUTTON,i,0); } delete pButton; return 0; }

總結

以上是生活随笔為你收集整理的任务栏托盘不消失的问题-有启示的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。