MDIGUI statement

Purpose: The MDIGUI statement specifies that the program is a Multiple Document Interface Graphical User Interface application. Like the GUI statement, MDIGUI provides a ClassName for the program.

As well as the MDIGUI statement, minimal BCX MDIGUI program must have a SUB FORMLOAD ... END SUB section and as well a BEGIN MDIEVENTS ... END MDIEVENTS section.


 Syntax 1:
 MDIGUI "ClassName" [,PIXELS, ICON, ResInt%]

 Syntax 2:

 MDIGUI NOMAIN [,PIXELS, ICON, ResInt%]

 Parameters:

  • "ClassName" A unique string literal name for the program. Every Windows MDIGUI program requires a ClassName. Windows uses the ClassName to distinguish one running program from another.
  • NOMAIN statement specifies that a WinMain function will not be automatically emitted. NOMAIN requires the programmer, at minimum, to provide a WinMain equivalent register a ClassName and provide a message pump. See the MDIGUI NOMAIN section below for more detail.
  • PIXELS [OPTIONAL] parameter indicating that pixels instead of dialog units are to be used in the placement and size arguments dimensioning the control.
  • ICON [OPTIONAL] parameter indicating that an icon is to be loaded as a resource.
  • ResInt% Used with ICON, specifies an integer value to an icon resource type defined in an .rc file or as a BCX_RESOURCE.

Remarks: The MDIGUI "ClassName" statement must be placed at the start of your program. The MDIGUI statement can not be placed inside any SUB, FUNCTION nor within the BEGIN MDIEVENTS ... END MDIEVENTS loop. It must be placed at the module level, the same level at which your directives and global variables are declared.

In a BCX MDIGUI program, expressions must be inside a FUNCTION, SUB or the BEGIN MDIEVENTS...END MDIEVENTS procedure.

MDIGUI NOMAIN statement

Purpose: The MDIGUI NOMAIN statement specifies that a WinMain function will not be automatically emitted. NOMAIN requires, at least, that the programmer provide a WinMain equivalent, register a ClassName and provide a message pump. The MDIGUI NOMAIN statement is similar to the $NOMAIN directive used in console mode programs.


 Syntax:
 MDIGUI NOMAIN [,PIXELS, ICON, ResInt%]

 Parameters:

  • PIXELS [OPTIONAL] parameter indicating that pixels instead of dialog units are to be used in the placement and size arguments dimensioning the control.
  • ICON [OPTIONAL] parameter indicating that an icon is to be loaded as a resource.
  • ResInt% Used with ICON, specifies an integer value to an icon resource type defined in an .rc file or as a BCX_RESOURCE.

Remarks:

In a BCX MDIGUI NOMAIN program, all expressions must be inside a FUNCTION, SUB or the BEGIN EVENTS...END EVENTS procedure.

BCX_WndClass and BCX_GUI_Init

When a BCX MDIGUI NOMAIN program is translated, a WNDCLASSEX structure named BCX_WndClass is created and declared GLOBAL. It is initialized to the default values by the internal BCX translator BCX_INITGUI() procedure and then registered using the internal BCX translator BCX_REGWND procedure. BCX_REGWND checks to see if a window class of the name being registered has already been used and if so does not register it again. It allows 256 different(non case sensitive) window classes to be registered. It also sets the BCX_GUI_INIT variable to TRUE, indicating that the procedure has been run and it will exit without doing anything next time it is called.

See Example 2 below for a complete MDIGUI NOMAIN example.

BCX_MDICLASS statement

Purpose:The BCX_MDICLASS statement is valid only in BCX programs which use the MDIGUI statement. It creates a CLASS on which Multiple Document Interface(MDI) Child Windows can be based. This function should be placed in the SUB FORMLOAD ... END SUB section of the code. Every MDIGUI application needs at least one CLASS for child windows, and it is also possible to create multiple classes if required.


 Syntax:
 BCX_MDICLASS((WNDPROC)MdiChildWndProc, MdiChildWndClass$)

 Parameters:

  • MdiChildWndProc Name of the callback function that the MDI windows of this class will use. The name should be cast to(WNDPROC) as shown.
  • MdiChildWndClass$ User supplied name of the CLASS to create.

Remarks: The BCX_MDICLASS statement does not return a value. See the example under BCX_MDICHILD function.

BCX_MDICLIENT function

Purpose: The BCX_MDICLIENT function is valid only in BCX programs which use the MDIGUI statement. It creates a MDICLIENT window in which the Multiple Document Interface child windows can be displayed. This function should be placed in the SUB FORMLOAD ... END SUB section of the code. Every MDIGUI application needs a MDICLIENT area, and the application will not run if it is omitted.


 Syntax:
 hwndMDIClient = BCX_MDICLIENT(hWnd, Index%)

 Parameters:

  • hwndMDIClient If the function succeeds, it will return a copy of the HANDLE of the MDICLIENT window.
  • hWnd Identifies the window on which the MDI CLIENT is placed.
  • Index% Index of the application menu to attach the list of open child windows.

Remarks: See the example under BCX_MDICHILD function.

BCX_MDICHILD function

Purpose: The BCX_MDICHILD function is valid only in BCX programs which use the MDIGUI statement. It creates a MDICHILD window in the MDICLIENT area.


 Syntax:
 hwndMDIChild = BCX_MDICHILD(ChildTitle$, _
                        MdiChildWndClass$) _
                                  [,Xpos%] _
                                  [,Ypos%] _
                                 [,Width%] _
                                [,Height%] _
                              [,MDIStyle%] _
                             [,MDILparam%])

 Parameters:

  • hwndMDIChild If the function succeeds, it will return the HANDLE of the MDICHILD window created.
  • ChildTitle$ Title of CHILD window created. If no title is given, the window will be given the name untitled.
  • MdiChildWndClass$ The name of the class to base the child window on. This class must have been created with the BCX_MDICLASS function.
  • Xpos% [OPTIONAL] specifies the initial horizontal client coordinate of the MDICHILD window being created relative to the upper-left corner of the parent window's client area. The default argument for this parameter is CW_USEDEFAULT.
  • Ypos% [OPTIONAL] specifies the initial vertical client coordinate of the MDICHILD window being created relative to the upper-left corner of the parent window's client area. The default argument for this parameter is CW_USEDEFAULT.
  • Width% [OPTIONAL] specifies the width, in device units of the MDICHILD window being created. The default argument for this parameter is CW_USEDEFAULT.
  • Height% [OPTIONAL] specifies the height, in device units of the MDICHILD window being created. The default argument for this parameter is CW_USEDEFAULT.
  • MDIStyle% [OPTIONAL] If the MDIStyle% parameter is used, the default Window Style for a BCX_MDICHILD control, 0, is replaced with the value in MDIStyle%. See the MDICREATESTRUCT Structure style parameter in your Win32 SDK or PSDK Reference help for more information about valid MDIStyle values.
  • MDILparam% [OPTIONAL] specifies a value defined by the application.

BEGIN MDICHILDEVENTS ... END MDICHILDEVENTS statements

Purpose: In a MDIGUI multiple-document interface program code that is responsible for monitoring and responding to BCX_MDICHILD child window messages and commands like mouse clicks, button presses, radio controls and so on is placed between BEGIN MDICHILDEVENTS and END MDICHILDEVENTS.


 Syntax :
 BEGIN MDICHILDEVENTS ProcedureName
   ' Messages and Commands
 END MDICHILDEVENTS 

 Parameters:

  • ProcedureName parameter specifying a name for the MDICHILDEVENTS loop. The loop must be named.

Remarks:

The MAIN parameter, optionally used with the END EVENTS and END MDIEVENTS loop terminators, can not be used with the END MDICHILDEVENTS loop terminator.

This BCX code,

 BEGIN MDICHILDEVENTS ProcedureName
   SELECT CASE CBMSG
   CASE WM_LBUTTONDOWN
     SetWindowText(Stat1,"left mouse button down :-(")
 
   CASE WM_LBUTTONUP
     SetWindowText(Stat1,"LEFT MOUSE BUTTON UP   :-)")
   END SELECT
 END MDICHILDEVENTS

translates to

 LRESULT CALLBACK ProcedureName(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
   while(1)
   {
     if(Msg==WM_LBUTTONDOWN)
       {
         SetWindowText(Stat1,"left mouse button down :-(");
         break;
       }
     if(Msg==WM_LBUTTONUP)
       {
         SetWindowText(Stat1,"LEFT MOUSE BUTTON UP   :-)");
       }
     break;
   }
  return DefMDIChildProc(hWnd,Msg,wParam,lParam);
 }

