|
用这个方法可以隐藏托盘所有图标,但只是隐藏图标,托盘区会留下一片空白长度,很难看,也有“此地无银三百两”之感:
HWND hTray = FindWindow(TEXT("Shell_TrayWnd"), NULL);
if(hTray == NULL)
break;
hTray = FindWindowEx(hTray, NULL, TEXT("TrayNotifyWnd"), NULL);
if(hTray == NULL)
break;
hTray = FindWindowEx(hTray, NULL, TEXT("SysPager"), NULL);
if(hTray == NULL)
break;
hTray = FindWindowEx(hTray, NULL, TEXT("ToolbarWindow32"), NULL);
if(hTray == NULL)
break;
iNum = SendMessage(hTray, TB_BUTTONCOUNT, NULL, NULL); //获取任务栏上图标个数
for (i = 0; i < iNum; i++)
SendMessage(hTray, TB_HIDEBUTTON, i, TRUE);
hTray = NULL;
我试用刷新托盘,但无效:
// 刷新托盘
SendMessage(hTray, WM_PAINT, NULL, NULL);
RECT rect;
GetWindowRect(hTray, &rect);
InvalidateRect(hTray, NULL, FALSE);
求:隐藏托盘所有图标后,托盘长度不更新的解决方法,或其他隐藏方法? |
|