Ejemplo n.º 1
0
LRESULT CALLBACK ControlWindowProcedure( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
   PHB_ITEM pBlock = ( PHB_ITEM ) GetProp( hwnd, TEXT( "BLOCKCALLBACK" ) );
   long     lRet;

   if( pBlock )
   {
      if( hb_itemType( pBlock ) == HB_IT_POINTER )
      {
         hb_vmPushSymbol( hb_dynsymSymbol( ( ( PHB_SYMB ) pBlock )->pDynSym ) );
         hb_vmPushNil();
      }
      else
      {
         hb_vmPushEvalSym();
         hb_vmPush( pBlock );
      }
      hb_vmPushNumInt( ( HB_PTRUINT ) hwnd );
      hb_vmPushInteger( msg );
      hb_vmPushNumInt( ( HB_PTRUINT ) wParam );
      hb_vmPushNumInt( ( HB_PTRUINT ) lParam );
      hb_vmDo( 4 );
      lRet = ( long ) hb_parnint( -1 );
      return lRet;
   }
   return DefWindowProc( hwnd, msg, wParam, lParam );
}
Ejemplo n.º 2
0
static char * sz_callhrb_i( char * szName, int iParam1 )
{
   PHB_DYNS pSym_onEvent = hb_dynsymFindName( szName );

   if( pSym_onEvent )
   {
      hb_vmPushSymbol( hb_dynsymSymbol( pSym_onEvent ) );
      hb_vmPushNil();
      hb_vmPushInteger( iParam1 );
      hb_vmDo( 1 );
      return (char *) hb_parc(-1);
   }
   else
      return "";
}
Ejemplo n.º 3
0
static char * sz_callhrb_sz( char * szName, char * szParam1 )
{
   PHB_DYNS pSym_onEvent = hb_dynsymFindName( szName );

   if( pSym_onEvent )
   {
      hb_vmPushSymbol( hb_dynsymSymbol( pSym_onEvent ) );
      hb_vmPushNil();
      hb_vmPushString( szParam1, strlen( szParam1 ) );
      hb_vmDo( 1 );
      return (char *) hb_parc(-1);
   }
   else
      return "";
}
Ejemplo n.º 4
0
static HRESULT STDMETHODCALLTYPE Invoke( IDispatch * lpThis, DISPID dispid, REFIID riid,
                                         LCID lcid, WORD wFlags, DISPPARAMS * pParams,
                                         VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
                                         UINT * puArgErr )
{
   PHB_DYNS pDynSym;
   PHB_ITEM pAction;
   HB_USHORT uiClass = 0;

   HB_SYMBOL_UNUSED( lcid );
   HB_SYMBOL_UNUSED( pExcepInfo );
   HB_SYMBOL_UNUSED( puArgErr );

   if( ! IsEqualIID( riid, HB_ID_REF( IID_NULL ) ) )
      return DISP_E_UNKNOWNINTERFACE;

   pAction = ( ( IHbOleServer * ) lpThis )->pAction;
   if( ! pAction )
      pAction = s_pAction;

   if( pAction )
   {
      HB_BOOL fResult = HB_FALSE;

      if( s_pMsgHash )
      {
         if( ( wFlags & DISPATCH_METHOD ) != 0 ||
             ( ( wFlags & DISPATCH_PROPERTYGET ) != 0 && pParams->cArgs == 0 ) ||
             ( ( wFlags & DISPATCH_PROPERTYPUT ) != 0 && pParams->cArgs == 1 ) )
         {
            fResult = hb_oleDispInvoke( NULL, pAction,
                                        hb_hashGetKeyAt( s_pMsgHash, ( HB_SIZE ) dispid ),
                                        pParams, pVarResult, s_objItemToVariant, uiClass );
         }
      }
      else if( HB_IS_HASH( pAction ) )
      {
         PHB_ITEM pItem;

         if( ( ( IHbOleServer * ) lpThis )->fGuids )
         {
            PHB_ITEM pKey = hb_itemPutNL( hb_stackAllocItem(), ( long ) dispid );
            pItem = hb_hashGetItemPtr( pAction, pKey, 0 );
            hb_stackPop();
         }
         else
            pItem = hb_hashGetValueAt( pAction, ( HB_SIZE ) dispid );

         if( pItem )
         {
            if( HB_IS_EVALITEM( pItem ) )
            {
               if( ( wFlags & DISPATCH_METHOD ) != 0 )
               {
                  PHB_SYMB pSym = hb_itemGetSymbol( pItem );
                  fResult = hb_oleDispInvoke( pSym, pSym ? pAction : pItem, NULL,
                                              pParams, pVarResult,
                                              s_objItemToVariant, uiClass );
               }
            }
            else if( ( wFlags & DISPATCH_PROPERTYGET ) != 0 &&
                     pParams->cArgs == 0 )
            {
               if( pVarResult )
                  hb_oleItemToVariantEx( pVarResult, pItem, s_objItemToVariant );
               fResult = HB_TRUE;
            }
            else if( ( wFlags & DISPATCH_PROPERTYPUT ) != 0 &&
                     pParams->cArgs == 1 )
            {
               hb_oleVariantToItemEx( pItem, &pParams->rgvarg[ 0 ], uiClass );
               fResult = HB_TRUE;
            }
         }
      }
      else if( HB_IS_OBJECT( pAction ) )
      {
         pDynSym = hb_dispIdToDynsym( dispid );
         if( pDynSym && ( wFlags & DISPATCH_PROPERTYPUT ) != 0 )
         {
            if( pParams->cArgs == 1 )
            {
               char szName[ HB_SYMBOL_NAME_LEN + 1 ];
               szName[ 0 ] = '_';
               hb_strncpy( szName + 1, hb_dynsymName( pDynSym ), sizeof( szName ) - 2 );
               pDynSym = hb_dynsymFindName( szName );
            }
            else
               pDynSym = NULL;
         }
         if( pDynSym && hb_objHasMessage( pAction, pDynSym ) )
         {
            fResult = hb_oleDispInvoke( hb_dynsymSymbol( pDynSym ),
                                        pAction, NULL, pParams, pVarResult,
                                        s_objItemToVariant, uiClass );
         }
      }
      if( ! fResult )
         return DISP_E_MEMBERNOTFOUND;
   }
   else
   {
      pDynSym = hb_dispIdToDynsym( dispid );
      if( ! pDynSym )
         return DISP_E_MEMBERNOTFOUND;

      if( wFlags & DISPATCH_PROPERTYPUT )
      {
         if( pParams->cArgs == 1 && hb_dynsymIsMemvar( pDynSym ) )
         {
            PHB_ITEM pItem = hb_stackAllocItem();

            hb_oleVariantToItemEx( pItem, &pParams->rgvarg[ 0 ], uiClass );
            hb_memvarSetValue( hb_dynsymSymbol( pDynSym ), pItem );
            hb_stackPop();
            return S_OK;
         }
         else
            return DISP_E_MEMBERNOTFOUND;
      }
      else if( ( wFlags & DISPATCH_PROPERTYGET ) &&
               pParams->cArgs == 0 && hb_dynsymIsMemvar( pDynSym ) )
      {
         if( pVarResult )
         {
            PHB_ITEM pItem = hb_stackAllocItem();
            hb_memvarGet( pItem, hb_dynsymSymbol( pDynSym ) );
            hb_oleItemToVariantEx( pVarResult, pItem, s_objItemToVariant );
            hb_stackPop();
         }
         return S_OK;
      }
      else if( ( wFlags & DISPATCH_METHOD ) == 0 ||
               ! hb_dynsymIsFunction( pDynSym ) )
         return DISP_E_MEMBERNOTFOUND;
      else if( ! hb_oleDispInvoke( hb_dynsymSymbol( pDynSym ),
                                   NULL, NULL, pParams, pVarResult,
                                   s_objItemToVariant, uiClass ) )
         return DISP_E_MEMBERNOTFOUND;
   }

   return S_OK;
}
Ejemplo n.º 5
0
//------------------------------------------------------------------------------
// IEventHandler's Invoke()
// self is where the action happens
// self function receives events (by their ID number) and distributes the processing
// or them or ignores them
static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *self, DISPID dispid, REFIID riid,
   LCID lcid, WORD wFlags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *pexcepinfo,
   UINT *puArgErr )
{
   PHB_ITEM pItem;
   int iArg, i;
   PHB_ITEM pItemArray[32]; // max 32 parameters?
   PHB_ITEM *pItems;
   ULONG ulRefMask = 0;
   ULONG ulPos;
   PHB_ITEM Key;

   Key = hb_itemNew( NULL );

   // We implement only a "default" interface
   if ( !IsEqualIID( riid, &IID_NULL ) )
      return( DISP_E_UNKNOWNINTERFACE );

   HB_SYMBOL_UNUSED(lcid);
   HB_SYMBOL_UNUSED(wFlags);
   HB_SYMBOL_UNUSED(result);
   HB_SYMBOL_UNUSED(pexcepinfo);
   HB_SYMBOL_UNUSED(puArgErr);

   // delegate work to somewhere else in PRG
   //***************************************

#ifdef __USEHASHEVENTS

   if ( hb_hashScan( ((MyRealIEventHandler* ) self)->pEvents, hb_itemPutNL( Key, dispid ),
      &ulPos ) )
   {
      PHB_ITEM pArray = hb_hashGetValueAt( ((MyRealIEventHandler* ) self)->pEvents, ulPos );

#else

   ulPos = hb_arrayScan( ((MyRealIEventHandler* ) self)->pEvents, hb_itemPutNL( Key, dispid ),
      NULL, NULL, 0
   #ifdef __XHARBOUR__
      , 0
   #endif
      );

   if ( ulPos )
   {
      PHB_ITEM pArray = hb_arrayGetItemPtr( ((MyRealIEventHandler* ) self)->pEventsExec, ulPos );

#endif

      PHB_ITEM pExec  = hb_arrayGetItemPtr( pArray, 01 );

      if ( pExec )
      {
         hb_vmRequestReenter();

         switch ( hb_itemType( pExec ) )
         {
            case HB_IT_BLOCK:
            {
               hb_vmPushSymbol( &hb_symEval );
               hb_vmPush( pExec );
               break;
            }
            case HB_IT_STRING:
            {
               PHB_ITEM pObject = hb_arrayGetItemPtr( pArray, 2 );
               hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName( hb_itemGetCPtr( pExec ) ) ) );

               if ( HB_IS_OBJECT( pObject ) )
                  hb_vmPush( pObject );
               else
                  hb_vmPushNil();
               break;
            }
            case HB_IT_POINTER:
            {
               hb_vmPushSymbol( hb_dynsymSymbol( ( (PHB_SYMB) pExec ) -> pDynSym ) );
               hb_vmPushNil();
               break;
            }
         }

         iArg = params->cArgs;
         for( i = 1; i<= iArg; i++ )
         {
            pItem = hb_itemNew(NULL);
            hb_oleVariantToItem( pItem, &(params->rgvarg[iArg-i]) );
            pItemArray[i-1] = pItem;
            // set bit i
            ulRefMask |= ( 1L << (i-1) );
         }

         if( iArg )
         {
            pItems = pItemArray;
            hb_itemPushList( ulRefMask, iArg, &pItems );
         }

         // execute
         hb_vmDo( (USHORT) iArg );

         // En caso de que los parametros sean pasados por referencia
         for( i=iArg; i > 0; i-- )
         {
            if( ( (&(params->rgvarg[iArg-i]))->n1.n2.vt & VT_BYREF ) == VT_BYREF )
            {
               switch( (&(params->rgvarg[iArg-i]))->n1.n2.vt )
               {
                  //case VT_UI1|VT_BYREF:
                  //   *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pbVal) = va_arg(argList,unsigned char*);  //pItemArray[i-1]
                  //   break;
                  case VT_I2|VT_BYREF:
                     *((&(params->rgvarg[iArg-i]))->n1.n2.n3.piVal)    = (short)          hb_itemGetNI(pItemArray[i-1]);
                     break;
                  case VT_I4|VT_BYREF:
                     *((&(params->rgvarg[iArg-i]))->n1.n2.n3.plVal)    = (long)           hb_itemGetNL(pItemArray[i-1]);
                     break;
                  case VT_R4|VT_BYREF:
                     *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pfltVal)  = (float)          hb_itemGetND(pItemArray[i-1]);
                     break;
                  case VT_R8|VT_BYREF:
                     *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pdblVal)  = (double)         hb_itemGetND(pItemArray[i-1]);
                     break;
                  case VT_BOOL|VT_BYREF:
                     *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pboolVal) =  (VARIANT_BOOL)  ( hb_itemGetL( pItemArray[i-1] ) ? 0xFFFF : 0 );
                     break;
                  //case VT_ERROR|VT_BYREF:
                  //   *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pscode) = va_arg(argList, SCODE*);
                  //   break;
                  case VT_DATE|VT_BYREF:
                     *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pdate)    = (DATE) (double) (hb_itemGetDL(pItemArray[i-1])-2415019 );
                     break;
                  //case VT_CY|VT_BYREF:
                  //   *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pcyVal) = va_arg(argList, CY*);
                  //   break;
                  //case VT_BSTR|VT_BYREF:
                  //   *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pbstrVal = va_arg(argList, BSTR*);
                  //   break;
                  //case VT_UNKNOWN|VT_BYREF:
                  //   pArg->ppunkVal = va_arg(argList, LPUNKNOWN*);
                  //   break;
                  //case VT_DISPATCH|VT_BYREF:
                  //   pArg->ppdispVal = va_arg(argList, LPDISPATCH*);
                  //   break;
               } // EOF switch( (&(params->rgvarg[iArg-i]))->n1.n2.vt )
            } // EOF if( (&(params->rgvarg[iArg-i]))->n1.n2.vt & VT_BYREF == VT_BYREF )
         } // EOF for( i=iArg; i > 0; i-- )

         hb_vmRequestRestore();
      } // EOF if ( pExec )
   }  // EOF If Scan

   hb_itemRelease( Key );

   return S_OK;
}  // EOF invoke

