home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / WINHIDE.CMD < prev    next >
OS/2 REXX Batch file  |  1995-04-07  |  1KB  |  51 lines

  1. EXTPROC CEnvi2
  2. /************************************************************
  3.  *** WinHide.cmd - CEnvi program to hide a window by name ***
  4.  ************************************************************/
  5.  
  6. #include <PMdll.lib>
  7.  
  8. #define  NO_ERROR          0     // return code from most successful DosCalls
  9.  
  10. HideWindow(WindowHandle)
  11. {
  12.    #define ORD_WIN32SETWINDOWPOS 875
  13.    #define SWP_HIDE              0x0010
  14.    DynamicLink("PMWIN",ORD_WIN32SETWINDOWPOS,BIT32,CDECL,
  15.                WindowHandle,0,
  16.                0,0,0,0,
  17.                SWP_HIDE);
  18. }
  19.  
  20.  
  21. main(argc,argv)
  22. {
  23.    if ( argc != 2  ||  !strcmp(argv[1],"/?")  ||  !strcmpi(argv[1],"help") ) {
  24.       Instructions();
  25.    } else {
  26.       // build list of all window titles
  27.       SwitchList = WinQuerySwitchList(Info().hab);
  28.       assert( SwitchList != NULL );
  29.       SwitchCount = 1 + GetArraySpan(SwitchList);
  30.       for ( i = 0; i < SwitchCount; i++ ) {
  31.          if ( 0 == WinQuerySwitchEntry(SwitchList[i],SwEntry) ) {
  32.             if ( !stricmp(argv[1],SwEntry.title) ) {
  33.                HideWindow(SwEntry.hwnd);
  34.             }
  35.          }
  36.       }
  37.    }
  38. }
  39.  
  40. Instructions()
  41. {
  42.    printf("\n")
  43.    printf("WinHide - Hide a Window by window title\n")
  44.    printf("\n")
  45.    printf("SYNTAX: WinHide WindowTitle\n")
  46.    printf("\n")
  47.    printf("Where:  WindowTitle - Full Window Title\n")
  48.    printf("\n")
  49. }
  50.  
  51.