How do you make your MDI MFC app show one instance in the TaskBar?

 ̄綄美尐妖づ 提交于 2019-12-10 19:04:42

问题


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?

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.

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


回答1:


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

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

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

public:
     virtual BOOL CanShowOnTaskBarTabs();

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

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

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



来源:https://stackoverflow.com/questions/13255935/how-do-you-make-your-mdi-mfc-app-show-one-instance-in-the-taskbar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!