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

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

CLIPPER WNDPRINT()          //  hWnd, hDCDestination, nRow, nCol, nScale
{
   HWND hWnd     = _parni( 1 );
   HDC  hPrinter = _parni( 2 );
   int  iRow     = _parni( 3 );
   int  iCol     = _parni( 4 );
   WORD wScale   = _parni( 5 ) ? _parni( 5 ): 1;
   HDC  hDC      = GetDC( hWnd );
   HDC  hMem     = CreateCompatibleDC( hDC );
   RECT rct;
   HBITMAP hBmp, hOldBmp;

   GetClientRect( hWnd, &rct );
   hBmp    = CreateCompatibleBitmap( hDC, rct.right, rct.bottom );
   hOldBmp = SelectObject( hMem, hBmp );

   BitBlt( hMem, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
   StretchBlt( hPrinter, iRow, iCol, rct.right * wScale, rct.bottom * wScale,
               hMem, 0, 0, rct.right, rct.bottom, SRCCOPY );

   SelectObject( hMem, hOldBmp );
   DeleteObject( hBmp );
   DeleteDC( hMem );
   ReleaseDC( hWnd, hDC );
}

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