CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  界面

怎样让一个基于对话框的MFC程序一启动就不可见。也就是隐藏对话框。

楼主HeavenS(King Of Terran)2003-05-03 23:31:15 在 VC/MFC / 界面 提问

谢谢! 问题点数:20、回复次数:4Top

1 楼Skt32(荒城之月)回复于 2003-05-03 23:33:08 得分 0

 
  ShowWindow(SW_HIDE)Top

2 楼tigerfox(风之力:=Doing.浪淘沙)回复于 2003-05-03 23:57:06 得分 20

Starting   a   modal   dialog   hidden  
   
  You   often   hear   people   complain   that   despite   putting   a   ShowWindow(SW_HIDE)   in   their   OnInitDialog   their   modal   dialog   still   starts   up   in   a   shown   state.   The   2problem   here   is   that   when   CDialog::OnInitDialog()   finishes   it   will   call   S2howWindow(SW_SHOW).   Thus   your   dialog   box   is   again   made   visisble.   But   then   as,   is   to   be   expected,   people   have   worked   around   this.   Here   is   what   you   need   to   do.  
   
  Add   a   BOOL   member   to   your   dialog   class   and   call   it   something,   say   visible.  
   
  Now   in   your   dialog   constructor   set   visible   to   false.  
   
        visible   =   false;  
   
  Now   you   need   to   override   WM_WINDOWPOSCHANGING.   You   might   have   to   change   your   message   filtering   options   to   have   this   message   show   up   in   the   Class   Wizard.  
   
  void   CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS   FAR*   lpwndpos)    
  {  
          if(!visible)  
                  lpwndpos->flags   &=   ~SWP_SHOWWINDOW;  
   
          CDialog::OnWindowPosChanging(lpwndpos);  
  }  
  That's   it.   Now   your   modal   dialog   actually   starts   up   in   a   hidden   state.   And   when   you   want   to   make   it   visible   this   is   what   you   need   to   do.  
   
  visible   =   true;  
  ShowWindow(SW_SHOW);  
   
  come   from   http://www.codeproject.com/dialog/dlgboxtricks.aspTop

相关问题

  • 隐藏对话框
  • 对话框如何隐藏?
  • 如何隐藏对话框?
  • 如何隐藏对话框
  • 隐藏对话框问题?
  • 如何隐藏对话框
  • 如何隐藏对话框
  • 如何将对话框隐藏?!
  • 非模式对话框 怎么隐藏。
  • 请教:隐藏对话框的问题

关键词

  • lpwndpos
  • dialog
  • showwindow
  • modal
  • visible
  • sw
  • need
  • show
  • starts

得分解答快速导航

  • 帖主:HeavenS
  • tigerfox

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo