bcb开发activex 从网页传参数的类型转换

STDMETHODIMP TActiveFormXImpl::showValue(BSTR bstrVal){

  m_VclCtl->edt1->Text =bstrVal;);//传中文

}


STDMETHODIMP TActiveFormXImpl::showValue(VARIANT variVal;){

  m_VclCtl->edt1->Text =V_BSTR(&variVal);//传中文

  m_VclCtl->edt1->Text =variVal.iVal;//传数字

}

d

<HTML>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<H1> C++Builder 6 ActiveX Test Page </H1><p>
You should see your C++Builder 6 forms or controls embedded in the form below.
<HR><center><P>
<script language="javascript"> 
     function testfun(){ 
       myocx.ShowValue("中国"); 
     } 
  </script> 
<OBJECT id="myocx"
	  classid="clsid:35A25B08-0103-4EB4-968D-984248888527"
	  codebase="http://localhost/ActiveFormProj1.htm/ActiveFormProj1.ocx#version=1,0,0,0"
	  width=950
	  height=750
	  align=center
	  hspace=0
	  vspace=0
>
</OBJECT>
<INPUT TYPE="submit" value="test" onclick="testfun();">
</HTML>



原文地址:https://www.cnblogs.com/meetrice/p/1778838.html