/*---------------------------------------------------------------------------- | | subclass.c | ---------------------------------------------------------------------------*/ #include "precomp.h" #include "Demo.h" #include "subclass.h" extern HWND hwndRB; /*---------------------------------------------------------------------------- | | MdiClientProc | ---------------------------------------------------------------------------*/ LRESULT CALLBACK MdiClientProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { RECT rc; RECT rband; RECT rStatus; LRESULT val; val = CallWindowProc( (WNDPROC) OldMdiClientProc, hWnd, uMsg, wParam, lParam ); switch (uMsg) { case WM_SIZE: { GetClientRect( GetParent( hWnd ), &rc ); if ( IsWindowVisible( hwndRB ) ) { GetClientRect( hwndRB, &rband ); } else { // Cancel rubber band calculations. rband.bottom = 0; } if ( IsWindowVisible( g_hWndStatus ) ) { GetClientRect( g_hWndStatus, &rStatus ); } else { // Cancel status bar calculations. rStatus.bottom = 0; } MoveWindow( hWnd, 0, rband.bottom + 5, rc.right, rc.bottom - rband.bottom - rStatus.bottom - 5, TRUE ); } break; } return val; } /*---------------------------------------------------------------------------- | | RBProc | ---------------------------------------------------------------------------*/ LRESULT CALLBACK RBProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { LRESULT result; result = CallWindowProc( OldRBandProc, hWnd, uMsg, wParam, lParam ); if ( WM_SIZE == uMsg ) { // Send a resize message to the mdiclient SendMessage( g_hWndClient, WM_SIZE, 0, 0 ); } return result; } /*---------------------------------------------------------------------------- | | ObjectsToolbarProc | ---------------------------------------------------------------------------*/ LRESULT CALLBACK ObjectsToolbarProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if ( WM_RBUTTONDOWN == uMsg ) uMsg = WM_LBUTTONDOWN; else if ( WM_RBUTTONUP == uMsg ) uMsg = WM_LBUTTONUP; return CallWindowProc( (WNDPROC)OldToolbarProc, hWnd, uMsg, wParam, lParam ); } /* EOF ----------------------------------------------------------------------*/