如何使MDI MFC应用程序在任务栏中显示一个实例? [英] How do you make your MDI MFC app show one instance in the TaskBar?

查看:143
本文介绍了如何使MDI MFC应用程序在任务栏中显示一个实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MDI应用程序,当我单击新文档时,它会打开一个单独的选项卡.这将在Windows的任务栏中创建该图标的另一个实例.有什么办法可以改变这种行为,以便任务栏仅显示一个图标实例?

I have an MDI app and when I click new document, it opens up a separate tab. This creates another instance of the icon in the taskbar within Windows. Is there any way I can change this behavior so that only one icon instance is shown the taskbar?

我知道一种方法是使用SDI并在视图中使用选项卡,但我想将其保留为MDI.这有可能吗?

I know one way is to use SDI and use tabs for my views, but I want to keep it an MDI. Is this even possible.

我正在尝试模仿名为"Dameware NT Utilities"的特定应用程序的视图: http://www.dameware.com/v3-dameware/media/DameWare/DW%20NTU/Carousel/DRS-Primary-medium.png?width=490&height=276&ext=.png

I'm trying to mimic the view of this particular application called 'Dameware NT Utilities': http://www.dameware.com/v3-dameware/media/DameWare/DW%20NTU/Carousel/DRS-Primary-medium.png?width=490&height=276&ext=.png

推荐答案

经过一天的探索,我找到了解决方案.天哪,最终解决这个问题感觉很好.无论如何,这就是解决方案.

I found the solution after a day of digging around. Gosh, that feels good to finally figure this out. Anyway here is the solution.

我只需要重写子框架的CanShowOnTaskBarTabs()方法以返回FALSE.这是类方法:

I just had to override the childframe's CanShowOnTaskBarTabs() method to return FALSE. Here's the class method:

首先,在childframe.h文件中,将以下代码放入类声明中

first, in the childframe.h file, put the following code in the class declaration

public:
     virtual BOOL CanShowOnTaskBarTabs() override;

然后在childframe.cpp文件中,将以下代码放在最底部:

Then in your childframe.cpp file, put the following code at the very bottom:

BOOL CChildFrame::CanShowOnTaskBarTabs()
{
    return FALSE;
}

有关此主题的更多信息: http ://msdn.microsoft.com/zh-CN/library/ee256255(v = vs.100).aspx

Here's more information on the subject: http://msdn.microsoft.com/en-us/library/ee256255(v=vs.100).aspx

这篇关于如何使MDI MFC应用程序在任务栏中显示一个实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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