MODSTYLE function

Purpose: MODSTYLE modifies the Window Style or Extended Window Style of a window or control.


 Syntax:

 Retval = MODSTYLE(hWnd, _
             [AddStyle%], _
          [RemoveStyle%], _
            [StyleType%]) 

 Parameters:

  • RetVal TRUE if successful, FALSE otherwise
  • hWnd Handle to window or control
  • AddStyle% [OPTIONAL] EITHER Window Styles OR Extended Window Styles to add. Set this parameter to zero if styles are not being added. If a style is being removed with RemoveStyle%, the AddStyle% style must be the same as the style in RemoveStyle%, that is, either Window Style or Extended Window Style. See your Win32 SDK or PSDK Reference help for more information about valid Window Styles and Extended Window Styles.
  • RemoveStyle% [OPTIONAL] EITHER Window Styles OR Extended Window Styles to remove. Set this parameter to zero if styles are not being removed. If a style is being added with AddStyle%, the RemoveStyle% style must be the same as the style in AddStyle%, that is, either Window Style or Extended Window Style. See your Win32 SDK or PSDK Reference help for more information about valid Window Styles and Extended Window Styles.
  • StyleType% OPTIONAL EITHER FALSE for Window Styles OR TRUE for Extended Window Styles. Default value is FALSE indicating that the Window Style StyleType% is being added and/or removed. If a style is being added and removed, the style added must be the same as the style being removed, that is,EITHER a Window Style OR an Extended Window Style.

Remarks:

ModStyle will not change ListBox control styles.

Here is an example to toggle Window Styles WS_MAXIMIZEBOX and WS_MINIMIZEBOX.

 
 GUI  "NoMaxMin"
 
 DIM frmMain AS Control
 DIM button1 AS Control
 GLOBAL Toggle = TRUE
 
 SUB FormLoad
   frmMain = BCX_FORM("My Form", 100, 100, 100, 100)
   button1 = BCX_BUTTON("ModStyle", frmMain, 102, 35, 40, 30, 10)
   SHOW(frmMain)
 END SUB
 
 BEGIN EVENTS
 
   SELECT CASE CBMSG
   CASE WM_COMMAND
     IF wParam = 102 THEN
       Toggle = NOT Toggle
       IF NOT Toggle THEN
         MODSTYLE(frmMain, 0, WS_MAXIMIZEBOX | WS_MINIMIZEBOX, FALSE)
       ELSE
         MODSTYLE(frmMain, WS_MAXIMIZEBOX | WS_MINIMIZEBOX, 0, FALSE)
       END IF
     END IF
   CASE WM_CLOSE
     DestroyWindow(hWnd)
     EXIT FUNCTION
   END SELECT
 END EVENTS