关于ActiveX里访问Form的问题。Form里的变量Inaccessible。(100分)

  • 主题发起人 eastphoenix
  • 开始时间
E

eastphoenix

Unregistered / Unconfirmed
GUEST, unregistred user!
我在网页内嵌了一个ActiveX,内用了一个Form1,还有一个回调函数Say用来被COM服务器调
用来向网页传递消息。可是在Say函数里无法访问Form1内的元素,代码如下:

unit ClientInterface;

interface
uses Dialogs, ComObj, dprCallBackAndIP_TLB;
type
TCallBack = class(TAutoIntfObject, IAgent)
procedure Say(var testString: OleVariant;out isSuccess: OleVariant)
safecall;
end;

implementation

uses IEForm;

procedure TCallBack.Say(var testString:OleVariant;out isSuccess: OleVariant);
var
tempString:String;
begin
isSuccess := 0;
try
tempString := testString;
//Form1.Edit1.Text := tempString;
showmessage(tempString);
//Form1.Edit1.Text := 'hello world';

Form1.ShowInWEB(PChar(tempString));//跟踪置函数内,发现有变量Inaccessible
except
isSuccess := 1;
end;
end;

end.

技术瓶颈,请各位尽快解决,谢谢
 
你的 form1 在哪儿声明的,初始化了没有?
 
Form1在unit IEForm里。我试着在ActiveX的Form,即我的Form1里添加一个按钮激发
Form1.ShowInWEB(PChar(tempString))。可以实现。
莫不是在TCallBack里重载构造函数来创建Form1的实例吗?
TAutoIntfObject的Create是静态的不让重载。
关键是我在一个普通的exe中用上述代码没问题,可是加在ActiveX里就不行。
ActiveX里在哪里初始化Form呢?
 
时间太久了,算啦
 
接受答案了.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
581
import
I
顶部