Solved

How to Hide a dialog on App startup

Posted on 1998-12-21
8
381 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
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

617 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