Announcement

Collapse
No announcement yet.

SAFEARRAY / COM Problem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SAFEARRAY / COM Problem

    In the Example Program I get from the CATSSA.Decomposition call the error message "The source series is not defined". So SA.CopyToVariant(CATSSA.Sourceseries) doesn't seem to work.

    In VB Excel I would just write

    DIM Source(1 to N) as double
    set obj = CreateObject("CatSSA.Main")
    ......
    obj.SourceSeries = Source

    The CatSSA Help File is attached. Unfortunately the upload of the catssa.dll file and the Excel worksheet is not supported.
    Attached Files

  • #2

    #COMPILE EXE "C:\PBNST\ZOutput\CSSA.exe"
    #DIM ALL

    ' Generated by: PowerBASIC COM Browser v.2.00.0087
    ' Date & Time : 5/7/2018 at 5:05 AM
    ' Options:
    ' Always use an Interface Prefix : Off
    ' Interface Prefix : Int_
    ' Prefix ProgIDs, ClassIDs... : On
    ' Use ANSI Strings : Off
    ' Use Singular Enumerations : Off
    ' Generate Dispatch Interfaces : Off
    ' Include Parameter Names : On
    ' Use Property Get/Set statements: On
    ' ------------------------------------------------
    ' Library Name: CATSSALib
    ' Library File: C:\Program Files (x86)\CatSSA\CatSSA.dll
    ' Description : CatSSA 1.0 Type Library
    ' GUID : {F5C9168A-2F55-4367-8DF9-6957DCD4D53C}
    ' LCID : 0
    ' Version : 1.0

    ' Version Dependent ProgIDs
    $PROGID_CATSSALib_CatMain1 = "CatSSA.Main.1"

    ' Version Independent ProgIDs
    $PROGID_CATSSALib_CatMain = "CatSSA.Main"

    ' Class Identifiers
    $CLSID_CATSSALib_CatMain = GUID$("{58308A9F-2462-489C-916A-9F421B8A9011}")
    $CLSID_CATSSALib_Event__ICatMainEvents = GUID$("{525A43C5-DC41-4860-9AE0-0D59E80420B2}")

    ' Interface Identifiers
    $IID_CATSSALib_Int__ICatMainEvents = GUID$("{DCC7935F-D623-4B3A-BDC1-9F5B4AA9FCF4}")
    $IID_CATSSALib_ICatMain = GUID$("{E0CA076A-4AE6-47D8-BF0C-FE9B3312924C}")

    ' Interface Name : Int__ICatMainEvents
    ' Description : _ICatMainEvents Interface
    ' ClassID : $CLSID_CATSSALib_Event__ICatMainEvents
    ' ProgID : $PROGID_CATSSALib_CatMain
    ' Version ProgID : $PROGID_CATSSALib_CatMain1
    CLASS Class_Int__ICatMainEvents $CLSID_CATSSALib_Event__ICatMainEvents AS EVENT
    INTERFACE Int__ICatMainEvents $IID_CATSSALib_Int__ICatMainEvents
    INHERIT IDISPATCH

    END INTERFACE
    END CLASS

    ' Interface Name : ICatMain
    ' Description : ICatMain Interface
    ' Class Name : CatMain
    ' ClassID : $CLSID_CATSSALib_CatMain
    ' ProgID : $PROGID_CATSSALib_CatMain
    ' Version ProgID : $PROGID_CATSSALib_CatMain1
    INTERFACE ICatMain $IID_CATSSALib_ICatMain
    INHERIT IDISPATCH

    PROPERTY GET SourceSeries <2> () AS VARIANT
    PROPERTY SET SourceSeries <2> (BYREF IN PB___MIDL__ICatMain0000 AS VARIANT)
    METHOD Decomposition <3> (BYVAL Lag AS LONG, OPT BYVAL Centr AS LONG, OPT BYVAL Prec AS DOUBLE, OPT BYVAL CovarMatr AS _
    LONG, OPT BYVAL SVDMethod AS LONG)
    PROPERTY GET CorrFunc <4> () AS VARIANT
    PROPERTY GET EigenVals <5> () AS VARIANT
    PROPERTY GET EigenVecs <6> () AS VARIANT
    PROPERTY GET PrincipalComps <7> () AS VARIANT
    METHOD Reconstruction <8> ()
    PROPERTY SET SelectedPC <9> (BYVAL Index AS LONG, BYVAL Rhs AS LONG)
    PROPERTY SET SelectedAver <10> (BYVAL Rhs AS LONG)
    PROPERTY GET RecSeries <11> () AS VARIANT
    METHOD Forecast <12> (BYVAL Count AS LONG, OPT BYVAL Start AS LONG, OPT BYVAL PB_Method AS LONG, OPT BYVAL AdjCentr AS _
    LONG, OPT BYVAL UseInitial AS LONG)
    PROPERTY GET ForecastSeries <13> () AS VARIANT
    PROPERTY GET PV <14> () AS VARIANT
    PROPERTY GET DisplayMessages <15> () AS LONG
    PROPERTY SET DisplayMessages <15> (BYVAL pVal AS LONG)
    PROPERTY GET PeriodPairEV <16> (BYVAL Ind1 AS LONG, BYVAL Ind2 AS LONG) AS DOUBLE
    PROPERTY GET PeriodPairPC <17> (BYVAL Ind1 AS LONG, BYVAL Ind2 AS LONG) AS DOUBLE
    PROPERTY GET ForecastSeriesStart <18> () AS VARIANT
    END INTERFACE

    TYPE SafeArrayBound
    NumV AS DWORD
    LB AS LONG
    END TYPE

    %VT_R8 = 5

    FUNCTION PBMAIN () AS LONG

    DIM j AS LONG
    DIM N AS LONG

    LOCAL CATSSA AS ICATMAIN
    LET CATSSA = NEWCOM CLSID $CLSID_CATSSALib_CatMain LIB "C:\PBNST\ZExtDlls\CatSSA.dll"

    IF ISNOTHING(CATSSA) THEN
    MSGBOX "No Object"
    ELSE
    MSGBOX "CATSSA Created"
    END IF

    CATSSA.DisplayMessages = 1

    N = 100

    LOCAL PB AS PowerBounds
    PB.LowBound1 = 1
    PB.Elements1 = N

    LOCAL SA AS IPOWERARRAY
    SA = CLASS "PowerArray"

    SA.Dim(%VT_R8,1,PB)
    DIM Vj AS DOUBLE
    FOR j = SA.LBound(1) TO SA.UBound(1)
    Vj = j + RND() + 3*SIN(2*3.1415*j/20)
    SA.Valueset(Vj,j)
    NEXT j

    SA.CopyToVariant(CATSSA.Sourceseries)

    MSGBOX STR$(OBJRESULT)

    CATSSA.Decomposition(10)

    MSGBOX "CATSSA Period Pair "+STR$(CatSSA.PeriodPairEV(1,2))

    SA.Erase

    END FUNCTION

    Comment


    • #3
      This is a problem with the powerbasic objects and safearrays. You will have to resort to api calls to copy a safe array into a variant. I had something similar years ago.
      So here we are, this is the end.
      But all that dies, is born again.
      - From The Ashes (In This Moment)

      Comment

      Working...
      X