home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / NOTITLEB.CMD < prev    next >
OS/2 REXX Batch file  |  1994-10-03  |  4KB  |  120 lines

  1. EXTPROC CEnvi2
  2. // ****************************************
  3. // *** NoTitleB.cmd - Remove elements   ***
  4. // *** ver.1          of the title bar. ***
  5. // ****************************************
  6.  
  7. #include <WinTools.lib>
  8. #include <WinMsg.lib>
  9.  
  10. main(argc,argv)
  11. {
  12.    if ( argc < 3 )
  13.       Instructions();
  14.    else {
  15.       WindowTitle = argv[1];
  16.       WindowHandle = GetWindowHandle(WindowTitle);
  17.  
  18.       AlterTitleBar(WindowHandle,argc-2,argv+2);
  19.    }
  20. }
  21.  
  22. Instructions()
  23. {
  24.    puts(``)
  25.    puts(`NoTitleB - Remove elements of a title bar`)
  26.    puts(``)
  27.    puts(`SYNTAX: NoTitleB <WindowTitle> <Element> [<Element>...]`)
  28.    puts(``)
  29.    puts(`Where: WindowTitle : Current title of window`)
  30.    puts(`       Element : Specific element of window to remove, may be:`)
  31.    puts(`                  TITLE, SYSMENU, MENU, MINMAX`)
  32.    puts(``)
  33.    puts(`Examples: To remove all titlebar elements, do the following:`)
  34.    puts(`            NoTitleB Clock TITLE SYSMENU MENU MINMAX`)
  35.    puts(``)
  36. }
  37.  
  38.  
  39.    #define FCF_TITLEBAR          0x00000001
  40.    #define FCF_SYSMENU           0x00000002
  41.    #define FCF_MENU              0x00000004
  42.    #define FCF_SIZEBORDER        0x00000008
  43.    #define FCF_MINBUTTON         0x00000010
  44.    #define FCF_MAXBUTTON         0x00000020
  45.    #define FCF_MINMAX            0x00000030
  46.    #define FCF_VERTSCROLL        0x00000040
  47.    #define FCF_HORZSCROLL        0x00000080
  48.    #define FCF_DLGBORDER         0x00000100
  49.    #define FCF_BORDER            0x00000200
  50.    #define FCF_SHELLPOSITION     0x00000400
  51.    #define FCF_TASKLIST          0x00000800
  52.    #define FCF_NOBYTEALIGN       0x00001000
  53.    #define FCF_NOMOVEWITHOWNER   0x00002000
  54.    #define FCF_ICON              0x00004000
  55.    #define FCF_ACCELTABLE        0x00008000
  56.    #define FCF_SYSMODAL          0x00010000
  57.    #define FCF_SCREENALIGN       0x00020000
  58.    #define FCF_MOUSEALIGN        0x00040000
  59.    #define FCF_HIDEBUTTON        0x01000000
  60.    #define FCF_HIDEMAX           0x01000020
  61.  
  62.    #define FID_SYSMENU     0x8002
  63.    #define FID_TITLEBAR    0x8003
  64.    #define FID_MINMAX      0x8004
  65.    #define FID_MENU        0x8005
  66.    #define FID_VERTSCROLL  0x8006
  67.    #define FID_HORZSCROLL  0x8007
  68.    #define FID_CLIENT      0x8008
  69.  
  70.  
  71. AlterTitleBar(pHwnd,pCount,pArgs)
  72. {
  73.    AlteredFlag = 0;
  74.    for ( ; pCount; pCount--, pArgs++ ) {
  75.       Setting = pArgs[0];
  76.  
  77.       if ( !stricmp(Setting,"TITLE") ) {
  78.          id = FID_TITLEBAR; cf = FCF_TITLEBAR;
  79.       } else if ( !stricmp(Setting,"SYSMENU") ) {
  80.          id = FID_SYSMENU; cf = FCF_SYSMENU;
  81.       } else if ( !stricmp(Setting,"MENU") ) {
  82.          id = FID_MENU; cf = FCF_MENU;
  83.       } else if ( !stricmp(Setting,"MINMAX") ) {
  84.          id = FID_MINMAX; cf = FCF_MINMAX;
  85.       } else {
  86.          printf("Unrecognized frame element \"%s\"!\a\n",Setting);
  87.          exit(EXIT_FAILURE);
  88.       }
  89.  
  90.       if ( SubHwnd = WinWindowFromID(pHwnd,id) ) {
  91.          // remove this element
  92.          AlteredFlag |= cf;
  93.          // set parent to object (undisplayed)
  94.          #define HWND_OBJECT 2
  95.          WinSetParent(SubHwnd,HWND_OBJECT,False);
  96.       }
  97.    }
  98.  
  99.    if ( AlteredFlag ) {
  100.       // send message that frame has been updated
  101.       #define WM_UPDATEFRAME  0x0042
  102.       WinPostMsg(pHwnd,WM_UPDATEFRAME,AlteredFlag,NULL);
  103.    }
  104. }
  105.  
  106. WinWindowFromID(pParentHwnd,pChildID)
  107. {
  108.    #define ORD_WIN32WINDOWFROMID 899
  109.    return PMDynamicLink("PMWIN",ORD_WIN32WINDOWFROMID,BIT32,CDECL,
  110.                         pParentHwnd,pChildID);
  111. }
  112.  
  113. WinSetParent(pHwnd,pNewParentHwnd,pRedraw)
  114. {
  115.    #define ORD_WIN32SETPARENT 865
  116.    return PMDynamicLink("PMWIN",ORD_WIN32SETPARENT,BIT32,CDECL,
  117.                          pHwnd,pNewParentHwnd,pRedraw);
  118. }
  119.  
  120.