//------------------------------------------------------------------------------
// Here's IEventHandler's VTable. It never changes so we can declare it static
static const IEventHandlerVtbl IEventHandler_Vtbl = {
   QueryInterface,
   AddRef,
   Release,
   GetTypeInfoCount,
   GetTypeInfo,
   GetIDsOfNames,
   Invoke
};

//------------------------------------------------------------------------------
// constructor
// params:
// device_interface        - refers to the interface type of the COM object (whose event we are trying to receive).
// device_event_interface  - indicates the interface type of the outgoing interface supported by the COM object.
//                           This will be the interface that must be implemented by the Sink object.
//                           is essentially derived from IDispatch, our Sink object (self IEventHandler)
//                           is also derived from IDispatch.

typedef IEventHandler device_interface;

// Hash  // SetupConnectionPoint( oOle:hObj, @hSink, hEvents )             -> nError
// Array // SetupConnectionPoint( oOle:hObj, @hSink, aEvents, aExecEvent ) -> nError

HB_FUNC( SETUPCONNECTIONPOINT )
{
   IConnectionPointContainer*  pIConnectionPointContainerTemp = NULL;
   IUnknown*                   pIUnknown = NULL;
   IConnectionPoint*           m_pIConnectionPoint;
   IEnumConnectionPoints*      m_pIEnumConnectionPoints;
   HRESULT                     hr; //,r;
   IID                         rriid;
   register IEventHandler *    selfobj;
   DWORD                       dwCookie = 0;

   device_interface*           pdevice_interface = (device_interface*) HB_PARNL( 1 );
   MyRealIEventHandler*        pThis;

   // Allocate our IEventHandler object (actually a MyRealIEventHandler)
   // intentional misrepresentation of size

   selfobj = ( IEventHandler *) GlobalAlloc( GMEM_FIXED, sizeof( MyRealIEventHandler ) );

   if ( ! selfobj )
   {
      hr = E_OUTOFMEMORY;
   }
   else
   {
      // Store IEventHandler's VTable in the object
      selfobj->lpVtbl = (IEventHandlerVtbl *) &IEventHandler_Vtbl;

      // Increment the reference count so we can call Release() below and
      // it will deallocate only if there is an error with QueryInterface()
      ((MyRealIEventHandler *) selfobj)->count = 0;

      //((MyRealIEventHandler *) selfobj)->device_event_interface_iid = &riid;
      ((MyRealIEventHandler *) selfobj)->device_event_interface_iid = IID_IDispatch;

      // Query self object itself for its IUnknown pointer which will be used
      // later to connect to the Connection Point of the device_interface object.
      hr = selfobj->lpVtbl->QueryInterface( selfobj, &IID_IUnknown, (void**) (void *) &pIUnknown );
      if ( hr == S_OK && pIUnknown )
      {
         // Query the pdevice_interface for its connection point.
         hr = pdevice_interface->lpVtbl->QueryInterface( pdevice_interface,
            &IID_IConnectionPointContainer, (void**) (void *) &pIConnectionPointContainerTemp );

         if ( hr == S_OK && pIConnectionPointContainerTemp )
         {
            // start uncomment
            hr = pIConnectionPointContainerTemp->lpVtbl->EnumConnectionPoints( pIConnectionPointContainerTemp, &m_pIEnumConnectionPoints );

            if ( hr == S_OK && m_pIEnumConnectionPoints )
            {
               do
               {
                  hr = m_pIEnumConnectionPoints->lpVtbl->Next( m_pIEnumConnectionPoints, 1, &m_pIConnectionPoint , NULL);
                  if( hr == S_OK )
                  {
                     if ( m_pIConnectionPoint->lpVtbl->GetConnectionInterface( m_pIConnectionPoint, &rriid ) == S_OK )
                     {
                        break;
                     }
                  }

               } while( hr == S_OK );
               m_pIEnumConnectionPoints->lpVtbl->Release(m_pIEnumConnectionPoints);
            }
            // end uncomment

            //hr = pIConnectionPointContainerTemp ->lpVtbl->FindConnectionPoint(pIConnectionPointContainerTemp ,  &IID_IDispatch, &m_pIConnectionPoint);
            pIConnectionPointContainerTemp->lpVtbl->Release( pIConnectionPointContainerTemp );
            pIConnectionPointContainerTemp = NULL;
         }

         if ( hr == S_OK && m_pIConnectionPoint )
         {
            //OutputDebugString("getting iid");
            //Returns the IID of the outgoing interface managed by self connection point.
            //hr = m_pIConnectionPoint->lpVtbl->GetConnectionInterface(m_pIConnectionPoint, &rriid );
            //OutputDebugString("called");

            if( hr == S_OK )
            {
               ((MyRealIEventHandler *) selfobj)->device_event_interface_iid = rriid;
            }
            else
               OutputDebugString("error getting iid");

            //OutputDebugString("calling advise");
            hr = m_pIConnectionPoint->lpVtbl->Advise( m_pIConnectionPoint, pIUnknown, &dwCookie );
            ((MyRealIEventHandler *) selfobj)->pIConnectionPoint = m_pIConnectionPoint;
            ((MyRealIEventHandler *) selfobj)->dwEventCookie = dwCookie;
         }

         pIUnknown->lpVtbl->Release(pIUnknown);
         pIUnknown = NULL;
      }
   }

   if( selfobj )
   {
      pThis = (MyRealIEventHandler *) selfobj;

#ifndef __USEHASHEVENTS
      pThis->pEventsExec = hb_itemNew( hb_param( 4, HB_IT_ANY ) );
#endif

      pThis->pEvents = hb_itemNew( hb_param( 3, HB_IT_ANY ) );
      HB_STORNL2( (LONG_PTR) pThis, 2 );
   }

   HWNDret( hr );
}

