Programming Technology

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

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

在OnInitDialog()函数下添加:

  1. //消除任务栏显示
  2. LONG style = ::GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE); //获得窗体扩展风格
  3. style &= ~WS_EX_APPWINDOW; //取消WS_EX_APPWINDOW
  4. ::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.

???

这里介绍的两种方法?Where's the other one?
Comment by xynn (2010/05/22 23:59)

发表评论 ( 如果您刚刚提交过评论,但是还没有被显示出来,请点击这里刷新一下: 刷新评论 )

标题

内容*

昵称*

电子邮件

个人网页


 authimage