How to hide the Program ICON in the task bar in Win8.1.
I tried the API ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW), but not worked.
void CMFC_NotifyIconDlg::ShowHide(bool flag)
{
static CRect TmpRect;
if (flag)
{ ModifyStyleEx(WS_EX_TOOLWINDOW, WS_EX_APPWINDOW);
AfxGetApp()->GetMainWnd()->ShowWindow(SW_SHOW);
ShowWindow(SW_SHOW);
AfxGetMainWnd()->MoveWindow(TmpRect.left, TmpRect.top, TmpRect.Width(), TmpRect.Height(), true);
}
else
{ GetWindowRect(&TmpRect);/
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
AfxGetApp()->GetMainWnd()->ShowWindow(SW_HIDE);
ShowWindow(SW_HIDE);
AfxGetMainWnd()->MoveWindow(-TmpRect.right, -TmpRect.bottom, TmpRect.Width(), TmpRect.Height(), true);
}
}
What I have tried:
https://msdn.microsoft.com/zh-cn/library/61fe4bte.aspx
WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating toolbar.A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font.
A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.