//------------------------------------------------------------------------------
HB_FUNC( SHUTDOWNCONNECTIONPOINT )
{
   MyRealIEventHandler *self = ( MyRealIEventHandler * ) HB_PARNL( 1 );
   if( self->pIConnectionPoint )
   {
      self->pIConnectionPoint->lpVtbl->Unadvise( self->pIConnectionPoint, self->dwEventCookie );
      self->dwEventCookie = 0;
      self->pIConnectionPoint->lpVtbl->Release( self->pIConnectionPoint );
      self->pIConnectionPoint = NULL;
   }
}

//------------------------------------------------------------------------------
HB_FUNC( RELEASEDISPATCH )
{
   IDispatch * pObj;
   pObj = ( IDispatch * ) HWNDparam( 1 );
   pObj->lpVtbl->Release( pObj );
}
Ejemplo n.º 6
0
CLIPPER WBRWPANE( PARAMS ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
                           //   nClrFore, nClrBack, hFont, aJustify, nStyle
                           //   lCellStyle, lFocused ) -> nRowsSkipped
                           //   bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
#endif
{
   HWND hWnd        = ( HWND ) _parnl( 1 );
   HDC hDC          = ( HDC ) _parnl( 2 );
   WORD wRows;
   WORD wLastBottom = 0;
   WORD wRow        = 1;
   WORD wSkipped    = 1;
   PCLIPVAR Self    = _param( 3, -1 );
   PCLIPVAR bLine   = _param( 4, -1 );
   PCLIPVAR pASizes = _param( 5, -1 );
   HFONT hFont      = ( HFONT ) _parnl( 9 );
   HFONT hOldFont;
   BOOL bDestroyDC  = FALSE;
   WORD wHeight ;
   RECT rct, box, client;
   WORD wIndex      = _parni( 6 );
   PCLIPVAR bClrFore = 0, bClrBack = 0;
   COLORREF clrFore = 0;
   COLORREF clrBack = 0;
   HPEN hGrayPen    = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
   HPEN hWhitePen   = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
   #ifndef __HARBOUR__
   BOOL bColBlock   = pASizes->wType & BLOCK;
   #else
   BOOL bColBlock   = hb_itemType( pASizes ) & BLOCK;
   PHB_ITEM aLine = hb_itemNew( NULL );
   #endif
   PCLIPVAR pAJustify = ISARRAY( 10 ) ? _param( 10, -1 ): 0;
   WORD nHeightCtrl ; // by CeSoTech
   WORD nStyle = _parni( 11 );



   if( PCOUNT() > 6 )
   {
      if( ISBLOCK( 7 ) )
         bClrFore = _param( 7, -1 );
      else
         clrFore = _parnl( 7 );
   }

   if( PCOUNT() > 7 )
   {
      if( ISBLOCK( 8 ) )
      {
         bClrBack = _param( 8, -1 );
         _cEval0( bClrBack );
         clrBack = _parnl( -1 );
      }
      else
         clrBack = _parnl( 8 );
   }

   if( ! hDC )
   {
      bDestroyDC = TRUE;
      hDC = GetDC( hWnd );
   }

   if( ! pSkip )
       pSkip = _Get_Sym( "SKIP" );

   if( hFont )
      hOldFont = SelectObject( hDC, hFont );

   /////////////////////////
   // Borremos el Area de la derecha no coubierta
   if ( !bAdjBrowse && !bAdjLastCol )
   {
       GetClientRect( hWnd, &rct );
       SetBkColor( hDC, _parnl( 17 ) ) ;

       for( wIndex=wIndex ; wIndex <= (WORD) _parinfa( 5, NULL); wIndex++ )
       {
            rct.left += _parni( 5, wIndex ) ;
       }

       if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
          rct.left++;

       ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
                   &rct, "", 0, 0 );

       wIndex = _parni( 6 );
       GetClientRect( hWnd, &rct );
   }
   /////////////////////////

   GetClientRect( hWnd, &client );

   nHeightCtrl = client.bottom-client.top ; // by CeSoTech

   wHeight = wLineHeight + 1 ;

   wRows = WBrwRowsC( hWnd, hDC, hFont );

   if( ! bClrFore )
      SetTextColor( hDC, clrFore );
      SetBkColor( hDC, clrBack );

   while( wRow <= wRows && wSkipped == 1 )
   {
      rct.top    = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
                   (wHeight * (wRow-1) ) ;

      rct.bottom = rct.top + wHeight;
      rct.left   = 0;
      rct.right  = client.right;

      #ifndef __HARBOUR__

         _cEval0( bLine );
         _xPushM( _eval );

         if( bClrFore )
         {
            _cEval0( bClrFore );
            SetTextColor( hDC, _parnl( -1 ) );
         }

         if( bClrBack )
         {
            _cEval0( bClrBack );
            SetBkColor( hDC, _parnl( -1 ) );
         }

         if( bColBlock )
            _cEval0( pASizes );

         PaintTheLine( hDC, &rct, wIndex, _tos,
                       ( bColBlock ? _eval : pASizes ),
                       hWhitePen, hGrayPen,
                       bColBlock, pAJustify, 0, FALSE, _parni( 11 ),
                       _parni ( 12 ), _parl( 13 ),
                       ISBLOCK( 14 ) ? _param( 14, -1 ) : 0,   // CeSoTech
                       ISBLOCK( 15 ) ? _param( 15, -1 ) : 0,   // CeSoTech
                       wRow, nHeightCtrl,                      // CeSoTech
                       ISNUM( 16 ) ? _parnl( 16 ) : -1,        // CeSoTech
                       FALSE, FALSE,                           // CeSoTech
                       ISBLOCK( 18 ) ? _param( 18, -1 ) : 0,   // CeSoTech
                       FALSE ) ;

         _tos--;

         _PutSym( pSkip );
         _xPushM( Self );
         _PutQ( 1 );
         _xSend( 1 );

      #else
      {
         // aLine.type = HB_IT_NIL;

         // Esta extension de xHarbour no se puede aplicar en Harbour
         // hb_itemForwardValue( aLine, hb_vmEvalBlock( bLine ) );

         hb_itemCopy( aLine, hb_vmEvalBlock( bLine ) );

         if( bClrFore )
         {
            _cEval0( bClrFore );
            SetTextColor( hDC, _parnl( -1 ) );
         }

         if( bClrBack )
         {
            _cEval0( bClrBack );
            SetBkColor( hDC, _parnl( -1 ) );
         }

         PaintTheLine( hDC, &rct, wIndex, aLine,
                       ( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
                       hWhitePen, hGrayPen,
                       bColBlock, pAJustify, 0, FALSE, _parnl( 11 ),
                       _parnl ( 12 ), _parl( 13 ),
                       ISBLOCK( 14 ) ? _param( 14, -1 ) : 0,   // CeSoTech
                       ISBLOCK( 15 ) ? _param( 15, -1 ) : 0,   // CeSoTech
                       wRow, nHeightCtrl,                      // CeSoTech
                       ISNUM( 16 ) ? _parnl( 16 ) : -1,        // CeSoTech
                       FALSE, FALSE,                           // CeSoTech
                       ISBLOCK( 18 ) ? _param( 18, -1 ) : 0,   // CeSoTech
                       FALSE ) ;

         if ( pSkip )
         {
            hb_vmPushSymbol( hb_dynsymSymbol( pSkip ) );
            hb_vmPush( Self );
            hb_vmPushLong( 1 );
            hb_vmDo( 1 );
         }
      }

      #endif

      wLastBottom = rct.bottom ;
      wSkipped = _parni( -1 );

      if( wSkipped == 1 )
          wRow++;
   }

   ////////////////////////
   // Borremos el Area de Abajo no cubierta
   GetClientRect( hWnd, &rct );
   SetBkColor( hDC, _parnl( 17 ) ) ;

   rct.top = wLastBottom + 1 ;
   if ( wLastBottom == 0 ) // No Mostro Registros
      rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;

   rct.bottom-=  1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;

   if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
       nStyle == 9 || nStyle == 10 || nStyle == 3 )
      rct.top--;

   if ( !bDrawFooters )
      rct.bottom++;


   if ( rct.top < rct.bottom )
   {
      ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
                  &rct, "", 0, 0 );
   }
   ////////////////////////

   DeleteObject( hGrayPen );
   DeleteObject( hWhitePen );

   if( hFont )
      SelectObject( hDC, hOldFont );

   if( bDestroyDC )
       ReleaseDC( hWnd, hDC );


   _retni( wRow );

}