O
otqsoft
Unregistered / Unconfirmed
GUEST, unregistred user!
我在写查询时,把查询生成一个Dll,所有的查询都要调用这一个Dll,怎么让每一个创建的窗体互不影响呢?
调用接口如下:
function DllFindInterFace(var tmpADO: TADOConnection; tmpNo,tmpName,tmpTable,tmpCaption: pchar): TForm;
var
count: integer;
AForm: array of TfrmFindMain;
begin
ADOCONN:= tmpADO;
FindUserID:= string(tmpNo);
FindUserName:= string(tmpName);
TableName:= string(tmpTable);
TitCaption:= string(tmpCaption);
try
count:= high(AForm) - low(AForm) + 1;
SetLength(AForm, count+1);
AForm[high(AForm)]:= TfrmFindMain.Create(Application);
Application.ProcessMessages;
AForm[high(AForm)].Caption:= TitCaption;
ThemeColor:= LoadInterFace(AForm[high(AForm)]);
AForm[high(AForm)].GetFindInfo(TitCaption);
Result:= AForm[high(AForm)];
except
on E: Exception do
begin
WriteLog('UfindInterFace -> DllFindInterFace -> 查询窗体初始化加载失败!'+ e.Message);
WriteUserLog('查询窗体创建失败!',e.Message);
if Assigned(AForm[high(AForm)]) then
begin
AForm[high(AForm)].Close;
AForm[high(AForm)]:= nil;
end;
end;
end;
end;
调用接口如下:
function DllFindInterFace(var tmpADO: TADOConnection; tmpNo,tmpName,tmpTable,tmpCaption: pchar): TForm;
var
count: integer;
AForm: array of TfrmFindMain;
begin
ADOCONN:= tmpADO;
FindUserID:= string(tmpNo);
FindUserName:= string(tmpName);
TableName:= string(tmpTable);
TitCaption:= string(tmpCaption);
try
count:= high(AForm) - low(AForm) + 1;
SetLength(AForm, count+1);
AForm[high(AForm)]:= TfrmFindMain.Create(Application);
Application.ProcessMessages;
AForm[high(AForm)].Caption:= TitCaption;
ThemeColor:= LoadInterFace(AForm[high(AForm)]);
AForm[high(AForm)].GetFindInfo(TitCaption);
Result:= AForm[high(AForm)];
except
on E: Exception do
begin
WriteLog('UfindInterFace -> DllFindInterFace -> 查询窗体初始化加载失败!'+ e.Message);
WriteUserLog('查询窗体创建失败!',e.Message);
if Assigned(AForm[high(AForm)]) then
begin
AForm[high(AForm)].Close;
AForm[high(AForm)]:= nil;
end;
end;
end;
end;