Example 1:

 '----------------------------------------------------------
 
 MDIGUI NOMAIN, PIXELS, ICON, 123
 
 DIM Form1 AS HWND         ' Main window handle
 
 '----------------------------------------------------------
 
 CONST IDM_NEW         = 10
 CONST IDM_OPEN        = 20
 CONST IDM_SAVE        = 30
 CONST IDM_SAVEAS      = 40
 CONST IDM_PRINT       = 50
 CONST IDM_CLOSE       = 70
 CONST IDM_EXIT        = 60
 
 CONST IDM_UNDO        = 100
 CONST IDM_CUT         = 110
 CONST IDM_COPY        = 120
 CONST IDM_PASTE       = 130
 CONST IDM_DEL         = 140
 CONST IDM_SELALL      = 150
 
 CONST IDM_WORDWRAP    = 300
 CONST IDM_FONT        = 310
 
 CONST IDM_CASCADE     = 160
 CONST IDM_TILE        = 170
 CONST IDM_ARRANGE     = 180
 CONST IDM_CLOSEALL    = 190
 
 CONST IDM_HELP        = 200
 CONST IDM_ABOUT       = 210
 
 CONST CBWNDEXTRA      = 12
 
 CONST GWL_HWNDEDIT    = 0
 CONST GWL_EDITCHANGED = 4
 CONST ID_EDIT         = 300
 CONST IDM_FIRSTCHILD  = 400
 CONST ID_MAINMENU     = 500
 
 
 
 '----------------------------------------------------------
 
 FUNCTION WINMAIN()
   RAW hMenu AS HMENU
   'Attach the main menu
   hMenu = LoadMenu(BCX_HINSTANCE , MAKEINTRESOURCE(ID_MAINMENU))
   Form1 = BCX_FrameWnd( "MAINFORM", FrameWndProc, "Mini-Multi-Pad", hMenu, 4)
   ' BCX_MDICLASS takes the name of the callback function
   ' and the name of the class
   BCX_MDICLASS((WNDPROC) MDIChildWndProc, "MdiChildWndClass")
   BCX_MDICHILD("", "MdiChildWndClass", 0, 0, 600, 480, WS_MAXIMIZE)
 
   SHOW(Form1)
 
   FUNCTION = BCX_MDI_MsgPump()
 END FUNCTION
 
 '----------------------------------------------------------
 
 BEGIN MDIEVENTS FrameWndProc
   handle_cmd( IDM_NEW, newChild,0)
   handle_cmd( IDM_OPEN, openChild,0)
   handle_cmd( IDM_SAVE, saveChild,0)
   handle_cmd( IDM_SAVEAS, saveAsChild,0)
   handle_cmd( IDM_FONT, fontChild)
   handle_cmd( IDM_CASCADE, mdiCascade)
   handle_cmd( IDM_TILE, mdiTile)
   handle_cmd( IDM_ARRANGE, mdiArrange)
   handle_cmd( IDM_CLOSEALL, mdiCloseAll)
   handle_cmd( IDM_CLOSE, mdiClose)
   handle_cmd( IDM_ABOUT, mdiAbout)
   handle_cmd( IDM_EXIT, mdiExit)
   handle_msg(WM_QUERYENDSESSION, mdiEndSession,0)
   handle_msg(WM_CLOSE, mdiEndSession,0)
 END MDIEVENTS MAIN
 
 CMDHANDLER saveChild
 RAW hWndChild AS HWND
 RAW hEdit AS HWND
 RAW wintext$
 RAW length
 RAW buffer$ * 10
 hWndChild =(HWND)SendMessage( BCX_hwndMDIClient, WM_MDIGETACTIVE, 0, 0)
 hEdit =(HWND) GetWindowLong(hWndChild, GWL_HWNDEDIT)
 length = GetWindowText( hWndChild, wintext$, SIZEOF(wintext$))
 wintext$ = MID$(wintext$, 1, length)
 ? wintext$
 length = Edit_GetTextLength(hEdit)
 ? length
 REDIM buffer$ * length
 length = Edit_GetText(hEdit,buffer$,SIZEOF(buffer$))
 buffer$ = MID$(buffer$, 1, length)
 ? buffer$
 END Handler
 
 CMDHANDLER saveAsChild
 RAW hWndChild AS HWND
 RAW wintext$
 RAW length
 hWndChild =(HWND)SendMessage( BCX_hwndMDIClient, WM_MDIGETACTIVE, 0, 0)
 length = GetWindowText( hWndChild, wintext$, SIZEOF(wintext$))
 wintext$ = MID$(wintext$, 1, length)
 ? wintext$
 END Handler
 
 MSGHANDLER mdiEndSession
 SendMessage(hWnd,WM_COMMAND,IDM_CLOSEALL,0)
 DestroyWindow( Form1)
 END Handler
 
 CMDHANDLER mdiCascade
 SendMessage(BCX_hwndMDIClient, WM_MDICASCADE, 0, 0)
 END Handler
 
 CMDHANDLER mdiTile
 SendMessage(BCX_hwndMDIClient, WM_MDITILE, 0, 0)
 END Handler
 
 CMDHANDLER mdiArrange
 SendMessage(BCX_hwndMDIClient, WM_MDIICONARRANGE, 0, 0)
 END Handler
 
 CMDHANDLER mdiCloseAll
 EnumChildWindows(BCX_hwndMDIClient,CloseEnumProc,0)
 END Handler
 
 CMDHANDLER mdiClose
 SendMessage((HWND)SendMessage( BCX_hwndMDIClient, WM_MDIGETACTIVE, 0, 0), WM_CLOSE, 0, 0)
 END Handler
 
 CMDHANDLER mdiExit
 SendMessage( Form1, WM_CLOSE, 0, 0)
 END Handler
 
 CMDHANDLER mdiAbout
 MessageBox( hWnd, "Mini-Multi-Pad Editor" + CR$ + _
 "     Vic McClung", "About", 0)
 END Handler
 
 
 CMDHANDLER newChild()
 BCX_MDICHILD("", "MdiChildWndClass", 0, 0, 640, 480, WS_MAXIMIZE)
 END Handler
 
 CMDHANDLER openChild
 RAW hChildWnd AS HWND
 RAW filename$
 RAW hEdit AS HWND
 RAW buffer$ * 10
 filename$ = GETFILENAME$("Open a Text File", "*.txt", 0, hWnd)
 IF filename$ <> "" THEN
   REDIM buffer$ * LOF(filename$)
   buffer$ = LOADFILE$(filename$)
   hChildWnd = BCX_MDICHILD("", "MdiChildWndClass", 0, 0, 640, 480, WS_MAXIMIZE)
   hEdit =(HWND) GetWindowLong(hChildWnd, GWL_HWNDEDIT)
   EDITLOADFILE(hEdit, filename$)
   SendMessage( hChildWnd, WM_SETTEXT, 0, filename$)
 END IF
 END Handler
 
 CMDHANDLER fontChild
 RAW hwndChild AS HWND
 RAW hEdit AS HWND
 hwndChild =(HWND)SendMessage( BCX_hwndMDIClient, WM_MDIGETACTIVE, 0, 0)
 hEdit =(HWND) GetWindowLong(hwndChild, GWL_HWNDEDIT)
 IF BCX_FONTDLG(TRUE, hEdit) THEN
   BCX_SET_FONT(hEdit, BCX_Font.Name$, BCX_Font.Size, _
   BCX_Font.Bold, BCX_Font.Italic, BCX_Font.Underline, _
   BCX_Font.Strikeout)
 END IF
 END Handler
 
 '----------------------------------------------------------
 BEGIN MDICHILDEVENTS MDIChildWndProc
   handle_msg(WM_CREATE,  child_OnCreate)
   handle_msg(WM_SIZE,    child_OnSize)
   handle_cmd( ID_EDIT, edit_OnCommand, 0)
   handle_msg WM_SETFOCUS INLINE "SetFocus((HWND)GetWindowLong(hWnd, GWL_HWNDEDIT))"
   handle_msg WM_CLOSE INLINE "SendMessage(GetParent(hWnd),WM_MDIDESTROY,hWnd,0)"
 END MDICHILDEVENTS
 
 
 MSGHANDLER child_OnCreate
 RAW hWndEdit AS HWND
 RAW Style = WS_CHILD | WS_HSCROLL | WS_VISIBLE | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE
 hWndEdit = BCX_RICHEDIT("", hWnd, ID_EDIT, 0, 0, 0, 0, Style)
 ' Remember the edit control's window handle,
 ' and set the edit changed flag to 0.
 ' You can use this to see if you can close
 ' the child window.
 SetWindowLong(hWnd, GWL_HWNDEDIT,(LONG)hWndEdit);
 SetWindowLong(hWnd, GWL_EDITCHANGED, 0);
 SetFocus(hWndEdit);
 END Handler
 
 MSGHANDLER child_OnSize
 RAW hWndEdit AS HWND
 'Move the edit control to MDI child's size.
 hWndEdit =(HWND)GetWindowLong(hWnd, GWL_HWNDEDIT)
 IF NOT MoveWindow(hWndEdit, 0, 0, LOWORD(lParam),HIWORD(lParam), TRUE) THEN
   MessageBox(NULL,"Could not move window", NULL, 0)
 END IF
 END Handler
 
 MSGHANDLER edit_OnCommand
 RAW hWndEdit AS HWND
 hWndEdit =(HWND)GetWindowLong(hWnd, GWL_HWNDEDIT)
 IF lParam AND LOWORD(wParam) = ID_EDIT THEN
   SELECT CASE HIWORD(wParam)
   CASE EN_UPDATE, EN_CHANGE
     SetWindowLong(hWnd, GWL_EDITCHANGED, 1)
     EXIT FUNCTION
   END SELECT
   EXIT FUNCTION
 END IF
 END Handler
 
 '----------------------------------------------------------
 
 FUNCTION CloseEnumProc(hWnd AS HWND,lParam AS LPARAM) AS BOOL CALLBACK
   ' Check for icon title
   IF(GetWindow(hWnd,GW_OWNER)) THEN
     FUNCTION = TRUE
   END IF
   SendMessage(GetParent(hWnd),WM_MDIRESTORE,(WPARAM) hWnd,0)
   IF NOT SendMessage(hWnd,WM_QUERYENDSESSION,0,0) THEN
     FUNCTION = TRUE
   END IF
   SendMessage(GetParent(hWnd),WM_MDIDESTROY,hWnd,0)
   FUNCTION = TRUE
 END FUNCTION
 
 '----------------------------------------------------------
 
 $BCX_RESOURCE
 
 #define IDM_NEW         10
 #define IDM_OPEN        20
 #define IDM_SAVE        30
 #define IDM_SAVEAS      40
 #define IDM_PRINT       50
 #define IDM_CLOSE       70
 #define IDM_EXIT        60
 
 #define IDM_WORDWRAP    300
 #define IDM_FONT        310
 
 #define IDM_UNDO        100
 #define IDM_CUT         110
 #define IDM_COPY        120
 #define IDM_PASTE       130
 #define IDM_DEL         140
 #define IDM_SELALL      150
 
 #define IDM_CASCADE     160
 #define IDM_TILE        170
 #define IDM_ARRANGE     180
 #define IDM_CLOSEALL    190
 
 #define IDM_HELP        200
 #define IDM_ABOUT       210
 
 #define CBWNDEXTRA      12
 
 #define GWL_HWNDEDIT    0
 #define GWL_EDITCHANGED    4
 #define ID_EDIT         300
 #define IDM_FIRSTCHILD    400
 #define ID_MAINMENU     500
 
 
 #include <windows.h>
 
 123 ICON "bcx.ico"
 
 ID_MAINMENU MENU DISCARDABLE
 
     BEGIN
     POPUP "&File"
         BEGIN
     MENUITEM "&New",        IDM_NEW
         MENUITEM "&Open...",        IDM_OPEN
     MENUITEM "&Save",       IDM_SAVE
     MENUITEM "Save &As...", IDM_SAVEAS
     MENUITEM "&Close",      IDM_CLOSE
         MENUITEM SEPARATOR
     MENUITEM "&Print",      IDM_PRINT
         MENUITEM SEPARATOR
     MENUITEM "E&xit",       IDM_EXIT
         END
     POPUP "&Edit"
     BEGIN
     MENUITEM "&Undo",       IDM_UNDO
         MENUITEM SEPARATOR
     MENUITEM "Cu&t",        IDM_CUT
     MENUITEM "&Copy",       IDM_COPY
     MENUITEM "&Paste",      IDM_PASTE
     MENUITEM "De&lete",     IDM_DEL
         MENUITEM SEPARATOR
     MENUITEM "&Select All", IDM_SELALL
     END
   POPUP "F&ormat"
   BEGIN
     MENUITEM "&Wordwrap",   IDM_WORDWRAP
     MENUITEM "&Font",       IDM_FONT
   END
     POPUP "&Window"
     BEGIN
         MENUITEM "&Cascade",        IDM_CASCADE
     MENUITEM "&Tile",       IDM_TILE
         MENUITEM "Arrange &Icons",    IDM_ARRANGE
     MENUITEM "Close &All",  IDM_CLOSEALL
     END
     POPUP "&Help"
     BEGIN
     MENUITEM "&Help...",    IDM_HELP
     MENUITEM "&About...",   IDM_ABOUT
     END
 END
 
 $BCX_RESOURCE

Example 2:

 '---------------------------------------------------
   MDIGUI "MDIName", PIXELS, ICON, 123
 '---------------------------------------------------
  
  $RESOURCE "$PELLES$\bin\porc.exe"
  
  $COMPILER "$PELLES$\Bin\pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff $FILE$.c"
  
  $LINKER "$PELLES$\Bin\polink _
                      -release _
                 -machine:ix86 _
            -subsystem:windows _
               -OUT:$FILE$.exe _
                    $FILE$.obj "
  
 $BCX_RESOURCE
  #define IDM_NEW           200
  #define IDM_EXIT          201
  #define IDM_WINDOWTILE    202
  #define IDM_WINDOWCASCADE 203
  #define IDM_WINDOWICONS   204
  #define ID_MAINMENU       205
 
 ' 123 ICON "mdigui.ico"
  
  ID_MAINMENU MENU DISCARDABLE
  BEGIN
  POPUP "&File"
  BEGIN
  MENUITEM "&New",          IDM_NEW
  MENUITEM "E&xit",         IDM_EXIT
  END
 
  POPUP "&Window"
  BEGIN
  MENUITEM "&Tile",         IDM_WINDOWTILE
  MENUITEM "&Cascade",      IDM_WINDOWCASCADE
  MENUITEM "Arrange &Icons",IDM_WINDOWICONS
  END
  END
 $BCX_RESOURCE
 
  CONST IDM_NEW           = 200
  CONST IDM_EXIT          = 201
  CONST IDM_WINDOWTILE    = 202
  CONST IDM_WINDOWCASCADE = 203
  CONST IDM_WINDOWICONS   = 204
  CONST ID_MAINMENU       = 205
 
  DIM Form1 AS HWND         ' Main window handle
  DIM hwndMDIClient AS HWND ' Mdi client window handle
   
  SUB FormLoad()
 
  DIM RAW Style AS INTEGER
 
  Style = WS_MINIMIZEBOX BOR _
    WS_CLIPSIBLINGS BOR _
    WS_CLIPCHILDREN BOR _
    WS_MAXIMIZEBOX BOR _
    WS_CAPTION BOR _
    WS_BORDER BOR _
    WS_SYSMENU BOR _
    WS_THICKFRAME
 
  Form1 = BCX_FORM("MDI", 0, 0, 300, 300, Style)
 
  'Attach the main menu
    SetMenu(Form1,LoadMenu(BCX_HINSTANCE , _
    MAKEINTRESOURCE(ID_MAINMENU)))
 
  ' BCX_MDICLASS takes the name of the callback function
    ' and the name of the class
    BCX_MDICLASS((WNDPROC)MdiChildWndProc, "MdiChildWndClass")
 
  ' The second parameter is the index of the main menu
    ' you want to attach "Untitled1"
    hwndMDIClient = BCX_MDICLIENT(Form1, 2)
 
  CENTER(Form1)
  SHOW(Form1)
  END SUB
 
  '---------------------------------------------------
   
  CALLBACK FUNCTION WndProc()
  SELECT CASE Msg
 
    CASE WM_CREATE
 
    CASE WM_COMMAND
 
    SELECT CASE wParam
  
      CASE IDM_NEW
      ' Use a character string if you do not want
        ' the default "untitled%d" title
        ' The second parameter is the name of class
        ' used in BCX_MDICLASS
        BCX_MDICHILD("", "MdiChildWndClass")
 
      CASE IDM_WINDOWTILE
      SendMessage(hwndMDIClient, WM_MDITILE, 0, 0)
 
      CASE IDM_WINDOWCASCADE
      SendMessage(hwndMDIClient, WM_MDICASCADE, 0, 0)
 
      CASE IDM_WINDOWICONS
      SendMessage(hwndMDIClient, WM_MDIICONARRANGE, 0, 0)
 
      CASE IDM_EXIT
      PostMessage(hWnd,WM_CLOSE,0,0)
 
    END SELECT
 
    CASE WM_DESTROY
    PostQuitMessage(0)
 
  END SELECT
 
  FUNCTION = DefFrameProc(hWnd, hwndMDIClient, _
                Msg, wParam, lParam)
  END FUNCTION
 
  '----------------------------------------------------------
   
  CALLBACK FUNCTION MdiChildWndProc()
 
  SELECT CASE Msg
    CASE WM_CREATE
  END SELECT
 
  FUNCTION = DefMDIChildProc(hWnd, Msg, wParam, lParam)
  END FUNCTION