以下是我的调用的函数 procedure workajdy(AppHandle: TApplication;AUser_Name,AUser_LoginID,Fjcs: string); stdcall; begin Application := AppHandle; Zt := Trim(Fjcs); if FrmAjDy = nil then begin Application.CreateForm(TFrmAjDy,FrmAjDy); end else begin if FrmAjDy.WindowState = wsMinimized then FrmAjDy.WindowState := wsNormal; end; FrmAjDy.Show; end; 报表是放在FrmAjDy上,我的DLL的Exports 的函数就是workajdy 然后我是用loadlibary(mydll),然后再用GetProcAddress调用 对了,我在报表里还有用到Shape对象,我看过FR的DEMO,它的DLL的DEMO没有用到SHAPE和DATASET运行正常.
我加过了没有用,还是同样的错误,有时是'not valid pointer',有时是访问内存地址出错,我跟踪过SHOWREPORT的过程,以下是ShowPreparedReport的源码 procedure TfrReport.ShowPreparedReport; var s: String; p: TfrPreviewForm; begin CurReport := Self; MasterReport := Self; DocMode := dmPrinting; CurBand := nil; if EMFPages.Count = 0 then Exit; s := frLoadStr(SPreview); if Title <> '' then s := s + ' - ' + Title; if not (csDesigning in ComponentState) and Assigned(Preview) then Preview.Connect(Self) else begin if csDesigning in ComponentState then p := TfrPreviewForm.Create(nil) else //第一次预览一切正常, p := TfrPreviewForm.Create(Self); //第二次预览到这里出错 if MDIPreview then //我怀疑是程序handle传递错 begin p.WindowState := wsNormal; p.FormStyle := fsMDIChild; end; p.Caption := s; p.Show_Modal(Self); Application.ProcessMessages; end; end;
还有调用的参数及模块的创建方式是动态还是静态加载的
你写清楚一点
我做过的都是DLL报表
在VB写的程序来调用
一切正常
procedure workajdy(AppHandle: TApplication;AUser_Name,AUser_LoginID,Fjcs: string); stdcall;
begin
Application := AppHandle;
Zt := Trim(Fjcs);
if FrmAjDy = nil then
begin
Application.CreateForm(TFrmAjDy,FrmAjDy);
end
else
begin
if FrmAjDy.WindowState = wsMinimized then
FrmAjDy.WindowState := wsNormal;
end;
FrmAjDy.Show;
end;
报表是放在FrmAjDy上,我的DLL的Exports 的函数就是workajdy
然后我是用loadlibary(mydll),然后再用GetProcAddress调用
对了,我在报表里还有用到Shape对象,我看过FR的DEMO,它的DLL的DEMO没有用到SHAPE和DATASET运行正常.
procedure TfrReport.ShowPreparedReport;
var
s: String;
p: TfrPreviewForm;
begin
CurReport := Self;
MasterReport := Self;
DocMode := dmPrinting;
CurBand := nil;
if EMFPages.Count = 0 then Exit;
s := frLoadStr(SPreview);
if Title <> '' then s := s + ' - ' + Title;
if not (csDesigning in ComponentState) and Assigned(Preview) then
Preview.Connect(Self)
else
begin
if csDesigning in ComponentState then
p := TfrPreviewForm.Create(nil) else //第一次预览一切正常,
p := TfrPreviewForm.Create(Self); //第二次预览到这里出错
if MDIPreview then //我怀疑是程序handle传递错
begin
p.WindowState := wsNormal;
p.FormStyle := fsMDIChild;
end;
p.Caption := s;
p.Show_Modal(Self);
Application.ProcessMessages;
end;
end;
FINALY
试试