I am incorporating a Microsoft IE web browser control as ActiveX control into my CVI GUI. The control is SHDocVw.dll and interface in interest is IWebBrowser2. I just wish to use it to display a webpage with a given URL. The CVI UIR Editor has inserted the control into a panel successfully and ActiveX controller automatically generated driver code (in .fp and .c form). A question came up is the function method Navigate() and Navigate2() requires uses of Variant data types and I am not able to pass in correct data for the method call to succeed. Does anyone know the correct way to call 1) this object to make it work and 2) general rules for handling Variant data types
CVI generated driver code:
----------------------------------------------
HRESULT CVIFUNC SHDocVw_IWebBrowser2Navigate (CAObjHandle objectHandle,
ERRORINFO *errorInfo,
const char *URL, VARIANT flags,
VARIANT targetFrameName,
VARIANT postData, VARIANT headers)
{
HRESULT __result = S_OK;
SHDocVw_IWebBrowser2_Interface * __vtblIFacePtr = 0;
int __didAddRef;
int __errorInfoPresent = 0;
BSTR URL__AutoType = 0;
__caErrChk (CA_CStringToBSTR (URL, &URL__AutoType));
__caErrChk (CA_GetInterfaceFromObjHandle (objectHandle,
&SHDocVw_IID_IWebBrowser2, 0,
&__vtblIFacePtr, &__didAddRef));
__caErrChk (__vtblIFacePtr->lpVtbl->Navigate_ (__vtblIFacePtr,
URL__AutoType, &flags,
&targetFrameName, &postData,
&headers));
Error:
CA_FreeBSTR (URL__AutoType);
if (__vtblIFacePtr && __didAddRef)
__vtblIFacePtr->lpVtbl->Release (__vtblIFacePtr);
CA_FillErrorInfoEx (objectHandle, &SHDocVw_IID_IWebBrowser2, __result,
errorInfo, &__errorInfoPresent);
if (__errorInfoPresent)
__result = DISP_E_EXCEPTION;
return __result;
}
My calling routine:
------------------------
int nStatus, nStatus2;
VARIANT sVar;
const char *pszFlags = NULL ;
const char *pszFrame = NULL ;
const char *pszData = NULL ;
const char *pszHdr = NULL ;
nStatus = SHDocVw_IWebBrowser2Navigate (HELP_PANEL_WEBBROWSER, NULL, "www.yahoo.com", (VARIANT)pszFlags, (VARIANT)pszFrame, (VARIANT)pszData, (VARIANT)pszHdr);