Solved

[VC++ 5] Hide Window?

Posted on 1998-11-26
4
393 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

785 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