Consult ace, I get after the handle of the toolbar, use OpenProcess, after SendMessage (ipTray, TB_MSG. TB_BUTTONCOUNT, 0, 0) get button number, and then loop SendMessage (ipTray, TB_MSG TB_GETBUTTON, I lAddress. ToInt32 ()); Button information, find the corresponding program of zombie icon, GetWindowThreadProcessId (trayData HWND, ref dwProcessID); Determine whether the dwProcessID is 0, so the delete button messages sent, PostMessage (ipTray, TB_MSG TB_DELETEBUTTON, I lAddress. ToInt32 ());
Every time I'm in the program startup is called in the main, there's a problem, if the up arrow, click on the toolbar to the inside of the toobar icon manually after the mouse moves to eliminate, start the program, the icon will disappear at this time,
Is it is PostMessage TB_DELETEBUTTON news, toobar TB_DELETEBUTTON have not delete the last message, so there are two TB_DELETEBUTTON in queue, lead to icon disappear? If so, how to solve?