Hiding a window.

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Hiding a window.

 
0
  #1
Jun 2nd, 2008
  1. #include <windows.h>
  2. #include <shellapi.h>
  3.  
  4. int main(int argc, char* argv[])
  5. {
  6. ShellExecute(NULL,"open","C:/Windows/System32/calc.exe",NULL,"C:/Windows/System32/",SW_HIDE);
  7. Sleep(1000);
  8. ShowWindow(FindWindow(NULL, "Calculator"), SW_HIDE);
  9. return 0;
  10. }

ok well if i dont have the sleep(1000); there it doesnt hide the window.
i want it to load the window hidden, not hide it once its loaded.

Does anyone have any suggestions.

Note: I have also tried CreateProcess() with the startup params.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,620
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1493
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Hiding a window.

 
0
  #2
Jun 2nd, 2008
Didn't the startup params in CreateProcess() work?
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: Hiding a window.

 
0
  #3
Jun 2nd, 2008
nope......
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,620
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1493
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Hiding a window.

 
0
  #4
Jun 2nd, 2008
It is not possible to start a new GUI program without a window. It only works for console programs.
Last edited by Ancient Dragon; Jun 2nd, 2008 at 1:14 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 979
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 209
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: Hiding a window.

 
0
  #5
Jun 2nd, 2008
Originally Posted by FTProtocol View Post
Does anyone have any suggestions.
Whether or not a given application starts up as hidden depends on how the application is coded. I.e. it may be that calc, for example, ensures that it starts up with a visible window.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: Hiding a window.

 
0
  #6
Jun 4th, 2008
what about for example, internet explorer or firefox?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: Hiding a window.

 
0
  #7
Jun 5th, 2008
i know hiding firefox/internet explorer on startup (ie it doesnt show at all) is possible in VB but why doesn't it work for c++?
Last edited by FTProtocol; Jun 5th, 2008 at 12:41 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC