home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / minall.zip / MINALL.C < prev    next >
Text File  |  1996-01-17  |  2KB  |  83 lines

  1. /***************
  2.  *
  3.  *  Minall by Ralph Yozzo
  4.  *      Minimize all windows.
  5.  *      Works best when run from the LaunchPad or an icon.
  6.  *      Sometimes, the Desktop minimizes and sometimes it doesn't. Go figure.
  7.  *
  8.  ***************/
  9.  
  10. #define INCL_WINWINDOWMGR
  11. #define INCL_BASE
  12. #define INCL_BSE
  13. #define INCL_WINWORKPLACE
  14. #define INCL_WINMESSAGEMGR      /* Window Message Functions     */
  15. #define INCL_WINWINDOWMGR       /* Window Manager Functions     */
  16. #define INCL_WINMENUS
  17. #define INCL_WINFRAMEMGR
  18. #define INCL_DOSPROCESS
  19. #define INCL_WINDIALOGS         /* Window Dialog Mgr Functions  */
  20. #define INCL_WINPOINTERS        /* Window Pointer Functions     */
  21. #include <os2.h>
  22.  
  23.  
  24. #include <stdio.h>
  25. #include <conio.h>
  26.  
  27. #define MAXWINDOWS 32
  28.  
  29.  
  30. void main(int argc, char *argv[]);
  31. void main(int argc, char *argv[])
  32. {
  33.  HWND ahwnd[MAXWINDOWS];  /* array of window handles. */
  34.  SWP aSwp[MAXWINDOWS];    /* array of SWP structures. */
  35.  CHAR ClassName[256];
  36.  CHAR ClassName1[256];
  37.  CHAR Title[256];
  38.  HAB hab;
  39.  SWP swp;
  40.  LONG  xcoord,ycoord;
  41.  LONG  i=1;
  42.  HENUM  henum;            /* enumeration handle                   */
  43.  HMQ   hmq;
  44.  BOOL rcb;
  45.  HWND hwndTitle;
  46.  
  47.  
  48.  hab = WinInitialize(0);          /* initialize PM */
  49.  
  50.  hmq = WinCreateMsgQueue(hab, 0); /* create default size queue */
  51.  
  52.  if(argc>1){
  53.      WinMessageBox(HWND_DESKTOP,
  54.          HWND_DESKTOP,              /* client-window handle  */
  55.          "Purpose:  Minimize windows in one fell swoop.\r\r"
  56.          "Usage:    start minall",
  57.          "Minall by Ralph Yozzo",
  58.          0,                         /* message box id        */
  59.          MB_NOICON | MB_OK);        /* icon and button flags */
  60.     WinDestroyMsgQueue(hmq);
  61.     WinTerminate(hab);
  62.     exit(100);
  63.  }
  64.  i=0;
  65.  
  66.  henum=WinBeginEnumWindows
  67.        (HWND_DESKTOP);
  68.  do
  69.  {
  70.         aSwp[i].hwnd = WinGetNextWindow (henum);
  71.         aSwp[i].fl= SWP_MINIMIZE               ;
  72.  
  73.  }
  74.  while((aSwp[i++].hwnd!=NULL) && i < MAXWINDOWS);
  75.  
  76.  WinEndEnumWindows(henum);
  77.  
  78.  WinSetMultWindowPos(hab,aSwp,i-1);
  79.  
  80.  WinDestroyMsgQueue(hmq);
  81.  WinTerminate(hab);
  82. }
  83.