ActiveX Equivalentes de funciones FoxPro en Fivewin

ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Sat Nov 23, 2024 4:16 pm

Hola a todos.

En Fivewin o Harbour existiran las siguientes funciones para accesar una Dll ActiveX
contenidas en el siguiente codigo echo en Fox Pro. De ser asi cuales son los equivalentes ?
Code: Select all  Expand view  RUN

LOCAL oDatabase
LOCAL db
LOCAL tbl
LOCAL freport
LOCAL fr
LOCAL pg
LOCAL mm
LOCAL oPage
LOCAL oTable
LOCAL oDatabase
LOCAL oMemo
LOCAL qry
LOCAL oQuery


freport = Createobject("FastReport.TfrxReport")
* WAIT "Report created" window

fr  = GETINTERFACE(freport, "IfrxReport" )
* WAIT "IfrxReport taken" window

cmp  = GETINTERFACE(freport, "IfrxComponent" )
* WAIT "IfrxComponent '" + cmp.Name + "' taken" window

db = freport.CreateReportObjectEx( freport, "TfrxADODatabase", "Database" )
* cmp  = GETINTERFACE(db, "IfrxComponent" )
* WAIT "ADO database '"+ cmp.Name + "' created" window
oDatabase = GETINTERFACE(db, "IfrxADODatabase" )
oDatabase.ConnectionString = "Provider=VFPOLEDB.1;Data Source=C:\Documents and Settings\alman\My Documents\frx.COM\Studio\Demo\Visual Fox Pro\test\demo2.dbc;Collating Sequence=MACHINE"
oDatabase.LoginPrompt = .F.

pg = freport.CreateReportObjectEx( fr, "TfrxPage", "MyPage" )
oPage = GETINTERFACE(pg, "IfrxReportPage")
oPage.SetDefaults

tbl = freport.CreateReportObjectEx( freport, "TfrxADOTable", "Table" )
oTable = GETINTERFACE(tbl, "IfrxADOTable")
try
oDatabase.Connected = .T.
CATCH
    WAIT "Please, check the database connection string and restart program" window
    cancel
endtry
oTable.TableName = "Students"
oTable.DataBase = oDatabase
*WAIT "ADO table created" window

qry = freport.CreateReportObjectEx( freport, "TfrxADOQuery", "Query1" )
oQuery = GETINTERFACE(qry, "IfrxADOQuery")
oQuery.Query = "select * from master where weight > 50"
oQuery.DataBase = oDatabase

mm = freport.CreateReportObjectEx( pg, "TfrxMemoView", "Memo" )
SetMemoText( mm, "Hello world!!!" )
SetPositionAndSize( mm, 10, 10, 100, 100)
* WAIT "Memo created" window

freport.SelectDataset( .T., oTable )
freport.SelectDataset( .T., oQuery )
freport.DesignReport()

*************************************************************
* This procedure assign memo text
*************************************************************
Procedure SetMemoText
    Parameters obj, Text
    Local component
    Try
        component  = Getinterface(obj, "IfrxMemoView" )
        component.Memo = Text
    Catch To ReportException
        Wait "Unable set memo text due to: " + ReportException.Message Window
    Endtry
Endproc

*************************************************************
* This procedure assign report's object position and size
*************************************************************
Procedure SetPositionAndSize
    Parameters obj, x, Y, Width, Height
    Local component
    Try
        component  = Getinterface(obj, "IfrxComponent" )
        component.Left = x
        component.Top = Y
        component.Width = Width
        component.Height = Height
    Catch To ReportException
        Wait "Unable set object size: " + ReportException.Message Window
    Endtry
Endproc


Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby karinha » Sun Nov 24, 2024 11:20 am

Albeiro, ¿qué quieres hacer? Aprender a utilizar FASTREPORT, ¿es eso?

Igual en Fivewin:

https://sagierp.com.br/devel/fastreport/manual_xHarbour_fastreport.pdf

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Sun Nov 24, 2024 2:35 pm

Karinha,
Albeiro, ¿qué quieres hacer? Aprender a utilizar FASTREPORT, ¿es eso?


No, solo quiero saber si existe la funcion GETINTERFACE
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby karinha » Mon Nov 25, 2024 11:15 am

Si no me equivoco, sólo Visual Fox Pro 7 tiene este comando.

Explica lo que quieres hacer, tal vez haya algo similar en [x]Harbour.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Tue Nov 26, 2024 1:23 pm

Karinha,

Te comento que NO estoy usando la dll de Spirin Sergey, yo estoy probando un ActiveX de fastreport( esto con la finalidad de poder usarla en 64 Bits).
Necesito usar unos eventos para mostrar los datos de un datasetuser, pero el codeblock :bOnEvent de ActiveX Fivewin
no me funciona, lo que veo es que NO reconoce los siguientes eventos , ya que me da error

OnCheckEof
OnFirst
OnNext
OnPrior
OnGetValue

Segun el manual de programacion los metodos trabajan asi :
Code: Select all  Expand view  RUN

TfrxUserDataset

Object for data access. The FastReport Studio uses this object for navigation and reference to the data set fields. The TfrxUserDataSet object allows constructing reports, which are not related to the database data, but do receive data from other sources (for example, array, file, etc.). At the same time, a programmer should provide navigation in such source. (See events below). This object also used in ADO NET wrapper classes to provide communication layer between ADO NET objects and FastReport objects. This object does not have any methods, but have properties and events.

Note for ADO NET programmers: FastReport terminology is slightly differs from ADO NET terminology. In terms of ADO NET the DataSet consist of number of Tables, Views and Relations, but FastReport dataset is analogue to the ADO NET table. Please do not be confused with terminology.

Events

The following events are defined for the TfrxUserDataSet object. These events must be handled by application program to provide data to the report.

interface IfrxUserDataSetEvents : IDispatch
{
HRESULT _stdcall OnGetValue( [in] VARIANT VarName, [out] VARIANT* Value);

This event’s handler must return the Value of the VarName variable.

HRESULT _stdcall OnCheckEOF([out] VARIANT_BOOL* IsEOF);

This event’s handler must return the Eof = True parameter, if the end of the data set is reached.

HRESULT _stdcall OnFirst();

This event’s handler must move the cursor to the beginning of the data set.

HRESULT _stdcall OnNext();

This event’s handler must move the cursor to the next record.

HRESULT _stdcall OnPrior();

This event’s handler must move the cursor to the previous record.

};


 


Vi un ejemplo funcional en Visual Basic 6 y no se ve complicado, pero no lo he podido replicar en Fivewin/Harbour
[url]
https://www.fast-report.com/blogs/maste ... report-vb6
[/url]

El codigo que uso es este
Code: Select all  Expand view  RUN

  // oMaster = CreateObject( "FastReport.TfrxUserDataSet" )
  // oMaster = WIN_OleCreateObject( "FastReport.TfrxUserDataSet" )
  oMaster = THActiveX():New( oWnd, "FastReport.TfrxUserDataSet" )
  oMaster:Fields = "Codigo"+Chr(13)+Chr(10)+"Descripcion"
  oMaster:Name   = "Master_Albeiro"
  oMaster:bOnEvent = {| cEvent, aParams, pParams | FrEvents( cEvent, aParams, pParams, oMaster ) }

  // oMaster:OnFirst(1) <-- Aqui me salta este error :
  //                                   Error description: (DOS Error -2147352570) WINOLE/1009  No exported method: ONFIRST
  //                                   Debe ser porque es un evento y no es una funcion publica
   
  ...

function FrEvents( cEvent, aParams, pParams, oMaster )
  Local cValue := ""
  Local lEof := FALSE
   
  // ? cEvent, aParams, pParams
  // xbrowser(aParams) : si dejo esta linea aqui, muestra los eventos pero en forma numerica
  // no se porque no los muestra como cadena ejm : "OnGetValue"
 
  if cEvent == 201
     __ObjSendMsg( oMaster, "OnGetValue", aParams[1], @cValue )
  elseif cEvent == 202
     __ObjSendMsg( oMaster, "OnCheckEof", @lEof )
  elseif cEvent == 203
     __ObjSendMsg( oMaster, "OnNext")
  elseif cEvent == 204
     // ? 204
  else
         // ? "Evento" + Str(cEvent)
  endif      
   
return Nil
 
 
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby karinha » Tue Nov 26, 2024 2:19 pm

Necesitas FrSystH64.dll, no sé si lo produjo la gente de "-". Entra y contacta con ellos.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Tue Nov 26, 2024 2:34 pm

karinha wrote:Necesitas FrSystH64.dll, no sé si lo produjo la gente de "-". Entra y contacta con ellos.

Regards, saludos.


Karinha, eso no existe.

Revisando en el foro y en los propios fuentes de harbour veo que el manejo de ActiveX en harbour o Fivewin es MUY LIMITADO
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby karinha » Tue Nov 26, 2024 3:36 pm

Albeiro, te pido disculpas, no entiendo que tiene que ver FASTREPORT con ACTIVEX.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Tue Nov 26, 2024 4:25 pm

karinha wrote:Albeiro, te pido disculpas, no entiendo que tiene que ver FASTREPORT con ACTIVEX.

Regards, saludos.


Karinha, no hay problema. Gracias por tu intencion en ayudar
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Antonio Linares » Tue Nov 26, 2024 5:00 pm

Estimado Albeiro,

Vamos a implementar la función GetInterface()

Te voy comentando el proceso...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Antonio Linares » Tue Nov 26, 2024 5:47 pm

Albeiro,

Puedes probar este código ?

freport = Createobject( "FastReport.TfrxReport" )
fr = freport:IfrxReport
MsgInfo( fr:ClassName )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Tue Nov 26, 2024 6:02 pm

Antonio Linares wrote:Estimado Albeiro,

Vamos a implementar la función GetInterface()

Te voy comentando el proceso...


Muchas gracias Antonio

freport = Createobject( "FastReport.TfrxReport" )
fr = freport:IfrxReport
MsgInfo( fr:ClassName )


Probe tu codigo y da error en esta linea ==> fr = freport:IfrxReport

Code: Select all  Expand view  RUN

Path and name: E:\Proyectos\Software\ActiveX_fastreport\fastreport.exe (32 bits)
   Size: 4,913,152 bytes
   Compiler version: Harbour 3.2.0dev (r2403071241)
   FiveWin  version: FWH 24.07
   C compiler version: Borland/Embarcadero C++ 7.7 (32-bit)
   Windows 11 64 Bits, version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 11/26/24, 13:57:06
   Error description: (DOS Error -2147352570) WINOLE/1009  No exported method: IFRXREPORT

Stack Calls
===========
   Called from: hbwin\oleauto.prg => TOLEAUTO:IFRXREPORT( 0 )
   Called from: E:\Proyectos\Software\ActiveX_fastreport\source\main.prg => TESTAL( 115 )
   Called from: E:\Proyectos\Software\ActiveX_fastreport\source\main.prg => (b)MAIN( 38 )
   Called from: .\source\classes\window.prg => TWINDOW:ACTIVATE( 1106 )
   Called from: E:\Proyectos\Software\ActiveX_fastreport\source\main.prg => MAIN( 44 )

 
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Lailton » Tue Nov 26, 2024 6:23 pm

Hola Albeiro,

Poderia informar donde descargar la DLL para hacer pruebas y providenciar un ejemplo a FiveWin?
Regards,
Lailton Fernando Mariano
User avatar
Lailton
 
Posts: 156
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Lailton » Tue Nov 26, 2024 6:33 pm

Please note that Fast Report for COM/ActiveX is now End of Life and is not available for purchase. Product support for existing customers will continue until 31st December 2013.

https://www.componentsource.com/product/fastreport-com-activex
Regards,
Lailton Fernando Mariano
User avatar
Lailton
 
Posts: 156
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Antonio Linares » Tue Nov 26, 2024 11:10 pm

Este es un primer intento de implementación de la función GetInterface() de FoxPro. Aún parece no estar funcionando bien.

Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

    local oShell := CreateObject( "Shell.Application" )
    local oInterface := GetInterface( oShell, "IShellDispatch" )

    ? oInterface:ClassName

return nil    

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>
#include <hbstack.h>

IDispatch * hb_oleItemGet( PHB_ITEM pItem );
PHB_ITEM hb_oleItemPut( PHB_ITEM pItem, IDispatch * pDisp );

static wchar_t * AnsiToWide( const char * szString )
{
   int       iLen;
   wchar_t * szWide;

   iLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, NULL, 0 );
   szWide = ( wchar_t* ) hb_xgrab( iLen * sizeof( wchar_t ) );
   MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, szWide, iLen );
   return szWide;
}

HB_FUNC( GETINTERFACE )
{
   IDispatch * pDisp = hb_oleItemGet( hb_param( 1, HB_IT_ANY ) );
   IID riid;
   IDispatch * pInterface = NULL;
   wchar_t * cIID = AnsiToWide( hb_parc( 2 ) );

   if( IIDFromString( ( LPOLESTR ) cIID, &riid ) == S_OK )
   {
      if( pDisp->lpVtbl->QueryInterface( pDisp, &riid, ( void** ) &pInterface ) == S_OK )
      {
         hb_oleItemPut( hb_stackReturnItem(), pInterface );
      }
   }

   hb_xfree( cIID );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests