Hi
The following are the details for a COM object I want to use with Purebasic. I defined and interface as follows and I am not sure if I need the ReturnValue parameter however if I leave it out I get an invalid memory error in Purebasic. I found I had to add this extra ReturnValue parameter when the COM object returned a string value so I am guessing that it might be needed but I do not know why.
Secondly when I do *loCOM\Execute(@*lnReturnPtr.i) it does return #S_OK.
So how should the Interface be defined and the Execute method called?
It would be helpful if there were more details about COM in the PB documentation since COM is used often in MS Windows and most of their products support it.
Thanks,
Simon
Code:
DEFINE_GUID(CLSID_dCVFPSrvc, $E3238B33, $AC18, $42FD, $BF, $DF, $97, $AD, $09, $73, $75, $4B)
DEFINE_GUID(IID_dCVFPSrvc, $9E0C18A3, $B124, $49E3, $A2, $86, $A5, $A2, $70, $9A, $08, $BE)
Interface dCVFPSrvc Extends IDispatch
DestroyWorkers(ReturnValue.i)
Execute(ReturnValue.i)
ProcessQueue(ReturnValue.i)
StartWorkers(ReturnValue.i)
StopWorkers(ReturnValue.i)
WriteToLog(ReturnValue.i)
EndInterface
Define *loCOM.dCVFPSrvc
Code:
' Version Dependent ProgIDs
$PROGID_dcvfpsrvc_dcvfpsrvcdCVFPSrvc = "dcvfpsrvc.dCVFPSrvc"
' Version Independent ProgIDs
$PROGID_dcvfpsrvc_dcvfpsrvc = "dcvfpsrvc.dCVFPSrvc"
' Class Identifiers
$CLSID_dcvfpsrvc_dcvfpsrvc = GUID$("{E3238B33-AC18-42FD-BFDF-97AD0973754B}")
' Interface Identifiers
$IID_dcvfpsrvc_Idcvfpsrvc = GUID$("{9E0C18A3-B124-49E3-A286-A5A2709A08BE}")
' Interface Name : Idcvfpsrvc
' Description : dcvfpsrvc.dCVFPSrvc
' Class Name : dcvfpsrvc
' ClassID : $CLSID_dcvfpsrvc_dcvfpsrvc
' ProgID : $PROGID_dcvfpsrvc_dcvfpsrvc
' Version ProgID : $PROGID_dcvfpsrvc_dcvfpsrvcdCVFPSrvc
Interface Idcvfpsrvc $IID_dcvfpsrvc_Idcvfpsrvc
Inherit IDispatch
Method destroyworkers <0> () As Variant
Method execute <1> () As Variant
Method ProcessQueue <2> () As Variant
Method startworkers <3> () As Variant
Method stopworkers <4> () As Variant
Method writetolog <5> () As Variant
End Interface