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