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

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

CLIPPER WNDCENTER()
{
   HWND hWnd    = _parni( 1 );
   HWND hParent = _parni( 2 );
   RECT rctWindow, rctDesktop;
   WORD wLeft, wTop, wWidth, wHeight;

   GetWindowRect( hWnd, &rctWindow );
   GetWindowRect( hParent ? hParent : GetDesktopWindow(), &rctDesktop );

   wWidth  = rctWindow.right - rctWindow.left;
   wHeight = rctWindow.bottom - rctWindow.top;
   wLeft   = ( rctDesktop.right / 2 ) - ( wWidth / 2 );
   wTop    = ( rctDesktop.bottom / 2 ) - ( wHeight / 2 );

   MoveWindow( hWnd, wLeft, wTop, wWidth, wHeight, TRUE );
}

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

CLIPPER SETACTIVEW() // INDOW()   hWnd  --> hWndPrev
{
   _retni( SetActiveWindow( _parni( 1 ) ) );
}

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

CLIPPER SETWINDOWO() // RG()
{
   DWORD dw = SetWindowOrg( _parni( 1 ), _parni( 2 ), _parni( 3 ) );

   _reta( 2 );
   _storni( LOWORD( dw ), -1, 1 );
   _storni( HIWORD( dw ), -1, 2 );
}

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