04-11-2013 08:17 AM
HRESULT CVIFUNC OpenSession (CAObjHandle objectHandle,
ERRORINFO *errorInfo,
const char *baseDir)
{
HRESULT __result = S_OK;
CableEyeCtl_ICableEye_Interface * __vtblIFacePtr = 0;
int __didAddRef;
int __errorInfoPresent = 0;
BSTR baseDir__AutoType = 0;
__caErrChk (CA_CStringToBSTR (baseDir, &baseDir__AutoType));
__caErrChk (CA_GetInterfaceFromObjHandle (objectHandle,
&CableEyeCtl_IID_ICableEye, 0,
&__vtblIFacePtr, &__didAddRef));
__caErrChk (__vtblIFacePtr->lpVtbl->OpenSession_ (__vtblIFacePtr,
baseDir__AutoType));
Error:
CA_FreeBSTR (baseDir__AutoType);
if (__vtblIFacePtr && __didAddRef)
__vtblIFacePtr->lpVtbl->Release (__vtblIFacePtr);
CA_FillErrorInfoEx (objectHandle, &CableEyeCtl_IID_ICableEye, __result,
errorInfo, &__errorInfoPresent);
if (__errorInfoPresent)
__result = DISP_E_EXCEPTION;
return __result;
}
I am trying to use the above, however I keep getting errors using __caErrChk (CA_CStringToBSTR (baseDir, &baseDir__AutoType));
This is due to the CA_CStringToBSTR function returning No size info which inturn gives a -ve return value.
I have tried to use CA_CStringToBSTR ("string", &baseDir__AutoType) -- It does the same
What am I doing incorrectly, please help
04-16-2013 06:31 AM
Hi Slten,
Please can you use the function below to convert the error you are getting from the HRESULT function into a meaningful error code.
http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/libref/cvica_getautomationerrorstring/
Please post this here so I can then investigate this further. Any addition information such as which version of CVI you are using would also be useful.
Many thanks,
04-17-2013 06:03 AM
Thank you for the reply
HR= CA_CStringToBSTR ("string", &baseDir__AutoType);
This does give a HR= 0 seems to return no size info..though
The issue with my post has been resolved. I used create Activex Controller instead or create ActiveX Server
04-22-2013 04:09 AM
Ok, thanks for letting me know!