Solved

[VC++ 5] Hide Window?

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

743 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

14 Experts available now in Live!

Get 1:1 Help Now