在DLL文件中这样写procedure showycdj(connstr:TADOConnection;qxstr:tagLIMITS;usernamestr:WideString); begin dmyc:=Tdmyc.Create(nil); try dmyc.ADOConnection1.ConnectionString:=connstr.ConnectionString; frmycdj:=Tfrmycdj.Create(Application); // frmyw:=Tfrmyw.Create(Application); with frmycdj do try UserName:=usernamestr; qx:=qxstr; ShowModal; finally Free; end; except dmyc.Free; end; end;
感谢好友hui717的帮助!我在主程序加了DataModule把ADO等控件都加在其中了。在Dll(uses DataModule.pas)的调用中提示错误: ‘Access violation at address 0286337B in module prgmain.dll.read of address 000000058’刚才搜索帮助的时候有人提到过初始化,不清楚如何处理。
一般的做法是,在主窗体搞一个ADOConnection,
然后用传数将其传递到DLL文件中供其使用
begin
dmyc:=Tdmyc.Create(nil);
try
dmyc.ADOConnection1.ConnectionString:=connstr.ConnectionString;
frmycdj:=Tfrmycdj.Create(Application);
// frmyw:=Tfrmyw.Create(Application);
with frmycdj do
try
UserName:=usernamestr;
qx:=qxstr;
ShowModal;
finally
Free;
end;
except
dmyc.Free;
end;
end;
‘Access violation at address 0286337B in module prgmain.dll.read of address 000000058’刚才搜索帮助的时候有人提到过初始化,不清楚如何处理。