void CSCBMiniDockFrameWnd::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
{
    if ((GetStyle() & MFS_4THICKFRAME) != 0)
    {
        CSizingControlBar* pBar = GetSizingControlBar();
        if (pBar != NULL)
        {
            lpwndpos->flags |= SWP_NOSIZE; // don't size this time
            // prevents flicker
            pBar->m_pDockBar->ModifyStyle(0, WS_CLIPCHILDREN);

            // enable diagonal resizing
            DWORD dwStyleRemove = MFS_4THICKFRAME;
#ifndef _SCB_MINIFRAME_CAPTION
            // remove caption
            dwStyleRemove |= WS_SYSMENU|WS_CAPTION;
#endif
            ModifyStyle(dwStyleRemove, 0);

            DelayRecalcLayout();
            pBar->PostMessage(WM_NCPAINT);
        }
    }

    CMiniFrameWnd::OnWindowPosChanging(lpwndpos);
}
void CExtMiniDockFrameWnd::_ResizingUpdateState(
	const CPoint & point
	)
{
CPoint _pt(point);
	ASSERT( m_nResizingMode != HTNOWHERE );
CExtControlBar * pExtBar = GetControlBarExt();
	ASSERT_VALID( pExtBar );

//	BringWindowToTop();
CRect rcClient, rcWnd, rcWndOrg;
	GetClientRect(rcClient);
	GetWindowRect(rcWnd);
	rcWndOrg = rcWnd;
CSize sizeDiff = rcWnd.Size() - rcClient.Size();
	ASSERT( sizeDiff.cx >= 0 && sizeDiff.cy >= 0 );

	if( sizeDiff.cx < pExtBar->_CalcDesiredMinHW() )
		sizeDiff.cx = pExtBar->_CalcDesiredMinHW();
	if( sizeDiff.cy < pExtBar->_CalcDesiredMinVH() )
		sizeDiff.cy = pExtBar->_CalcDesiredMinVH();

UINT nHit = m_nResizingMode;
bool	bLeft=false, bTop=false, bHorz=false,
		bInvTop=false, bInvLeft=false;
CPoint ptOffsetWnd(0,0);
	if( pExtBar->m_bFixedMode )
	{
		switch( nHit )
		{
		case HTTOPLEFT:
		case HTTOPRIGHT:
			nHit = HTTOP;
		break;
		case HTBOTTOMLEFT:
		case HTBOTTOMRIGHT:
			nHit = HTBOTTOM;
		break;
		} // switch( nHit )
		switch( nHit )
		{
		case HTTOP:
//			if( _pt.y > rcWndOrg.bottom )
//				_pt.y = rcWndOrg.bottom;
			_pt.y =
				rcWndOrg.bottom
				+ rcWndOrg.top - _pt.y;
			nHit = HTBOTTOM;
			bInvLeft = true;
			bInvTop = true;
		break;
		case HTLEFT:
//			if( _pt.x > rcWndOrg.right )
//				_pt.x = rcWndOrg.right;
			_pt.x =
				rcWndOrg.right
				+ rcWndOrg.left - _pt.x;
			nHit = HTRIGHT;
			bInvLeft = true;
			bInvTop = true;
		break;
		} // switch( nHit )
	} // if( pExtBar->m_bFixedMode )
	if( bInvLeft || bInvTop || (!pExtBar->m_bFixedMode) )
	{
		CRect rcWnd;
		CRect rcClient;
		GetWindowRect( &rcWnd );
		GetClientRect( &rcClient );
		ScreenToClient( & rcWnd );
		if( bInvLeft || (!pExtBar->m_bFixedMode) )
			ptOffsetWnd.x =
				abs( rcWnd.left - rcClient.left );
		if( bInvTop || (!pExtBar->m_bFixedMode) )
			ptOffsetWnd.y =
				abs( rcWnd.top - rcClient.top );
	} // if( bInvLeft || bInvTop )

	switch( nHit )
	{
	case HTLEFT:
		bHorz = true;
		rcWnd.left = min(_pt.x,rcWnd.right);
		bLeft = true;
	break;
	case HTRIGHT:
		bHorz = true;
		rcWnd.right = max(_pt.x,rcWnd.left);
	break;
	case HTTOP:
		rcWnd.top = min(_pt.y,rcWnd.bottom);
		bTop = true;
	break;
	case HTTOPLEFT:
		rcWnd.left = min(_pt.x,rcWnd.right);
		rcWnd.top = min(_pt.y,rcWnd.bottom);
		bLeft = true;
		bTop = true;
	break;
	case HTTOPRIGHT:
		rcWnd.right = max(_pt.x,rcWnd.left);
		rcWnd.top = min(_pt.y,rcWnd.bottom);
		bTop = true;
	break;
	case HTBOTTOM:
		rcWnd.bottom = max(_pt.y,rcWnd.top);
	break;
	case HTBOTTOMLEFT:
		rcWnd.left = min(_pt.x,rcWnd.right);
		rcWnd.bottom = max(_pt.y,rcWnd.top);
		bLeft = true;
	break;
	case HTBOTTOMRIGHT:
		rcWnd.right = max(_pt.x,rcWnd.left);
		rcWnd.bottom = max(_pt.y,rcWnd.top);
	break;
	default:
		ASSERT( FALSE );
		return;
	} // switch( nHit )

	if( rcWnd.Width() < sizeDiff.cx )
		rcWnd.right = rcWnd.left + sizeDiff.cx;
	if( rcWnd.Height() < sizeDiff.cy )
		rcWnd.bottom = rcWnd.top + sizeDiff.cy;
	if( rcWnd.right > rcWndOrg.right
		&& bLeft
		)
		rcWnd.OffsetRect(
			rcWndOrg.right - rcWnd.right,
			0
			);
	if( rcWnd.bottom > rcWndOrg.bottom
		&& bTop
		)
		rcWnd.OffsetRect(
			0,
			rcWndOrg.bottom - rcWnd.bottom
			);
//	rcWnd.OffsetRect( ptOffsetWnd );
//	rcWndOrg.OffsetRect( ptOffsetWnd );
	rcClient.SetRect(
		rcWnd.left - (rcClient.left-rcWndOrg.left),
		rcWnd.top - (rcClient.top-rcWndOrg.top),
		rcWnd.right - (rcClient.right-rcWndOrg.right),
		rcWnd.bottom - (rcClient.bottom-rcWndOrg.bottom)
		);
	if( !pExtBar->m_bFixedMode )
	{
		/*
		ASSERT( (GetStyle() & __REMOVED_NONFIXMODE_STYLES) == 0 );
		pExtBar->m_sizeFloat = rcClient.Size();
		MoveWindow( &rcWnd );
		*/

		ASSERT( (GetStyle() & __REMOVED_NONFIXMODE_STYLES) == 0 );
		pExtBar->m_sizeFloated =
			rcWnd.Size()
			-ptOffsetWnd
//			- CSize(
//				afxData.cxBorder2*2,
//				afxData.cyBorder2*2
//				)
			;

		MoveWindow( &rcWnd );
		//ASSERT( pExtBar->m_sizeFloat == rcClient.Size() );
		DelayRecalcLayout();
		SetTimer(3,20,NULL);
		return;
		/*
		CRect rcResultClient;
		pExtBar->GetClientRect( &rcResultClient );
		ASSERT( rcResultClient.Size() == rcClient.Size() );
		*/
	} // if( !pExtBar->m_bFixedMode )
	else
	{
		DWORD dwMode = LM_HORZ|LM_COMMIT;
		LONG nLendth = 0;
		if( bHorz )	
			nLendth = rcClient.Width();
		else
		{
			dwMode |= LM_LENGTHY;
			nLendth = rcClient.Height();
		}
		CSize _size = pExtBar->
			CalcDynamicLayout(
				nLendth, //rcClient.Width(),
				dwMode // LM_HORZ | LM_COMMIT
				);
		pExtBar->m_sizeFloated = _size;
		if( bInvTop )
		{
			ASSERT( rcWnd.top == rcWndOrg.top );
			rcWnd.bottom = m_rcWndResizingStart.bottom;
			rcWnd.top =
				rcWnd.bottom
				- _size.cy // - (_size.cy + sizeDiff.cy)
				- ptOffsetWnd.y
				;
		}
		if( bInvLeft )
		{
			ASSERT( rcWnd.left == rcWndOrg.left );
			rcWnd.right = m_rcWndResizingStart.right;
			rcWnd.left =
				rcWnd.right
				- _size.cx // - (_size.cx + sizeDiff.cx)
				- ptOffsetWnd.x
				;
		}
	} // else from if( !pExtBar->m_bFixedMode )

/*
CSize sizePreCalc = rcClient.Size();
	if( _size != sizePreCalc )
	{
		pExtBar->m_sizeFloat = _size;
		if( bHorz )
			rcWnd.left += _size.cx-sizePreCalc.cx;
		else
			rcWnd.top += _size.cy-sizePreCalc.cy;
	}
*/

	ASSERT( pExtBar->m_pDockSite != NULL );
	ASSERT( pExtBar->m_pDockBar != NULL );
	pExtBar->m_ptFloatHelper = rcWnd.TopLeft();
	pExtBar->m_pDockSite->
		FloatControlBar(
			pExtBar,
			pExtBar->m_ptFloatHelper,
			CBRS_ALIGN_TOP
				| (pExtBar->m_pDockBar->m_dwDockStyle & CBRS_FLOAT_MULTI)
				| CBRS_SIZE_DYNAMIC
			);
	RecalcLayout();
}