#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>

extern WORD __hInstance;

//----------------------------------------------------------------------------//

long FAR PASCAL _export _WndFrameProc( HWND hWnd, WORD wMsg, WORD wParam,
                                       LONG lParam )
{
   return DefFrameProc( hWnd, GetWindow( hWnd, GW_CHILD ), wMsg, wParam,
                        lParam );
}

//----------------------------------------------------------------------------//

CLIPPER GetFramePr() { _retnl( ( LONG ) _WndFrameProc ); }

//----------------------------------------------------------------------------//

CLIPPER GETMDICHLP() { _retnl( ( LONG ) DefMDIChildProc ); }

//----------------------------------------------------------------------------//

CLIPPER cMdiStruct()
{
   MDICREATESTRUCT mdiCreate;

   if( _parni( 6 ) != CW_USEDEFAULT )
   {
      mdiCreate.szClass = _parc( 1 );
      mdiCreate.szTitle = _parc( 2 );
      mdiCreate.hOwner  = __hInstance;
      mdiCreate.x       = _parni( 4 );
      mdiCreate.y       = _parni( 3 );
      mdiCreate.cx      = _parni( 6 ) - _parni( 4 ) + 1;
      mdiCreate.cy      = _parni( 5 ) - _parni( 3 ) + 1;
      mdiCreate.style   = _parnl( 7 );
      mdiCreate.lParam  = _parnl( 8 );
   }
   else
   {
      mdiCreate.szClass = _parc( 1 );
      mdiCreate.szTitle = _parc( 2 );
      mdiCreate.hOwner  = __hInstance;
      mdiCreate.x       = _parni( 4 );
      mdiCreate.y       = _parni( 3 );
      mdiCreate.cx      = _parni( 6 );
      mdiCreate.cy      = _parni( 5 );
      mdiCreate.style   = _parnl( 7 );
      mdiCreate.lParam  = _parnl( 8 );
   }

   _retclen( ( LPBYTE ) &mdiCreate, sizeof( MDICREATESTRUCT ) );
}

//----------------------------------------------------------------------------//

CLIPPER MDICTRLADJ()  // UST()      // To Adjust oControl to its MdiChild Area
{
   HWND hWnd       = _parni( 1 );
   HWND hCtrl      = _parni( 2 );
   WORD wBarHeight = _parni( 3 );
   RECT rct;

   GetClientRect( hWnd, &rct );

   MoveWindow( hCtrl, -1, -1 + wBarHeight + ( wBarHeight != 0 ),
               rct.right - rct.left + 2,
               rct.bottom - rct.top + 2 - wBarHeight - ( wBarHeight != 0 ),
               FALSE );
}

//----------------------------------------------------------------------------//
