Solved

[VC++ 5] Hide Window?

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

766 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