ShowWindow(FindWindow

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

ShowWindow(FindWindow

 
0
  #1
Jan 7th, 2009
For the 2 parameters lpClassName and lpWindowName in FindWindow, what do i throw in there to hide all open windows? Is this possible? MSDN makes it sound like if both parameters are null, that will do the trick, but before i test it, i want to make sure that works so i dont have to restart my computer before i reverse the action
Last edited by clutchkiller; Jan 7th, 2009 at 7:39 pm.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,402
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 113
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: ShowWindow(FindWindow

 
0
  #2
Jan 7th, 2009
FindWindow will only return a handle to one window, to do this you will have to loop through all opened applications and hide them one at a time. Try looking up the EnumWindows function, it may provide your solution.
Last edited by William Hemsworth; Jan 7th, 2009 at 8:09 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Re: ShowWindow(FindWindow

 
0
  #3
Jan 7th, 2009
I looked that function up, but im still confused, could you elaborate on a proper method to hide all open windows? Im still a new programmer/windows programmer.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: ShowWindow(FindWindow

 
0
  #4
Jan 8th, 2009
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. std::vector<HWND> vis;
  8.  
  9. bool EnumWindowsProc(HWND hWnd, long lParam)
  10. {
  11.  
  12. if (IsWindowVisible(hWnd)) {
  13. vis.push_back(hWnd);
  14. }
  15.  
  16. return true;
  17. }
  18.  
  19.  
  20. int main()
  21. {
  22. EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
  23.  
  24. for (int i=0; i < (int)vis.size(); i++) {
  25. ShowWindow(vis[i], SW_HIDE);
  26. }
  27.  
  28. Sleep(10000);
  29.  
  30. for (int i=0; i < (int)vis.size(); i++) {
  31. ShowWindow(vis[i], SW_SHOW);
  32. }
  33.  
  34.  
  35. return 0;
  36. }
Just remember to add code which prevents you from hiding the console window (ie: the one that they need in order to type in their password). This program as it is now, simply hides all windows for a short amount of time, and then makes them show up again.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Re: ShowWindow(FindWindow

 
0
  #5
Jan 8th, 2009
thanks comatose, ill dink around with what you just showed me and make it work in the proper context im looking for.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC