描述:
偶在VC中用 MFC Activex ControlWizard 建立一个ActiveX工程
打开MFC ClassWizard,在Automation点击Add Method建立一个方法
BSTR CSample68Ctrl::ShowMSG()
{
CString strResult;
// TODO: Add your dispatch handler code here
strResult = "123131231";
return strResult.AllocSysString();
}
访问一个字符串
然后用如下页面调用
<HTML>
<script language="javascript">
function aa()
{
alert(document.act.ShowMSG);
}
</script>
<H1> Delphi 6 ActiveX Test Page </H1><p>
You should see your Delphi 6 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
classid="clsid:1C31FE0A-23BC-4735-A393-DA221AFE52F4"
codebase="123.cab#version=1,0,0,0"
width=538
height=350
align=center
hspace=0
vspace=0
id="act"
>
</OBJECT><br>
<input type="button" />
</HTML>
页面按钮单击后总是显示undefined(没有定义)
请各位大侠指点指点,偶想用Activex控件在页面返回指定的字符串,不知道以上做法是否正确?