Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Can't think of a title, but please read this atleast - (http://www.programmingforums.org/showthread.php?t=14967)

pcbrainbuster Jan 17th, 2008 3:10 PM

Can't think of a title, but please read this atleast -
 
Sup guys,

How can you tell if a window is IN the taskbar? Please tell me because THIS IS VERY IMPORTANT.

Thanks.

Ancient Dragon Jan 17th, 2008 11:34 PM

Re: Can't think of a title, but please read this atleast -
 
win32 api function IsIconic

Sane Jan 18th, 2008 3:12 AM

Re: Can't think of a title, but please read this atleast -
 
I think Ancient Dragon here should officially have the new title of MSDN. ;)

pcbrainbuster Jan 18th, 2008 3:38 AM

Re: Can't think of a title, but please read this atleast -
 
Actually that will only tell you if the window is minimized, but it doesn't say wheather or not the window is in the taskbar.

Maybe I should tell you more; I'm basically using EnumWindows to enumerate all windows so that I can maximize them(I know this sounds stupid but its a part of a bigger picture), this is the reason why I need to know if a certain window is IN the taskbar...

Ancient Dragon Jan 18th, 2008 7:55 PM

Re: Can't think of a title, but please read this atleast -
 
But all open windows are on the taskbar whether minimized or not. At least they are in Vista and I am pretty sure in XP also. Minimizing a window has no affect on that.

The code below will display all minimized windows
:

  1. #include <windows.h>
  2. #include <iostream>
  3. using namespace std;
  4. size_t count = 0;
  5. BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
  6. {
  7.     ++count;
  8.     if(IsWindowVisible(hwnd) && IsIconic(hwnd))
  9.     {
  10.         char text[255];
  11.         GetWindowText(hwnd, text, 255);
  12.         ShowWindow(hwnd, SW_RESTORE);
  13.         cout << text << "\n";
  14.     }
  15.  
  16.  
  17.     return TRUE;
  18. }
  19.  
  20.  
  21. int main()
  22. {
  23.  
  24.     EnumWindows(EnumWindowsProc, 0);
  25.     cout << "number of windows is " << count << "\n";
  26.     return 0;
  27. }



On my computer I get this output when everything but the VC++ 8.0 IDE are minimized.
Quote:

Can't think of a title, but please read this atleast - - C++ - Windows Internet
Explorer
Inbox - Windows Live Mail
number of windows is 317
Press any key to continue . . .

Sane Jan 18th, 2008 8:14 PM

Re: Can't think of a title, but please read this atleast -
 
Ancient Dragon, I'm confused. Didn't the OP say twice now that he does not want only minimized windows. He wants all of the windows? So when referring in your example, he needed the open window, VC++ 8.0 IDE, to be included in the output as well.

Ancient Dragon Jan 18th, 2008 8:23 PM

Re: Can't think of a title, but please read this atleast -
 
Quote:

Originally Posted by pcbrainbuster (Post 139820)
I'm basically using EnumWindows to enumerate all windows so that I can maximize them

Quote:

Originally Posted by Sane (Post 139856)
Ancient Dragon, I'm confused. Didn't the OP say twice now that he does not want only minimized windows.

As I understand it he only wants minimized windows -- see above quote.

Also please re-read my revised new-and-improved code that you may have missed. The code I posted will restore all minimized windows that have the visible property set. I had to add that because there are several invisible minimized windows which he would NOT want to restore.

After re-reading (again) maybe you're right -- does the op want to maximize all visible windows or just restore the minimized windows ? In either event the code I posted would work with appropriate adjustments.

Sane Jan 18th, 2008 8:36 PM

Re: Can't think of a title, but please read this atleast -
 
I was assuming that he wanted to maximize even the visible windows to their full size, or else he would have said "How do I restore all windows?" I agree, it's amibiguous. But the op should be able to figure out the rest from here.

null_ptr0 Jan 18th, 2008 9:34 PM

Re: Can't think of a title, but please read this atleast -
 
IsIconic(), IsZoomed(), IsVisible() is what I got from a quick search with msdn2.

pcbrainbuster Jan 19th, 2008 10:12 AM

Re: Can't think of a title, but please read this atleast -
 
I have to thanks ALL of you people for your help!

Now I see where I have confused you people, OK let's put the question this way. How would you get an application to see the number of windows in the taskbar? In Acient Dragon's case the program should return 3; because he had 3 windows in the taskbar. If you do plan to do this then there are limitations to the way your going to have to, your not aloud to use the first 2 functions that null_ptr0 listed.

Now you might see how I am stuck...

Optional questions
------------------------
1) What is the variable type "size_t" that was used by Ancient Dragon(he could have used int)?

Thanks.


All times are GMT -5. The time now is 3:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC