Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to receive structure from external object?
Message
De
21/02/2005 19:10:26
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00988932
Message ID:
00989073
Vues:
29
>It would be helpfull if you post your code and the sample code that comes with the COM object.

Sure. The following VFP code crashes on the last line where I try to get goBar:
LOCAL lcSymbol
lcSymbol="IBM"

PUBLIC goESignal
goESignal=NEWOBJECT("IESignal.Hooks")
goESignal.SetApplication ("**********") && UserID
goESignal.RequestSymbol(lcSymbol,.T.)

LOCAL lnHistory
lnHistory=goESignal.RequestHistory(lcSymbol,"D", 1, 20, -1, -1)

PUBLIC goBar as IESignal.BarData
goBar=goESignal.GETBAR(lnHistory,1)
The example code from the vendor was in VB. I extracted the following. It runs correctly in VB6:
Dim WithEvents eSignal As IESignal.Hooks
Private Sub cmdRequestHistory_Click()
    
    Dim sLastSymbol As String
    Dim lHistoryHandle As Long
    Dim lLastHistoryCount As Long
  
    Set eSignal = New IESignal.Hooks
    eSignal.SetApplication ("peterbennett")
    
    Dim sSymbol As String
    
    sSymbol = "SIRI"
    
    If lHistoryHandle <> 0 Then
        eSignal.ReleaseHistory lHistoryHandle
        lHistoryHandle = 0
        lLastHistoryCount = 0
    End If
    
    lstHistory.Clear
    
    lHistoryHandle = eSignal.RequestHistory(sSymbol, "D", 2, 20, -1, -1)
    
    Dim BarItem As IESignal.BarData
    BarItem = eSignal.GetBar(lHistoryHandle, -10)
    
    Dim sRet As String
    sRet = Str$(BarItem.dtTime)
    sRet = sRet + ": " + Str$(BarItem.dOpen)
    sRet = sRet + ", " + Str$(BarItem.dHigh)
    sRet = sRet + ", " + Str$(BarItem.dLow)
    sRet = sRet + ", " + Str$(BarItem.dClose)
    Text1.Text = sRet

End Sub
The structure I'm trying to get back is of type IESignal.BarData
which is defined as:
Bar Time             datetime
Open                 double
High                 double
Low                  double
Close                double
Volume               double
Open Interest        double
Bar Flags            bit
Bid                  double
Ask                  double
Trade                double
Thanks
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform