MFC:如何在win8.1的任务栏中隐藏程序ICON [英] MFC:how to hide the program ICON in the task bar in win8.1

查看:76
本文介绍了MFC:如何在win8.1的任务栏中隐藏程序ICON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Win8.1的任务栏中隐藏程序ICON。

我尝试了API ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW),但没有用。

< pre lang =c ++> void CMFC_NotifyIconDlg :: ShowHide( bool flag)
{
static CRect TmpRect;

if (flag)
{ // show
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 );
}
其他
{ // 隐藏
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 ) ;
}
}





我的尝试:



https://msdn.microsoft.com/zh-cn/library/61fe4bte.aspx

WS_EX_TOOLWINDOW创建一个工具窗口,该窗口旨在可以用作浮动工具栏。工具窗口的标题栏比普通标题栏短,窗口标题使用较小的字体绘制。工具窗口不会出现在任务栏中或用户按下ALT + TAB 时出现的窗口。

解决方案

问题是您必须使用 WS_EX_TOOLWINDOW 第一次创建窗口时。然后它不会出现在任务栏上。但是如果你以后改变它的类型它仍然不会显示。 Window的类型是在创建时建立的。


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)
	{//show
		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
	{//hide
		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.

解决方案

The issue is that you must use WS_EX_TOOLWINDOW when you first create the Window. It will then not show up on the task bar. But if you change its type at a later time it will still not show. The type of Window is established at create time.


这篇关于MFC:如何在win8.1的任务栏中隐藏程序ICON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