Solved

How to Hide a dialog on App startup

Posted on 1998-12-21
8
380 Views
Last Modified: 2013-11-20
I have an application that's main window is a dialog box.  It has a taskbar icon associated with it.  How do I hide the window at the start of the application?  I tried to call ShowWindow() in the Create, OnCreate, and InitDialog with no luck.  Also, I tried to set the m_nCmdShow of the dialog in the App Class with no luck.
0
Comment
Question by:healer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 12

Expert Comment

by:migel
ID: 1326552
Hi! You can use SetWindowPos function with SWP_HIDEWINDOW.
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1326553
Did you try ShowWindow(SW_HIDE) ?
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1326554
in the yourDlg::OnInitDialog
{
 ...
 ShowWindow(SW_HIDE);
 return FALSE;
}
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:healer
ID: 1326555
I tried calling the ShowWindow(SW_HIDE) in the OnInitDialog and then returning FALSE,  The dialog still shows up.
0
 

Accepted Solution

by:
joshual earned 50 total points
ID: 1326556
You can only call ShowWindow(SW_HIDE) after the Dialog is created and not at OnInitDialog. I did it but setting a 10msec timer at OnInitDialog and call ShowWindow at OnTimer.

You might see the Dialog blink once. This can be overcome by moveing the dialog out of the screen.

0
 
LVL 12

Expert Comment

by:migel
ID: 1326557
You Can create modeless dialog (do not forget turn off WS_VISIBLE style)
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1326558
set a timer in OnInitDialog...
{
  SetTimer(1,1,NULL);
  PostMessage(WM_SYSCOMMAND,SC_MINIMIZE ,0);//optional
..
}

defien timer handler
XXX::OnTimer(...)
{
  KillTimer(1);
  ShowWindow(SW_HIDE);
  ....
}
0
 

Expert Comment

by:dagangwang
ID: 1326559
1. Create a window without "WS_VISIBLE" style;
2. In this window, create your dialog. This window is dialog's parent window;
    Thus, initial window is not visible, dialog is not visible also.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best tools for Backup and restore of Wordpress site 6 58
if loop in java 3 174
Smart Camera scanning and reading information 3 126
fizzArray  challenge 1 115
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question