Jump to content

Help with interface description with COM object


funkey
 Share

Recommended Posts

Can someone help me with interface description with following COM object please?

; Class Identifiers
Global Const $CLSID_PVSS00COMLib_ComManager = "{A2E83F96-CD50-4679-A541-4CF315A51471}"
; Interface Identifier
Global Const $IID_PVSS00COMLib_IComManager = "{A4FC62C7-368A-44B1-9AEE-DDCE6DB6CE75}"

Global Const $sTag_PVSS00COMLib_IComManager = ""    ;??

#cs
' Interface Name  : IComManager
' Description     : IComManager Interface
' Class Name      : ComManager
' ClassID         : $CLSID_PVSS00COMLib_ComManager
' ProgID          : $PROGID_PVSS00COMLib_ComManager
' Version ProgID  : $PROGID_PVSS00COMLib_ComManager1
INTERFACE IComManager $IID_PVSS00COMLib_IComManager
    INHERIT IDISPATCH

    METHOD Init <1> (BYVAL sCmdLine AS STRING)
    METHOD getLicense <2> (BYREF IN strLicenseApi AS STRING, BYREF iMaxLicense AS LONG)
    PROPERTY GET isConnected <3> () AS LONG
    METHOD dpSet <4> (BYVAL vDpName AS VARIANT, BYVAL vValue AS VARIANT)
    METHOD dpGet <5> (BYVAL vDpName AS VARIANT, BYREF vValue AS VARIANT)
    METHOD dpConnect <6> (BYVAL vIdent AS VARIANT, BYVAL vDpName AS VARIANT, OPT BYVAL boWantAnswer AS LONG)
    METHOD dpDisconnect <7> (BYVAL vDpName AS VARIANT)
    METHOD dpGetPeriod <8> (BYVAL dtFrom AS DOUBLE, BYVAL dtTo AS DOUBLE, BYVAL lCount AS LONG, BYVAL vDpName AS VARIANT, _
        BYREF vValues AS VARIANT, BYREF vTimes AS VARIANT, BYREF vTypes AS VARIANT)
    METHOD dpGetAsynch <9> (BYVAL dtTime AS DOUBLE, BYVAL vDpName AS VARIANT, BYREF vValues AS VARIANT)
    METHOD dpQuery <10> (BYVAL sQuery AS STRING, BYREF avResult AS VARIANT)
    METHOD dpTypes <11> (BYVAL sPattern AS STRING, BYREF asDpType AS DWORD)
    METHOD dpNames <12> (BYVAL sDpPattern AS STRING, BYVAL sDpType AS STRING, BYREF asDpName AS DWORD)
    METHOD dpElementType <13> (BYVAL sDp AS STRING) AS LONG
    METHOD dpGetDescription <14> (BYVAL vDpName AS VARIANT, OPT BYVAL iMode AS LONG) AS VARIANT
    METHOD dpGetAlias <15> (BYVAL vDpName AS VARIANT) AS VARIANT
    METHOD dpGetFormat <16> (BYVAL vDpName AS VARIANT) AS VARIANT
    METHOD dpGetUnit <17> (BYVAL vDpName AS VARIANT) AS VARIANT
END INTERFACE
#ce

Global $oPVSS = ObjCreateInterface($CLSID_PVSS00COMLib_ComManager, $IID_PVSS00COMLib_IComManager, $sTag_PVSS00COMLib_IComManager)

I hope it is possible.

Thanks in advance.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

It says it inherits from IDispach. Does that mean it's dual interfaced? If yes then you don't need interface description.

First check something like this:

$oComManager = ObjCreateInterface($CLSID_PVSS00COMLib_ComManager, $IID_PVSS00COMLib_IComManager)
$oComManager.Init("sCmdLine") ;<- check if error occurs

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Yes, an error ocurs :)

$oPVSS.Init("-currentproj")     ;!>14:25:14 AutoIT3.exe ended.rc:259

I don't know if it is dual interfaced, I am new with COM, sorry.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

I hope this is right, but AutoIt is crashing and do not close correct.

