Solved

[VC++ 5] Hide Window?

Posted on 1998-11-26
4
385 Views
Last Modified: 2008-03-17
I've written an SDI app, which I needed hidden so I used 'Show_window(SW_HIDE);' to achieve this. I specified this i

m_pMainWnd->ShowWindow(SW_HIDE);
in:
myapp::InitInstance()

This works fine apart from one thing. The window appears for a split second as the program is run.

Could anyone tell me why this is occuring and how I can fix it please?

Thanks.



0
Comment
Question by:fredop
  • 2
4 Comments
 
LVL 2

Expert Comment

by:cyrilbdt
ID: 1178674
I suppose that in your InitInstance is following line
if (!ProcessShellCommand(cmdInfo))
 return FALSE;
Default implementation call OnFileNew where actualy main window is created and SHOWED. so if you override ID_FILE_NEW, there create your main window but not showing it, I think there be no problems.

hope this helps

0
 

Author Comment

by:fredop
ID: 1178675
Cyrilbdt,
I can't seem to get this to work. Could you possibly expand on your answer please?
Thanks.
0
 

Author Comment

by:fredop
ID: 1178676
I have found another way that does work:
before the line:
if (!ProcessShellCommand(cmdInfo))

insert the line:
m_nCmdShow=SW_HIDE;

thanks anyway
0
 
LVL 1

Accepted Solution

by:
sassas081597 earned 100 total points
ID: 1178677
You will not see your window at all in the case you minimize your Window before Show it. In C++Builder you write the following code:
m_pMainWnd->WindowState=wsMinimized;
m_pMainWnd->ShowWindow(SW_HIDE);
This will not solve the problem at all but will hide it - the minimized Window will not flick on screen and the user will not understand that it exists.
I used this code to hide the main Window of the application when the user wrote wrong password in a dinamically created dialog box.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

862 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

23 Experts available now in Live!

Get 1:1 Help Now