Thread: Tray windows

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    930

    Tray windows

    Im trying to output only the windows opened in the Taskbar.
    I tried to use FindWindow() but apparrently its not the one to use.

    Code:
    #include <windows.h>
    #include <iostream>
    #pragma hdrstop
    #pragma argsused
    
    using namespace std;
    
    BOOL EnumWindowsProc(HWND hTaskbar, long lParam)
    {
          char Buff[255], NameOfClass[255];
          
          hTaskbar = FindWindow(TEXT("Shell_TrayWnd"), NULL); 
    
          GetWindowText(hTaskbar, Buff, 254);
          GetClassName(hTaskbar, NameOfClass, 254);
          cout << "Window Text: " << Buff << "\t"
               << "Class Name: "  << NameOfClass << endl;
    
          return TRUE;
    }
    
    
    int main(int argc, char* argv[])
    {
          EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
          cin.ignore();
          return 0;
    }
    Using Windows 10 with Code Blocks and MingW.

  2. #2

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    930
    Thanks a lot Adeyblue!
    Using Windows 10 with Code Blocks and MingW.

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by adeyblue View Post
    It's not the right (official) method.

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    930
    Would you mind giving a link or an example of the right method?

    Thanks!
    Using Windows 10 with Code Blocks and MingW.

  6. #6
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    This looks pretty good The Old New Thing : Which windows appear in the Alt+Tab list?

    The purpose of this algorithm is to assign the most meaningful representative winow from each cluster of windows related by ownership.
    ACtually that is what adeyblue's link is about.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM