我现在在delphi6 中 通过新建:ActiveX Library,然后在这个基础上面新建一个:ActiveX Control ,ActiveX Control 中从TEDIT中继承,我在ActiveX Control控件中定义了一个方法getMyValue(),然后编译为OCX,注册此ocx,通过 组件菜单中的 导入ActiveX控件把这个控件安装.接下来,我新建一个项目,是ActiveX Form ,在这个项目中要使用到上面做的控件,
请问,我怎么在ActiveX Form中访问 ActiveX Control控件中的自定义方法getMyValue()啊,在线等,问题解决马上给分.
请问,我怎么在ActiveX Form中访问 ActiveX Control控件中的自定义方法getMyValue()啊,在线等,问题解决马上给分.
uses
ComServ,
EditXControl_TLB in 'EditXControl_TLB.pas',
EditImpl in 'EditImpl.pas' {EditX: CoClass};unit EditImpl;type
TEditX = class(TActiveXControl, IEditX)
private
......
protected
......
procedure GetValue; safecall;
end; procedure TEditX.GetValue;
begin
//
end;unit EditXControl_TLB;TEditX = class(TOleControl)
private
......
protected
......
public
......
procedure GetValue;
......
published
....
end;............
procedure TEditX.GetValue;
begin
DefaultInterface.GetValue;
end;.........................调用范例unit ActiveFormImpl; TActiveFormX = class(TActiveForm, IActiveFormX)
EditX: TEditX;
procedure ActiveFormCreate(Sender: TObject);
.......... procedure TActiveFormX.ActiveFormCreate(Sender: TObject);
begin
EditX.GetValue;
end;
begin
CreateControl;
Result := DefaultInterface.Text;
end;为什么 这个方法在编译的时候还没有问题,但在注册的时候就自动丢失了,这是为什么呢??
function TGdPostEdit.GetEditPassWord:string;
begin
Result := FDelphiControl.Text;
end;