Solved

How to Hide a dialog on App startup

Posted on 1998-12-21
8
374 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
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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now