dll内定义了var
tmp:tADOConnection;
fm_tmp:TForm1; //TForm1为DLL内定义的窗体function showf(adocon:TADOConnection):boolean;stdcall;
begin
tmp:=TADOConnection.Create(nil);
fm_tmp:=TForm1.Create(nil);
try
tmp:=adocon;
fm_tmp.showmodula;
finally
tmp.free;
fm_tmp.free;
end;
end;form1里定义了adoquery,为何下执行到Show不行,
以下是的show内出错的地方:begin
ADOQuery1.Connection:=tmp; //为何无法通过全局变量将主程序里的
end; //ADOConnection传递给DLL内的窗体//如果不行,那应如何才可把DLL内的ADO连接连至主程序的ADOConnection上,
//不要通过传递ConnectionString的方法实现,因为如果通过多个连接器的话会产
//生多个连接器并发的问题,哪位高手有办法解决这个问题,在线等
tmp:tADOConnection;
fm_tmp:TForm1; //TForm1为DLL内定义的窗体function showf(adocon:TADOConnection):boolean;stdcall;
begin
tmp:=TADOConnection.Create(nil);
fm_tmp:=TForm1.Create(nil);
try
tmp:=adocon;
fm_tmp.showmodula;
finally
tmp.free;
fm_tmp.free;
end;
end;form1里定义了adoquery,为何下执行到Show不行,
以下是的show内出错的地方:begin
ADOQuery1.Connection:=tmp; //为何无法通过全局变量将主程序里的
end; //ADOConnection传递给DLL内的窗体//如果不行,那应如何才可把DLL内的ADO连接连至主程序的ADOConnection上,
//不要通过传递ConnectionString的方法实现,因为如果通过多个连接器的话会产
//生多个连接器并发的问题,哪位高手有办法解决这个问题,在线等
我就这么传过,没有发现问题
function showf(h :thandle;adocon:TADOConnection):boolean;stdcall;
begin
application.handle := h;////////////////
tmp:=TADOConnection.Create(nil);
fm_tmp:=TForm1.Create(application); ////////////
try
tmp:=adocon;
fm_tmp.showmodula;
finally
tmp.free;
fm_tmp.free;
end;
end;
function showf(h :thandle;adocon:TADOConnection):boolean;stdcall;
begin
application.handle := h;////////////////
tmp:=TADOConnection.Create(nil);
fm_tmp:=TForm1.Create(application); ////////////
try
tmp:=adocon;
fm_tmp.showmodula;
finally
fm_tmp.free;
tmp.free; ///////这里释放的顺序也要换一下
end;
end;