VC下不让窗口在任务栏显示 (Hide CDialog of task bar)

作者:Wupei  |  发表时间:  |  所属分类:VC

这里介绍的两种方法是直接调用WINDOWS API就可以了

在OnInitDialog()函数下添加:

//消除任务栏显示 
LONG style = ::GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE); //获得窗体扩展风格 
style &= ~WS_EX_APPWINDOW; //取消WS_EX_APPWINDOW 
::SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE, style); //设置窗体扩展风格 

这样话就不会在任务栏显示Dialog的任何信息,而且在用户使用Alt+Tab时也不会显示相应的图标

相关的MSDN的介绍:

WS_EX_APPWINDOW

Forces a top-level window onto the taskbar when the window is visible.

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.

Trackback from your site.

(1)条评论

  • xynn

    |

    这里介绍的两种方法?Where’s the other one?

    回复

请在这里留言: