诚心求教,ie中如何向C#编写的activex控件传递参数,急,诚请各位大侠帮忙

wuyule002 2011-10-13 11:43:35
我用c#编写了个activex控件,
然后把这个activex控件嵌入网页text.html中代码如下:
<html>
<body>
< object id="ActiveX" classid="clsid:e64f337c-c713-45c0-a6d4-50a9514b48e6" >
<param name="url" value="aaaaa"/>
</object>
</body>
</html>

我现在想在c#编写的activex控件中获取
test.html<param name="url" value="aaaaa"/>
中传过去的 url 值,即 aaaaa
即 ie中如何向C#编写的activex控件传递参数?
最好给个实例 ,请看好标题 (ie中如何向C#编写的activex控件传递参数)
多谢,多谢

...全文
260 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiongwenqin 2011-10-17
  • 打赏
  • 举报
回复
<html>
<head>
</head>
<body onload="init()">
<form name="form1">
<div>
<%--http:VedioView3.dll#VedioView3.UserControl1--%>
<object id="myActiveX" name="myActiveX" classid="clsid:CFC99A71-4357-47c0-A80C-51A40FB5BA9E" codebase="ActiveX.cab" width=800 height=510>
<param name="Url" value="D:\work\VedioView\VedioView3\bin\Debug\00660.xml"/>

</object>
</div>
</form>
html页面中

<script language = "javascript" type = "text/javascript">
function init(){
var axObj = form1.myActiveX;
axObj.Url("00660.xml");//传参数路径
axObj.getVedioCatalog();
}
</script>
</body>
</html>

ActiveX控件中这样写
private string url
public string Url
{
get{return url};
set{url=value}
}
wuyule002 2011-10-14
  • 打赏
  • 举报
回复
能给个具体的例子吗 我第一次做这个 不太清楚 多谢多谢
classbob 2011-10-14
  • 打赏
  • 举报
回复
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IIEProperty
{
string Url { get; set; }
}

control : IIEProperty
{
public string Url{ get; set; }
}
classbob 2011-10-14
  • 打赏
  • 举报
回复
定义个双向接口,你的控件实现这个接口就可以了啊
wuyule002 2011-10-14
  • 打赏
  • 举报
回复
怎么没人回啊? 自己顶 求高手帮忙
classbob 2011-10-14
  • 打赏
  • 举报
回复
改成
control : IIEProperty
{
private string _url;
public string Url
{
get{return this._url;}
set{this._url = value;}
}
}
classbob 2011-10-14
  • 打赏
  • 举报
回复
你用的VS2005?
classbob 2011-10-14
  • 打赏
  • 举报
回复
我晕,接口中不能定义属性?
wuyule002 2011-10-14
  • 打赏
  • 举报
回复
这样写是错的 接口中不能定义属性 直接报错
classbob 2011-10-14
  • 打赏
  • 举报
回复
不是给写了吗,你的HTML中
<param name="Url" value="aaaaa"/>

控件中:
定义接口
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IIEProperty
{
string Url { get; set; } // HTML的param
}

你的控件实现这个接口
control : IIEProperty
{
public string Url{ get; set; }
}

110,586

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