1. ActiveX form 没有释放,exit,close
2. Destroy事件是在释放资源时系统自动调用
3. onActive 时,将属性赋值

解决方案 »

  1.   

    to: tccb(tccb)
    对于第一问:这样做没用,仍旧是上述现象
    2、我想是吧,但我在这个过程中写的代码没法执行,
    既然系统自动调用,也该执行我这段代码才对呀,
    3、具体点,能不能给个例子,
    下面我把属性编辑器和在控件中我自己加的接口的源代码贴出来,
    请大家研究
    {新加接口属性的源码}
    function TRCR.Get_DriverName: WideString;
    begin
      Result:=WideString(ADriverName);
    end;procedure TRCR.Set_DriverName(const Value: WideString);
    begin
      ADriverName:=Value;
    end;function TRCR.Get_ParamsOfDatabase: IStrings;
    begin
      GetOleStrings(Database.Params,Result);
    end;procedure TRCR.Set_ParamsOfDatabase(const Value: IStrings);
    begin
      SetOleStrings(Database.Params,Value);
    end;procedure TRCR.ActiveFormCreate(Sender: TObject);
    begin
      DriverList:=TStringList.Create ;
      Database.Session.GetDriverNames(DriverList);
    end;function TRCR.Get_ActiveData: WordBool;
    begin
      Result:=Database.Connected;
    end;procedure TRCR.Set_ActiveData(Value: WordBool);
    begin
     Database.Connected:=Value;
    end;{属性编辑页的源码 }
    type
      TPropertyPage1 = class(TPropertyPage)
        Label1: TLabel;
        CbxDriver: TComboBox;
        Memo1: TMemo;
        Label2: TLabel;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
        procedure PropertyPageCreate(Sender: TObject);
      private
        { Private declarations }
      protected
        { Protected declarations }
      public
        { Public declarations }
        procedure UpdatePropertyPage; override;
        procedure UpdateObject; override;
      end;const
      Class_PropertyPage1: TGUID = '{C87D094B-1F90-41B3-9B64-64021EBC8409}';implementationuses PubVar;
    {$R *.DFM}procedure TPropertyPage1.UpdatePropertyPage;
    var I:Integer;
    begin
      { Update your controls from OleObject }  CbxDriver.Text:=OleObject.DriverName; //当前驱动名  for I:=0 to OleObject.ParamsOfDatabase.Count-1 do
      Memo1.Lines.Add(OleObject.ParamsOfDatabase[I]);
    end;procedure TPropertyPage1.UpdateObject;
    Var I:Integer;
    begin
      { Update OleObject from your controls }
      OleObject.DriverName:=CbxDriver.text;
      OleObject.ParamsOfDatabase.Clear;
      for I:=0 to Memo1.Lines.Count-1 do
       OleObject.ParamsOfDatabase.Add(Memo1.Lines[I]);
    end;procedure TPropertyPage1.Button1Click(Sender: TObject);
    begin
     // try
      OleObject.ActiveData:=true;
      MessageBox(0,'连接成功!','消息',mb_ok or mb_iconInformation);
      //except
      OleObject.ActiveData:=False;
      MessageBox(0,'连接失败!','消息',mb_ok or mb_iconWarning);
     // end;{DBTemp.Params:=Memo1.Lines ;
    DBTemp.DriverName:=CbxDriver.Text ;
    try
     DBTemp.Open ;
     if DBTemp.Connected  then
       MessageBox(0,'连接成功!','消息',mb_ok or mb_iconInformation)
     else
       MessageBox(0,'连接失败!','消息',mb_ok or mb_iconWarning);
    finally
     MessageBox(0,'连接失败!','消息',mb_ok or mb_iconWarning);
     DBTemp.close;
    end;}
    end;procedure TPropertyPage1.PropertyPageCreate(Sender: TObject);
    begin
    Memo1.Clear ;
    CbxDriver.Items.Assign(DriverList);
    end;initialization
      TActiveXPropertyPageFactory.Create(
        ComServer,
        TPropertyPage1,
        Class_PropertyPage1);
    end.
      

  2.   

    我讨论一下第一问。
    ActiveForm可能生成了一些com组件,你是不是要在com管理里面首先把这个运行的com关掉!!!!
      

  3.   

    问题3:可用通过在HTML中的param将参数传给控件
    <OBJECT
      classid="clsid:2CD9C47F-40DA-4CDA-8E3B-0345C77BD1EA"
      codebase="yourActiveX.ocx#version=1,0,1,0"
      width=770
      height=545
      align=center
      hspace=0
      vspace=0
    >
    <Param name="DriverName" Value="sql">
    </OBJECT>
      

  4.   

    本人并没有将此用在网页中,
    我考察了ADO控件,它也是AcitveX控件,
    它能实现,为什么我们就不能实现?
      

  5.   

    我觉得的你的第二个问题没有调用destropy就是因为第一个问题,控件一直没被系统释放,当然不会调用你的代码。
      

  6.   

    你可以下一个调试工具好像是INTRBRO5.0,很好用的!