在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.