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

typedef struct
{
   WORD wLeft, wTop, wWidth, wHeight;
   WORD wId;
   LONG lStyle;
} CONTROL;

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

CLIPPER cCtrl2Chr()
{
   HGLOBAL hMem;
   LPBYTE pBuffer;
   LPSTR szText;
   WORD wLen = 14;

   hMem    = GlobalAlloc( GPTR, sizeof( CONTROL ) + _parclen( 7 ) + _parclen( 8 ) + 3 );

   if( hMem )
   {
       pBuffer = GlobalLock( hMem );

       ( ( CONTROL * ) pBuffer )->wLeft   = _parni( 2 );
       ( ( CONTROL * ) pBuffer )->wTop    = _parni( 1 );
       ( ( CONTROL * ) pBuffer )->wWidth  = _parni( 4 ) - _parni( 2 ) + 1;
       ( ( CONTROL * ) pBuffer )->wHeight = _parni( 3 ) - _parni( 1 ) + 1;
       ( ( CONTROL * ) pBuffer )->wId     = _parni( 5 );
       ( ( CONTROL * ) pBuffer )->lStyle  = _parnl( 6 );

       szText = _parc( 7 );
       while( * szText )
          pBuffer[ wLen++ ] = * szText++;
       pBuffer[ wLen++ ] = 0;

       szText = _parc( 8 );
       while( * szText )
          pBuffer[ wLen++ ] = * szText++;
       pBuffer[ wLen++ ]= 0;
       pBuffer[ wLen++ ]= 0;

       _retclen( pBuffer, wLen );

       GlobalUnlock( hMem );
       GlobalFree( hMem );
   }
   else
      _retc("");
}

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