; Class Identifiers
Global Const $CLSID_PVSS00COMLib_ComManager = "{A2E83F96-CD50-4679-A541-4CF315A51471}"
; Interface Identifier
Global Const $IID_PVSS00COMLib_IComManager = "{A4FC62C7-368A-44B1-9AEE-DDCE6DB6CE75}"

Global Const $sTag_PVSS00COMLib_IComManager = "Init none(str);getLicense none(str*;long*)"  ;??

Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")



#cs
' Interface Name  : IComManager
' Description     : IComManager Interface
' Class Name      : ComManager
' ClassID         : $CLSID_PVSS00COMLib_ComManager
' ProgID          : $PROGID_PVSS00COMLib_ComManager
' Version ProgID  : $PROGID_PVSS00COMLib_ComManager1
INTERFACE IComManager $IID_PVSS00COMLib_IComManager
    INHERIT IDISPATCH

    METHOD Init <1> (BYVAL sCmdLine AS STRING)
    METHOD getLicense <2> (BYREF IN strLicenseApi AS STRING, BYREF iMaxLicense AS LONG)
    PROPERTY GET isConnected <3> () AS LONG
    METHOD dpSet <4> (BYVAL vDpName AS VARIANT, BYVAL vValue AS VARIANT)
    METHOD dpGet <5> (BYVAL vDpName AS VARIANT, BYREF vValue AS VARIANT)
    METHOD dpConnect <6> (BYVAL vIdent AS VARIANT, BYVAL vDpName AS VARIANT, OPT BYVAL boWantAnswer AS LONG)
    METHOD dpDisconnect <7> (BYVAL vDpName AS VARIANT)
    METHOD dpGetPeriod <8> (BYVAL dtFrom AS DOUBLE, BYVAL dtTo AS DOUBLE, BYVAL lCount AS LONG, BYVAL vDpName AS VARIANT, _
        BYREF vValues AS VARIANT, BYREF vTimes AS VARIANT, BYREF vTypes AS VARIANT)
    METHOD dpGetAsynch <9> (BYVAL dtTime AS DOUBLE, BYVAL vDpName AS VARIANT, BYREF vValues AS VARIANT)
    METHOD dpQuery <10> (BYVAL sQuery AS STRING, BYREF avResult AS VARIANT)
    METHOD dpTypes <11> (BYVAL sPattern AS STRING, BYREF asDpType AS DWORD)
    METHOD dpNames <12> (BYVAL sDpPattern AS STRING, BYVAL sDpType AS STRING, BYREF asDpName AS DWORD)
    METHOD dpElementType <13> (BYVAL sDp AS STRING) AS LONG
    METHOD dpGetDescription <14> (BYVAL vDpName AS VARIANT, OPT BYVAL iMode AS LONG) AS VARIANT
    METHOD dpGetAlias <15> (BYVAL vDpName AS VARIANT) AS VARIANT
    METHOD dpGetFormat <16> (BYVAL vDpName AS VARIANT) AS VARIANT
    METHOD dpGetUnit <17> (BYVAL vDpName AS VARIANT) AS VARIANT
END INTERFACE
#ce

Global $oPVSS = ObjCreateInterface($CLSID_PVSS00COMLib_ComManager, $IID_PVSS00COMLib_IComManager);, $sTag_PVSS00COMLib_IComManager)


$oPVSS.Init("-currentproj")     ;!>14:25:14 AutoIT3.exe ended.rc:259

Global $strLicenseApi, $iMaxLicense
;~ $oPVSS.getLicense($strLicenseApi, $iMaxLicense)

;~ ConsoleWrite($strLicenseApi & @CR)

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

Here is a description to COM syntax: http://www.powerbasic.com/support/help/pbcc/what_does_an_interface_look_like_.htm

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

It shouldn't crash as far as AutoIt is concerned. Are you sure object is created correctly (outside AutoIt). Whose server is that? Did you built it? Are you the dev? If yes then check one more time if you have done everything correctly making the interface of dual type.

Looks like it inherits from IDispatch but it's not dual or misses implementation for dispatch methods.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...