home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / isrun01.zip / Class_WindowList.hpp < prev    next >
C/C++ Source or Header  |  1997-10-12  |  3KB  |  89 lines

  1. /*************************************************************************
  2.  
  3.                      Queries the switch list entries
  4.                      -------------------------------
  5.  
  6.  
  7.                  by Stephane Bessette (stephb7@usa.net)
  8.                              Freeware @1997
  9.  
  10.  
  11.  
  12. Class_WindowList
  13.  
  14.  
  15.                                  Example
  16.                                  -------
  17.  
  18. -Create an instance where the search is complete and case sensitive
  19.      Class_WindowList wl;
  20.      or
  21.      Class_WindowList wl( TRUE );
  22.      or
  23.      Class_WindowList wl( TRUE, TRUE );
  24.  
  25. -Create an instance where the search is complete and case insensitive
  26.      Class_WindowList wl( TRUE, FALSE );
  27.  
  28. -Create an instance where the search is partial and case sensitive
  29.      Class_WindowList wl( FALSE );
  30.      or
  31.      Class_WindowList wl( FALSE, TRUE );
  32.  
  33. -Create an instance where the search is partial and case insensitive
  34.      Class_WindowList wl( FALSE, FALSE );
  35.  
  36. -Obtain the number of entries in the switch list
  37.      int nCount = wl.Get_Count();
  38.  
  39. -Determine if a program is in the list
  40.      PSZ pszName = "Desktop";
  41.      if( wl.InList( pszName ) )
  42.           // The program is running
  43.      else
  44.           // The program is not running, or does not have the same name
  45.  
  46. -Query information about a program
  47.      PSZ pszName = "Desktop";
  48.      SWCNTRL swcntrl;
  49.      swcntrl = Get_swcntrl( pszName );
  50.      if( swcntrl.hwnd )
  51.           // We have a valid switch list structure
  52.  
  53. -Enumerate all the switch list entries
  54.      SWCNTRL swcntrl;
  55.      while( Enumerate( swcntrl  )
  56.      {
  57.           // Process the information
  58.           // But do not exit the loop:  it MUST iterate to termination
  59.      }
  60.  
  61. -Tip
  62.      If IsRunning reports that a program is not running and you know
  63.      otherwise enumerate the list of running programs with:  IsRunning -e
  64.      and check whether the program you're looking for is listed
  65.  
  66. *************************************************************************/
  67.  
  68. #ifndef CLASS_WINDOWLIST_HPP
  69. #define CLASS_WINDOWLIST_HPP
  70.  
  71. class Class_WindowList {
  72. public:
  73.      Class_WindowList( BOOL _bCompareFullString = TRUE, BOOL _bCaseSensitive = TRUE );
  74.      ~Class_WindowList();
  75.      //-------------------------------------------------------------------
  76.      int Get_Count();
  77.      BOOL InList( PSZ pszName );
  78.      SWCNTRL Get_swcntrl( PSZ pszName );
  79.      BOOL Enumerate( SWCNTRL &swcntrl );
  80. //************************************************************************
  81. private:
  82.      PSWBLOCK pswblk;// Pointer to information returned
  83.      SWCNTRL swcntrl;// Temporary switch control structure
  84.      BOOL bCaseSensitive;// Should the name comparison be case sensitive?
  85.      BOOL bCompareFullString;// Compare all the characters in the string?
  86. };
  87.  
  88. #endif // CLASS_WINDOWLIST_HPP
  89.