能向ActiveForm传递参数吗?(50分)

  • 主题发起人 wx_zhang
  • 开始时间
W

wx_zhang

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在要在页面中调用ActiveForm,能将页面的某些信息传入吗?在ActiveForm中怎么接受数据?

最好有实际的例子
 
用消息。
在你的Activeform中定义一个消息处理函数,用于接收别的页面收过来的消息。
 
具体一点,
我也很想知道
 
<OBJECT
classid="clsid:94542F25-C1D8-417A-9A65-464D2C65BB91"
codebase="http://210.47.16.72/DirectShowPro.inf"
width=688
height=420
align=center
hspace=0
vspace=0
>
<PARAM NAME="ServerName" VALUE="rise">
</OBJECT>

你可以自己加入一个属性,然后按上面方法进行设置! 如果有什么问题,欢迎来信!
minikiller@sina.com
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html
charset=gb2312">
<title>New Page 1</title>
<script language="JavaScript">
<!--
function Showmsg() {
document.all["txtNow"].value = Ax1.FNow;
document.all["txtDate"].value = Ax1.FDate;
document.all["txtTime"].value = Ax1.FTime;

var now = new Date();
var year = now.getYear();
var month = now.getMonth()+1;
var date = now.getDate();
var datestr = year+"-"+month+"-"+date;
document.all["txtDateTime"].value = datestr;
}

function SetCaption(){
Ax1.lblCaption = "SetCaption";
Ax1.FCaption = "FCaption";
}

function SetParam(){
Ax1.PassParam("1111", "2222", "string", "127");
}

function Clear(){
Ax1.Clear();
}

function GetParam(){
var pa1;
var pa2;
Ax1.OutParam(pa1, pa2);
document.all["txtParam1"].value = pa1;
document.all["txtParam2"].value = pa2;
}
//-->
</script>
</head>

<body onload="Showmsg()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" rowspan="2">
<object classid="clsid:97BA702A-E192-4ADE-804C-F3B05B833ADA"
name="Ax1"
width="394"
height="256">
<param name="ButtonCaption" value="ButtonCaption">
<param name="btnCaption" value="btnCaption">
<param name="lblCaption" value="lblCaption">
<param name="FCaption" value="FCaption">
<param name="AxBorderStyle" value="0">
</object>
</td>
<td valign="top" align="center" bgcolor="#CCCC00">
<input type="text" name="txtNow" size="50">
<br>
<input type="text" name="txtDate" size="50">
<br>
<input type="text" name="txtTime" size="50">
<br>
<input type="text" name="txtDateTime" size="50">
<br>
<input type="button" name="B1" value="GetProperty" onClick="Showmsg()">
</td>
</tr>
<tr>
<td valign="top" align="center" bgcolor="#669900">
<input type="text" name="txtParam1" size="50">
<br>
<input type="text" name="txtParam2" size="50">
<br>
<input type="button" name="B2" value="GetParam" onClick="GetParam()">
</td>
</tr>
<tr align="center" bgcolor="#009999">
<td colspan="2">
<input type="button" value="SetCaption" name="B3" onClick="SetCaption()">
<input type="button" value="SetParam" name="B4" onClick="SetParam()">
<input type="button" value="Clear" name="B5" onClick="Clear()">
</td>
</tr>
</table>
</body>
</html>
 
将网页和ActiveForm的OCX方在同一个路径下
网页如下:
<HTML>
<H1> Delphi 5 ActiveX Test Page </H1><p>
You should see your Delphi 5 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
classid="clsid:11869FE4-128E-4E73-9246-4FB2CA8D323F"
id="test" name="test"
codebase="/Project1.ocx#version=1,0,0,0"
width=181
height=87
align=center
hspace=0
vspace=0
>
</OBJECT>
</HTML>
<script language=vbscript>
function window_onload()
test.hello ="hello"
//.hello 是ActiveForm里的一个外露的属性
end function
</script>
如果网页和OCX不在同一路径下,则codebase处要
指明相对路径,
 
在ActiveForm的程序里应该怎么写才能得到页面传过来的参数啊?
 
做起来还有一些麻烦
我已经解决了这个问题,做了一个例子,需要可以发email给我,
 
在自动生成的ActiveFormProj1_TLB.pas的页面上IActiveFormX上单击右键添加method或property即可
 
打开工程,选定ActiveFormProj1.pas,在编辑中的最后一项是添加界面,加入需要接口的属性、函数或方法就可以了
 
我也想要!可以发个例子给我吗?
我给50分:)
taifeng888@163.net
 
me:xt_zhou@sohu.com
 
ACTIVEFORM 与一个COM 是一样的呀,用设置属性后,传给他就可以了。用JAVASCRIPT呀VBSCRIPT什么都应该可以呀。
 
wsmjy : 可以给我一个例子看看吗?

wxl@estarsh.com
 
我也要。wangzhi8@21cn.com
 
同意楼上
我一直也是用和wangzhi2一样的方法来处理这个问题,
添加到ActiveXForm中的属性有读值Get_MyIP和写值Set_MyIP两个函数,就在这两个函数完
成读写。
我尝试了很久,就是没有办法直接使用添加进去的属性如MyIP,只能通过读写函数将值赋给全局变量
不知道wsmjy是不是通过全局变量来做的
如果不是,非常希望能给我也发一个例子,zszws@jlonline.com,非常感谢


 
虽然问题解决了,并且也很简单,但总觉得冤枉,觉得不服气。为了读取一个网址参数值,既要定义MyIP属性,又要定义全局变量v。通过MyIP属性接收网址参数,在写MyIP属性的事件中再将网址参数值传给全局变量v。如果不定义全局变量v,想直接读取MyIP属性值,能解决问题吗?
 
你把MYIP的FLAG页中的HIDDEN选中,那么MYIP:PORERPTY就是PUBLIC了,而你也可以看到所有申明为PUBLIC的PROPERTY全是全局调用的,你可以试验一下,DELPHI中的属性在本类中就可以定义为全局私有保护三类,对外提供接口访问则要到PUBLISHED中申明。
 
<HTML>
<HEAD>

<BODY>
<SCRIPT LANGUAGE="VBScript">
<!--
SUB Window_Onload
r.serverPath = "http://HFGHFGHFG/test/data/"
r.Login "hfg","dd"

r.ClearQueryId()
r.AddQueryid("SH.cx7.20030909.N_89")
r.AddQueryid("SH.cx7.20030909.N_89")
r.ShowReport()
End Sub
//-->
</SCRIPT>

<SCRIPT FOR="r" EVENT="OnMsg(msg)" LANGUAGE="JScript">
mymsg = msg;


window.close();


</SCRIPT>



<OBJECT
id="r"
classid="clsid:CC721C00-9C4B-42DC-B3F6-4C78DDFD4A1E"
codebase="http://HFGHFGHFG/test/data/LisReport_Proj.cab#version=1,0,0,120"
width=100%
height=100%
align=center
hspace=0
vspace=0

>
</OBJECT>





</BODY>
</HTML>
 
顶部