1. ActiveX form 没有释放,exit,close
2. Destroy事件是在释放资源时系统自动调用
3. onActive 时,将属性赋值
2. Destroy事件是在释放资源时系统自动调用
3. onActive 时,将属性赋值
解决方案 »
- delphi dbexpress和ADO连接MYsql的速度问题
- round函数有个问题,不知道大家遇到过没有
- 为什么从网上拿下来的代码也会有错。郁闷呀!
- 如何用DBcheckbox来显示我数据库中的数据?怎么这都没有回答!!??
- 问一个编程的简单问题。
- 请教,
- DELPHI6.0+SQLSERVER用什么做报表的啊?
- 关于文件传输,两台电脑之间会接收不正常,只能收到一部分,几KB,本地则正常
- 请问:怎样将一个form放到最前面而又不得到焦点?
- 100分求教:D7调用java开发的webservice传值为空问题
- 如何显示ProgressBar的进度条,给分100
- delphi的 组件的安装问题
对于第一问:这样做没用,仍旧是上述现象
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.
ActiveForm可能生成了一些com组件,你是不是要在com管理里面首先把这个运行的com关掉!!!!
<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>
我考察了ADO控件,它也是AcitveX控件,
它能实现,为什么我们就不能实现?