我从网站下载dso1.3的源码,,然后增加自己的接口1、dsoframer.idl中增加
[id(1), helpstring("测试方法!")]
HRESULT GetText([out,retval]BSTR* strValue);
2、在dsoframer.h 中class CDsoFramerControl 增加方法定义:
STDMETHODIMP GetText(BSTR* strValue);
3、在dsofauto.cpp中实现方法:
STDMETHODIMP CDsoFramerControl::GetText(BSTR* strValue)
{
* strValue=SysAllocString(L"cheshi");
return S_OK;
}
然后编译运行在ActiveX控件容器中测试,发现没有该方法,到底是怎么回事???编译无错误
[id(1), helpstring("测试方法!")]
HRESULT GetText([out,retval]BSTR* strValue);
2、在dsoframer.h 中class CDsoFramerControl 增加方法定义:
STDMETHODIMP GetText(BSTR* strValue);
3、在dsofauto.cpp中实现方法:
STDMETHODIMP CDsoFramerControl::GetText(BSTR* strValue)
{
* strValue=SysAllocString(L"cheshi");
return S_OK;
}
然后编译运行在ActiveX控件容器中测试,发现没有该方法,到底是怎么回事???编译无错误
我手头上的API是
3. 完整的上传接口演示
function SaveDoc() {
var returnValue; // 保存页面的返回值
document.all.Dsoframer11.HttpInit(); // 初始化Http引擎
// 添加相应的Post元素
document.all.Dsoframer11.HttpAddPostString("username", WebForm. username.value);
// 添加上传文件
document.all.Dsoframer11.HttpAddPostCurrFile("File ","");
// 提交上传文件
returnValue = document.all.Dsoframer11.HttpPost("../saveDoc.jsp");
if("true" == returnValue){
alert("文件上传成功");
} else {
alert("文件上传失败")
}
} 但是,returnValue = document.all.Dsoframer11.HttpPost("../saveDoc.jsp");并没有访问到saveDoc.jsp,返回是空,不清除是什么问题
用servlet去访问。就OK了。要正常的JAVA的servlet.
function SaveDoc(){
var returnValue; // 保存页面的返回值
document.all.oframe.HttpInit();
document.all.oframe.HttpAddPostString("RecordID","200601022");
document.all.oframe.HttpAddPostString("UserID","李局长");
document.all.oframe.HttpAddPostCurrFile("FileData", "bbb.doc");
returnValue=document.all.oframe.HttpPost("/servlet/SaveDocTest");
alert(returnValue);
}